monit-5.35.2/0000755000016400001720000000000015007061177007734 500000000000000monit-5.35.2/config/0000755000016400001720000000000015007061161011172 500000000000000monit-5.35.2/config/compile0000755000016400001720000001635015007061161012475 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: monit-5.35.2/config/ax_check_compile_flag.m40000644000016400001720000000407015007061157015630 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS monit-5.35.2/config/ltmain.sh0000755000016400001720000117720315007061157012755 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.6 Debian-2.4.6-15build2" package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd _G_rc_run_hooks=false case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do if eval $_G_hook '"$@"'; then # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift _G_rc_run_hooks=: fi done $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, you may remove/edit # any options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. In this case you also must return $EXIT_SUCCESS to let the # hook's caller know that it should pay attention to # '_result'. Returning $EXIT_FAILURE signalizes that # arguments are left untouched by the hook and therefore caller will ignore the # result variable. # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). There is # # no need to do the equivalent (but slower) action: # # func_quote_for_eval ${1+"$@"} # # my_options_prep_result=$func_quote_for_eval_result # false # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: # args_changed=: # ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@", we could need that later # # if $args_changed is true. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # if $args_changed; then # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # fi # # $args_changed # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # false # } # func_add_hook func_validate_options my_option_validation # # You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd _G_func_options_finish_exit=false if func_run_hooks func_options ${1+"$@"}; then func_options_finish_result=$func_run_hooks_result _G_func_options_finish_exit=: fi $_G_func_options_finish_exit } # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd _G_rc_options=false for my_func in options_prep parse_options validate_options options_finish do if eval func_$my_func '${1+"$@"}'; then eval _G_res_var='$'"func_${my_func}_result" eval set dummy "$_G_res_var" ; shift _G_rc_options=: fi done # Save modified positional parameters for caller. As a top-level # options-parser function we always need to set the 'func_options_result' # variable (regardless the $_G_rc_options value). if $_G_rc_options; then func_options_result=$_G_res_var else func_quote_for_eval ${1+"$@"} func_options_result=$func_quote_for_eval_result fi $_G_rc_options } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= _G_rc_options_prep=false if func_run_hooks func_options_prep ${1+"$@"}; then _G_rc_options_prep=: # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result fi $_G_rc_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. if func_run_hooks func_parse_options ${1+"$@"}; then eval set dummy "$func_run_hooks_result"; shift _G_rc_parse_options=: fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_rc_parse_options=: break fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac $_G_match_parse_options && _G_rc_parse_options=: done if $_G_rc_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result fi $_G_rc_parse_options } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd _G_rc_validate_options=false # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" if func_run_hooks func_validate_options ${1+"$@"}; then # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result _G_rc_validate_options=: fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE $_G_rc_validate_options } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname $scriptversion Debian-2.4.6-15build2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= _G_rc_lt_options_prep=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result fi $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"} ; shift _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result fi $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # 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 BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -static-* direct GCC to link specific libraries statically # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: monit-5.35.2/config/Info.plist0000644000016400001720000000060115007061157013064 00000000000000 CFBundleIdentifier com.tildeslash.monit CFBundleName monit CFBundleShortVersionString $(MARKETING_VERSION) monit-5.35.2/config/install-sh0000755000016400001720000003577615007061161013140 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: monit-5.35.2/config/missing0000755000016400001720000001533615007061161012521 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: monit-5.35.2/config/config.guess0000755000016400001720000014051215007061161013435 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI=${LIBC}x32 fi fi GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; x86_64:Haiku:*:*) GUESS=x86_64-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&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` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.35.2/config/ax_info.m40000644000016400001720000000424015007061157013004 00000000000000# # Functions for printing a configure info box. # # Copyright © 2020 Tildeslash Ltd. All rights reserved. AC_DEFUN([AX_INFO_GPL], [ cat <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ | linux-musl* | linux-relibc* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.35.2/Makefile.in0000644000016400001720000013354315007061161011723 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) Tildeslash Ltd. All rights reserved. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = monit$(EXEEXT) # -------------- # MacOS codesign # -------------- @WITH_CODESIGN_TRUE@am__append_1 = -sectcreate __TEXT __info_plist config/Info.plist subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/config/ax_check_compile_flag.m4 \ $(top_srcdir)/config/ax_info.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = system/startup/monit.upstart \ system/startup/monit.service CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp am_monit_OBJECTS = src/y.tab.$(OBJEXT) src/lex.yy.$(OBJEXT) \ src/monit.$(OBJEXT) src/alert.$(OBJEXT) src/control.$(OBJEXT) \ src/daemonize.$(OBJEXT) src/env.$(OBJEXT) src/event.$(OBJEXT) \ src/file.$(OBJEXT) src/gc.$(OBJEXT) src/http.$(OBJEXT) \ src/log.$(OBJEXT) src/md5.$(OBJEXT) src/md5_crypt.$(OBJEXT) \ src/net/net.$(OBJEXT) src/net/socket.$(OBJEXT) \ src/net/Link.$(OBJEXT) src/sha1.$(OBJEXT) \ src/checksum.$(OBJEXT) src/signal.$(OBJEXT) \ src/spawn.$(OBJEXT) src/state.$(OBJEXT) src/util.$(OBJEXT) \ src/validate.$(OBJEXT) src/device/device_common.$(OBJEXT) \ src/device/sysdep_@ARCH@.$(OBJEXT) src/http/base64.$(OBJEXT) \ src/http/cervlet.$(OBJEXT) src/http/client.$(OBJEXT) \ src/http/engine.$(OBJEXT) src/http/xml.$(OBJEXT) \ src/http/processor.$(OBJEXT) \ src/notification/Address.$(OBJEXT) \ src/notification/MMonit.$(OBJEXT) \ src/notification/SMTP.$(OBJEXT) \ src/process/SystemInfo.$(OBJEXT) \ src/process/ProcessTree.$(OBJEXT) \ src/process/sysdep_@ARCH@.$(OBJEXT) \ src/protocols/apache_status.$(OBJEXT) \ src/protocols/clamav.$(OBJEXT) src/protocols/default.$(OBJEXT) \ src/protocols/dns.$(OBJEXT) src/protocols/dwp.$(OBJEXT) \ src/protocols/fail2ban.$(OBJEXT) src/protocols/ftp.$(OBJEXT) \ src/protocols/generic.$(OBJEXT) src/protocols/gps.$(OBJEXT) \ src/protocols/http.$(OBJEXT) src/protocols/imap.$(OBJEXT) \ src/protocols/ldap2.$(OBJEXT) src/protocols/ldap3.$(OBJEXT) \ src/protocols/lmtp.$(OBJEXT) src/protocols/memcache.$(OBJEXT) \ src/protocols/mongodb.$(OBJEXT) src/protocols/mqtt.$(OBJEXT) \ src/protocols/mysql.$(OBJEXT) src/protocols/nntp.$(OBJEXT) \ src/protocols/ntp3.$(OBJEXT) src/protocols/pgsql.$(OBJEXT) \ src/protocols/pop.$(OBJEXT) \ src/protocols/postfix_policy.$(OBJEXT) \ src/protocols/protocol.$(OBJEXT) \ src/protocols/radius.$(OBJEXT) src/protocols/rdate.$(OBJEXT) \ src/protocols/redis.$(OBJEXT) src/protocols/rsync.$(OBJEXT) \ src/protocols/sieve.$(OBJEXT) src/protocols/sip.$(OBJEXT) \ src/protocols/smtp.$(OBJEXT) \ src/protocols/spamassassin.$(OBJEXT) \ src/protocols/ssh.$(OBJEXT) src/protocols/tns.$(OBJEXT) \ src/protocols/websocket.$(OBJEXT) src/ssl/Ssl.$(OBJEXT) \ src/terminal/TextBox.$(OBJEXT) \ src/terminal/TextColor.$(OBJEXT) \ src/statistics/Statistics.$(OBJEXT) monit_OBJECTS = $(am_monit_OBJECTS) monit_DEPENDENCIES = libmonit/libmonit.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = monit_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(monit_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(monit_SOURCES) DIST_SOURCES = $(monit_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/compile \ $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ $(top_srcdir)/config/missing $(top_srcdir)/src/config.h.in \ $(top_srcdir)/system/startup/monit.service.in \ $(top_srcdir)/system/startup/monit.upstart.in COPYING \ README.md config/compile config/config.guess config/config.sub \ config/install-sh config/ltmain.sh config/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ARCH = @ARCH@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODESIGN_IDENTITY = @CODESIGN_IDENTITY@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FLEX = @FLEX@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POD2MAN = @POD2MAN@ POD2MANFLAGS = @POD2MANFLAGS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sslincldir = @sslincldir@ ssllibdir = @ssllibdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign no-dependencies subdir-objects ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = COPYING CONTRIBUTORS bootstrap doc src config monitrc system libmonit monit.1 SUBDIRS = libmonit FLEXFLAGS = -i YACCFLAGS = -dvt AM_CPPFLAGS = $(CPPFLAGS) $(EXTCPPFLAGS) -D@ARCH@ -DSYSCONFDIR="\"@sysconfdir@\"" -I./src -I./src/device -I./src/http -I./src/notification -I./src/process -I./src/protocols -I./src/ssl -I./src/terminal -I./libmonit/src AM_LDFLAGS = $(LDFLAGS) $(EXTLDFLAGS) -L./lib/ monit_SOURCES = src/y.tab.c \ src/lex.yy.c \ src/monit.c \ src/alert.c \ src/control.c \ src/daemonize.c \ src/env.c \ src/event.c \ src/file.c \ src/gc.c \ src/http.c \ src/log.c \ src/md5.c \ src/md5_crypt.c \ src/net/net.c \ src/net/socket.c \ src/net/Link.c \ src/sha1.c \ src/checksum.c \ src/signal.c \ src/spawn.c \ src/state.c \ src/util.c \ src/validate.c \ src/device/device_common.c \ src/device/sysdep_@ARCH@.c \ src/http/base64.c \ src/http/cervlet.c \ src/http/client.c \ src/http/engine.c \ src/http/xml.c \ src/http/processor.c \ src/notification/Address.c \ src/notification/MMonit.c \ src/notification/SMTP.c \ src/process/SystemInfo.c \ src/process/ProcessTree.c \ src/process/sysdep_@ARCH@.c \ src/protocols/apache_status.c \ src/protocols/clamav.c \ src/protocols/default.c \ src/protocols/dns.c \ src/protocols/dwp.c \ src/protocols/fail2ban.c \ src/protocols/ftp.c \ src/protocols/generic.c \ src/protocols/gps.c \ src/protocols/http.c \ src/protocols/imap.c \ src/protocols/ldap2.c \ src/protocols/ldap3.c \ src/protocols/lmtp.c \ src/protocols/memcache.c \ src/protocols/mongodb.c \ src/protocols/mqtt.c \ src/protocols/mysql.c \ src/protocols/nntp.c \ src/protocols/ntp3.c \ src/protocols/pgsql.c \ src/protocols/pop.c \ src/protocols/postfix_policy.c \ src/protocols/protocol.c \ src/protocols/radius.c \ src/protocols/rdate.c \ src/protocols/redis.c \ src/protocols/rsync.c \ src/protocols/sieve.c \ src/protocols/sip.c \ src/protocols/smtp.c \ src/protocols/spamassassin.c \ src/protocols/ssh.c \ src/protocols/tns.c \ src/protocols/websocket.c \ src/ssl/Ssl.c \ src/terminal/TextBox.c \ src/terminal/TextColor.c \ src/statistics/Statistics.c monit_LDADD = libmonit/libmonit.la monit_LDFLAGS = -static $(EXTLDFLAGS) $(am__append_1) man_MANS = monit.1 BUILT_SOURCES = src/lex.yy.c src/y.tab.c src/y.tab.h CLEANFILES = src/y.output DISTCLEANFILES = *~ $(BUILT_SOURCES) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): src/config.h: src/stamp-h1 @test -f $@ || rm -f src/stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) src/stamp-h1 src/stamp-h1: $(top_srcdir)/src/config.h.in $(top_builddir)/config.status @rm -f src/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(top_srcdir)/src/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f src/stamp-h1 touch $@ distclean-hdr: -rm -f src/config.h src/stamp-h1 system/startup/monit.upstart: $(top_builddir)/config.status $(top_srcdir)/system/startup/monit.upstart.in cd $(top_builddir) && $(SHELL) ./config.status $@ system/startup/monit.service: $(top_builddir)/config.status $(top_srcdir)/system/startup/monit.service.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/y.tab.$(OBJEXT): src/$(am__dirstamp) src/lex.yy.$(OBJEXT): src/$(am__dirstamp) src/monit.$(OBJEXT): src/$(am__dirstamp) src/alert.$(OBJEXT): src/$(am__dirstamp) src/control.$(OBJEXT): src/$(am__dirstamp) src/daemonize.$(OBJEXT): src/$(am__dirstamp) src/env.$(OBJEXT): src/$(am__dirstamp) src/event.$(OBJEXT): src/$(am__dirstamp) src/file.$(OBJEXT): src/$(am__dirstamp) src/gc.$(OBJEXT): src/$(am__dirstamp) src/http.$(OBJEXT): src/$(am__dirstamp) src/log.$(OBJEXT): src/$(am__dirstamp) src/md5.$(OBJEXT): src/$(am__dirstamp) src/md5_crypt.$(OBJEXT): src/$(am__dirstamp) src/net/$(am__dirstamp): @$(MKDIR_P) src/net @: > src/net/$(am__dirstamp) src/net/net.$(OBJEXT): src/net/$(am__dirstamp) src/net/socket.$(OBJEXT): src/net/$(am__dirstamp) src/net/Link.$(OBJEXT): src/net/$(am__dirstamp) src/sha1.$(OBJEXT): src/$(am__dirstamp) src/checksum.$(OBJEXT): src/$(am__dirstamp) src/signal.$(OBJEXT): src/$(am__dirstamp) src/spawn.$(OBJEXT): src/$(am__dirstamp) src/state.$(OBJEXT): src/$(am__dirstamp) src/util.$(OBJEXT): src/$(am__dirstamp) src/validate.$(OBJEXT): src/$(am__dirstamp) src/device/$(am__dirstamp): @$(MKDIR_P) src/device @: > src/device/$(am__dirstamp) src/device/device_common.$(OBJEXT): src/device/$(am__dirstamp) src/device/sysdep_@ARCH@.$(OBJEXT): src/device/$(am__dirstamp) src/http/$(am__dirstamp): @$(MKDIR_P) src/http @: > src/http/$(am__dirstamp) src/http/base64.$(OBJEXT): src/http/$(am__dirstamp) src/http/cervlet.$(OBJEXT): src/http/$(am__dirstamp) src/http/client.$(OBJEXT): src/http/$(am__dirstamp) src/http/engine.$(OBJEXT): src/http/$(am__dirstamp) src/http/xml.$(OBJEXT): src/http/$(am__dirstamp) src/http/processor.$(OBJEXT): src/http/$(am__dirstamp) src/notification/$(am__dirstamp): @$(MKDIR_P) src/notification @: > src/notification/$(am__dirstamp) src/notification/Address.$(OBJEXT): src/notification/$(am__dirstamp) src/notification/MMonit.$(OBJEXT): src/notification/$(am__dirstamp) src/notification/SMTP.$(OBJEXT): src/notification/$(am__dirstamp) src/process/$(am__dirstamp): @$(MKDIR_P) src/process @: > src/process/$(am__dirstamp) src/process/SystemInfo.$(OBJEXT): src/process/$(am__dirstamp) src/process/ProcessTree.$(OBJEXT): src/process/$(am__dirstamp) src/process/sysdep_@ARCH@.$(OBJEXT): src/process/$(am__dirstamp) src/protocols/$(am__dirstamp): @$(MKDIR_P) src/protocols @: > src/protocols/$(am__dirstamp) src/protocols/apache_status.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/clamav.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/default.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/dns.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/dwp.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/fail2ban.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/ftp.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/generic.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/gps.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/http.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/imap.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/ldap2.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/ldap3.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/lmtp.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/memcache.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/mongodb.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/mqtt.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/mysql.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/nntp.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/ntp3.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/pgsql.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/pop.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/postfix_policy.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/protocol.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/radius.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/rdate.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/redis.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/rsync.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/sieve.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/sip.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/smtp.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/spamassassin.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/ssh.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/tns.$(OBJEXT): src/protocols/$(am__dirstamp) src/protocols/websocket.$(OBJEXT): src/protocols/$(am__dirstamp) src/ssl/$(am__dirstamp): @$(MKDIR_P) src/ssl @: > src/ssl/$(am__dirstamp) src/ssl/Ssl.$(OBJEXT): src/ssl/$(am__dirstamp) src/terminal/$(am__dirstamp): @$(MKDIR_P) src/terminal @: > src/terminal/$(am__dirstamp) src/terminal/TextBox.$(OBJEXT): src/terminal/$(am__dirstamp) src/terminal/TextColor.$(OBJEXT): src/terminal/$(am__dirstamp) src/statistics/$(am__dirstamp): @$(MKDIR_P) src/statistics @: > src/statistics/$(am__dirstamp) src/statistics/Statistics.$(OBJEXT): src/statistics/$(am__dirstamp) monit$(EXEEXT): $(monit_OBJECTS) $(monit_DEPENDENCIES) $(EXTRA_monit_DEPENDENCIES) @rm -f monit$(EXEEXT) $(AM_V_CCLD)$(monit_LINK) $(monit_OBJECTS) $(monit_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/*.$(OBJEXT) -rm -f src/device/*.$(OBJEXT) -rm -f src/http/*.$(OBJEXT) -rm -f src/net/*.$(OBJEXT) -rm -f src/notification/*.$(OBJEXT) -rm -f src/process/*.$(OBJEXT) -rm -f src/protocols/*.$(OBJEXT) -rm -f src/ssl/*.$(OBJEXT) -rm -f src/statistics/*.$(OBJEXT) -rm -f src/terminal/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(AM_V_CC)$(COMPILE) -c -o $@ $< .c.obj: $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive @WITH_CODESIGN_FALSE@all-local: all-am: Makefile $(PROGRAMS) $(MANS) all-local installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f src/$(am__dirstamp) -rm -f src/device/$(am__dirstamp) -rm -f src/http/$(am__dirstamp) -rm -f src/net/$(am__dirstamp) -rm -f src/notification/$(am__dirstamp) -rm -f src/process/$(am__dirstamp) -rm -f src/protocols/$(am__dirstamp) -rm -f src/ssl/$(am__dirstamp) -rm -f src/statistics/$(am__dirstamp) -rm -f src/terminal/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 .MAKE: $(am__recursive_targets) all check install install-am \ install-exec install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ am--refresh check check-am clean clean-binPROGRAMS \ clean-cscope clean-generic clean-libtool clean-local cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-local distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 .PRECIOUS: Makefile define check-exit || exit 1 endef # ------- # Targets # ------- dist-hook:: -rm -rf `find $(distdir) -name "._*"` -rm -rf `find $(distdir) -name ".DS_Store"` -rm -rf `find $(distdir) -name ".libs"` -rm -rf `find $(distdir) -name ".git"` -rm -rf `find $(distdir) -name ".dirstamp"` -rm -rf $(distdir)/libmonit/libmonit.xcodeproj -rm -rf $(distdir)/libmonit/config.log -rm -rf $(distdir)/libmonit/config.status -rm -rf $(distdir)/libmonit/autom4te.cache -rm -f $(distdir)/src/config.h -rm -f $(distdir)/src/stamp-* -rm -f $(distdir)/src/y.output -rm -f $(distdir)/README.md -rm -f $(distdir)/libmonit/README* -mv $(distdir)/doc/CHANGES $(distdir)/ -perl -pi -e 's/^Version: .*/Version: '$(VERSION)'/' $(distdir)/system/packages/redhat/monit.spec -chmod 600 monitrc clean-local: -rm -f `find . -name "*.o" -o -name "*.lo" -o -name "*.loT" -o -name "*~"` distclean-local: -rm -rf autom4te.cache/ -rm -f monit-[0-9].*tar.gz cleanall: clean distclean -git clean -fxd monit.1: doc/monit.pod $(POD2MAN) $(POD2MANFLAGS) $< > $@ -rm -f pod2* # ------------- # Grammar rules # ------------- src/y.tab.c src/y.tab.h: run-yacc .INTERMEDIATE: run-yacc run-yacc: src/p.y $(YACC) $(YACCFLAGS) -o src/y.tab.c $< src/lex.yy.c: src/l.l $(FLEX) $(FLEXFLAGS) -o$@ $< @WITH_CODESIGN_TRUE@all-local: $(bin_PROGRAMS) @WITH_CODESIGN_TRUE@ $(foreach file, $(bin_PROGRAMS), \ @WITH_CODESIGN_TRUE@ codesign -s $(CODESIGN_IDENTITY) -v --deep --timestamp --options runtime $(file) \ @WITH_CODESIGN_TRUE@ $(check-exit)) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: monit-5.35.2/system/0000755000016400001720000000000015007061157011256 500000000000000monit-5.35.2/system/packages/0000755000016400001720000000000015007061157013034 500000000000000monit-5.35.2/system/packages/redhat/0000755000016400001720000000000015007061177014305 500000000000000monit-5.35.2/system/packages/redhat/monit.spec0000644000016400001720000002004215007061177016225 00000000000000Name: monit Summary: Process monitor and restart utility Version: 5.35.2 Release: 1 URL: http://mmonit.com/monit/ Source: http://mmonit.com/monit/dist/%{name}-%{version}.tar.gz Group: Utilities/Console BuildRoot: %{_tmppath}/%{name}-buildroot License: AGPL %{!?_with_ssl: %{!?_without_ssl: %define _with_ssl --with-ssl}} %{?_with_ssl:BuildRequires: openssl-devel} %{!?_with_pam: %{!?_without_pam: %define _with_pam --with-pam}} %{?_with_pam:BuildRequires: pam-devel} %description Monit is a utility for managing and monitoring processes, files, directories and filesystems on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. %prep %setup %build %configure \ %{?_with_ssl} \ %{?_without_ssl} \ %{?_with_pam} \ %{?_without_pam} make %{?_smp_mflags} %install if [ -d %{buildroot} ] ; then rm -rf %{buildroot} fi mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_mandir}/man1 mkdir -p %{buildroot}/etc/init.d install -m 755 monit %{buildroot}%{_bindir}/monit install -m 644 monit.1 %{buildroot}%{_mandir}/man1/monit.1 install -m 600 monitrc %{buildroot}/etc/monitrc install -m 755 system/startup/rc.monit %{buildroot}/etc/init.d/%{name} %post /sbin/chkconfig --add %{name} %preun if [ $1 = 0 ]; then /etc/init.d/%{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} fi %clean if [ -d %{buildroot} ] ; then rm -rf %{buildroot} fi %files %defattr(-,root,root) %doc COPYING CHANGES %config(noreplace) /etc/monitrc %config /etc/init.d/%{name} %{_bindir}/%{name} %{_mandir}/man1/%{name}.1.gz %changelog * Wed May 07 2025 Monit team - Upgraded to monit-5.35.2 * Mon Apr 28 2025 Monit team - Upgraded to monit-5.35.1 * Tue Mar 04 2025 Monit team - Upgraded to monit-5.35.0 * Tue Dec 17 2024 Monit team - Upgraded to monit-5.34.4 * Thu Nov 28 2024 Monit team - Upgraded to monit-5.34.3 * Fri Oct 11 2024 Monit team - Upgraded to monit-5.34.2 * Fri Oct 04 2024 Monit team - Upgraded to monit-5.34.1 * Wed May 29 2024 Monit team - Upgraded to monit-5.34.0 * Sat Feb 11 2023 Monit team - Upgraded to monit-5.33.0 * Fri Mar 18 2022 Monit team - Upgraded to monit-5.32.0 * Thu Feb 10 2022 Monit team - Upgraded to monit-5.31.0 * Wed Jan 12 2022 Monit team - Upgraded to monit-5.30.0 * Tue Aug 24 2021 Monit team - Upgraded to monit-5.29.0 * Wed Jul 28 2021 Monit team - Upgraded to monit-5.28.1 * Mon Mar 29 2021 Monit team - Upgraded to monit-5.28.0 * Tue Oct 27 2020 Martin Pala - Upgraded to monit-5.27.2 * Sun Aug 30 2020 Martin Pala - Upgraded to monit-5.27.1 * Thu Jan 16 2020 Martin Pala - Upgraded to monit-5.27.0 * Sat Jul 06 2019 Martin Pala - Upgraded to monit-5.26.0 * Tue Mar 05 2019 Martin Pala - Upgraded to monit-5.25.3 * Tue May 29 2018 Martin Pala - Upgraded to monit-5.25.2 * Fri Nov 17 2017 Martin Pala - Upgraded to monit-5.25.1 * Mon Sep 25 2017 Martin Pala - Upgraded to monit-5.25.0 * Thu Jun 08 2017 Martin Pala - Upgraded to monit-5.24.0 * Wed Apr 19 2017 Martin Pala - Upgraded to monit-5.23.0 * Tue Mar 07 2017 Martin Pala - Upgraded to monit-5.22.0 * Sat Oct 22 2016 Martin Pala - Upgraded to monit-5.21.0 * Tue Sep 06 2016 Martin Pala - Upgraded to monit-5.20.0 * Wed Jul 27 2016 Martin Pala - Upgraded to monit-5.19.0 * Fri Apr 01 2016 Martin Pala - Upgraded to monit-5.18 * Fri Mar 04 2016 Martin Pala - Upgraded to monit-5.17.1 * Thu Feb 04 2016 Martin Pala - Upgraded to monit-5.17 * Thu Nov 05 2015 Martin Pala - Upgraded to monit-5.16 * Mon Oct 12 2015 Martin Pala - Upgraded to monit-5.15 - Added rpmbuild options for building without PAM (--without pam) - Added rpmbuild options for building without SSL (--without ssl) - Dropped build dependency on flex and bison * Mon Jun 08 2015 Martin Pala - Upgraded to monit-5.14 * Mon Mar 23 2015 Martin Pala - Upgraded to monit-5.13 * Tue Mar 10 2015 Martin Pala - Upgraded to monit-5.12.2 * Fri Mar 6 2015 Martin Pala - Upgraded to monit-5.12.1 * Tue Feb 24 2015 Martin Pala - Upgraded to monit-5.12 * Wed Dec 17 2014 Martin Pala - Upgraded to monit-5.11 * Mon Oct 06 2014 Martin Pala - Upgraded to monit-5.10 * Sat Aug 23 2014 Martin Pala - Upgraded to monit-5.9 * Fri Aug 22 2014 Martin Pala - Upgraded to monit-5.8.2 * Sun Mar 30 2014 Martin Pala - Upgraded to monit-5.8.1 * Sat Mar 08 2014 Martin Pala - Upgraded to monit-5.8 * Thu Feb 20 2014 Martin Pala - Upgraded to monit-5.7 * Thu Jun 06 2013 Martin Pala - Upgraded to monit-5.6 * Tue Jun 04 2013 Martin Pala - Upgraded to monit-5.5.1 * Wed May 09 2012 Martin Pala - Upgraded to monit-5.5 * Sun May 06 2012 Martin Pala - Upgraded to monit-5.4 * Sat Oct 22 2011 Martin Pala - Upgraded to monit-5.3.1 * Thu Aug 25 2011 Martin Pala - Upgraded to monit-5.3 * Mon Mar 28 2011 Martin Pala - Upgraded to monit-5.2.5 * Wed Feb 23 2011 Martin Pala - Upgraded to monit-5.2.4 * Thu Sep 16 2010 Martin Pala - Upgraded to monit-5.2 * Thu Feb 18 2010 Martin Pala - Upgraded to monit-5.1.1 * Sat Jan 09 2010 Martin Pala - Upgraded to monit-5.1 * Thu May 28 2009 Martin Pala - Upgraded to monit-5.0.3 * Thu May 7 2009 Martin Pala - Upgraded to monit-5.0.2 * Wed Apr 22 2009 Martin Pala - Upgraded to monit-5.0.1 * Sun Apr 13 2008 Martin Pala - Upgraded to monit-5.0 * Tue Nov 06 2007 Martin Pala - Upgraded to monit-4.10.1 * Mon Nov 05 2007 Martin Pala - Upgraded to monit-4.10 * Mon Feb 19 2007 Martin Pala - Upgraded to monit-4.9 * Sun Mar 05 2006 Martin Pala - Upgraded to monit-4.7 * Mon Sep 19 2005 Martin Pala - Upgraded to monit-4.6 * Tue Oct 19 2004 Martin Pala - Upgraded to monit-4.4 * Tue Nov 04 2003 Martin Pala - Fixed the bad path to monit binary in startup script. Thanks to Ben Ciceron for report of the problem. * Mon Oct 27 2003 Martin Pala - Upgraded to monit-4.1 * Tue Sep 23 2003 Martin Pala - change the description * Fri Mar 07 2003 Martin Pala - Upgraded to monit-4.0 - Updated documentation list - Changed use of monit.conf file to default monitrc ( => monit could find it ) - Use monitrc and rc.monit from default monit distribution * Wed Jul 10 2002 Rory Toma - Upgraded to monit-2.4.3 * Mon Feb 05 2001 Clinton Work - Upgraded to monit 1.2 - Use chkconfig to add monit to the rc.d startup scripts - Use the example monitrc instead of my custom monit.conf - Fixed the monit homepage URL * Thu Feb 01 2001 Clinton Work - Create the initial spec file - Created a sample config file and a rc startup script monit-5.35.2/system/packages/freebsd/0000755000016400001720000000000015007061157014446 500000000000000monit-5.35.2/system/packages/freebsd/Makefile0000644000016400001720000000440415007061157016030 00000000000000# New ports collection makefile for: monit # Date created: 11 January 2006 # Whom: Martin Pala # # $FreeBSD$ # PORTNAME= monit PORTVERSION= 4.9 CATEGORIES= sysutils MASTER_SITES= https://mmonit.com/monit/dist/ MAINTAINER= martinp@tildeslash.com COMMENT= Unix system management and monitoring MAN1= monit.1 GNU_CONFIGURE= yes USE_GMAKE= yes USE_BISON= yes USE_RC_SUBR= yes CONFIGURE_ENV= CC="${CC}" CPPFLAGS="${CPPFLAGS}" \ CFLAGS="${CFLAGS}" \ LDFLAGS="${LDFLAGS}" CONFIG_SHELL="${SH}" \ LOCALBASE="${LOCALBASE}" OPTIONS= SSL "Enable SSL support" on PLIST_FILES= bin/monit \ etc/monitrc.sample \ etc/rc.d/monit.sh \ share/doc/monit/CHANGES.txt \ share/doc/monit/LICENSE \ share/doc/monit/README \ share/doc/monit/README.SSL \ share/doc/monit/STATUS \ share/doc/monit/examples.html \ share/doc/monit/monit.html PLIST_DIRS= share/doc/monit .include pre-install: @${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \ -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \ ${FILESDIR}/monit.sh > ${WRKDIR}/monit.sh post-install: @${INSTALL_SCRIPT} -m 755 ${WRKDIR}/monit.sh ${PREFIX}/etc/rc.d/monit.sh @${INSTALL_SCRIPT} -m 600 ${WRKDIR}/${DISTNAME}/monitrc ${PREFIX}/etc/monitrc.sample ${MKDIR} ${DOCSDIR} @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/CHANGES.txt ${PREFIX}/share/doc/monit/CHANGES.txt @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/LICENSE ${PREFIX}/share/doc/monit/LICENSE @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/README ${PREFIX}/share/doc/monit/README @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/README.SSL ${PREFIX}/share/doc/monit/README.SSL @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/STATUS ${PREFIX}/share/doc/monit/STATUS @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/doc/examples.html ${PREFIX}/share/doc/monit/examples.html @${INSTALL_SCRIPT} -m 644 ${WRKDIR}/${DISTNAME}/doc/monit.html ${PREFIX}/share/doc/monit/monit.html @${CAT} ${PKGMESSAGE} @${ECHO_MSG} " ${PREFIX}/etc/monitrc.sample" @${ECHO_MSG} " ${PREFIX}/share/doc/monit/examples.html" .if defined(WITH_SSL) .include "${PORTSDIR}/Mk/bsd.openssl.mk" CONFIGURE_ARGS+= --enable-ssl \ --with-openssl="${OPENSSLBASE}" .else CONFIGURE_ARGS+= --without-ssl .endif .include monit-5.35.2/system/packages/freebsd/distinfo0000644000016400001720000000027015007061157016127 00000000000000MD5 (monit-4.9.tar.gz) = bcbaab776a54d1e34e3a057c925de9ca SHA256 (monit-4.9.tar.gz) = 6963046fa976b682d27ac8e78cf7107d76c6907aef27b30f725f371ce64fb4bf SIZE (monit-4.9.tar.gz) = 573711 monit-5.35.2/system/packages/freebsd/pkg-message0000644000016400001720000000040515007061157016513 00000000000000===> USAGE: To enable monit you need to add monit_enable="YES" to rc.conf file. Before running monit you have to configure monitrc file. There is example configuration file monitrc.sample, you can find many samples for particular services in examples.html: monit-5.35.2/system/packages/freebsd/README.porter0000644000016400001720000000247315007061157016566 00000000000000############################### # To update the FreeBSD port: # ############################### 1.) Prerequisites: md5 sha256 (sysutils/freebsd-sha256) 2.) Modify the port: git clone https://git.FreeBSD.org/ports.git cd ports/sysutils/monit git checkout -b monit-5-34-2 vi Makefile - change DISTVERSION in to the current monit version - if PORTVERSION is set, drop it make makesum make stage (test) make stage-qa (test) make package (test) make install (test) make deinstall (test) make check-plist (test) portlint (test) git commit -a git format-patch main (will create 0001-monit-5.34.2.patch, which can be submitted via https://bugs.freebsd.org/bugzilla/) 3.) Send the port upgrade (for example using https://bugs.freebsd.org/bugzilla/) component: Individual Port(s) summary: sysutils/monit: Update to severity: Affects Some People Version: Latest HW: Any OS: Any Put the link to the changelog to the URL field like this: https://mmonit.com/monit/changes/#5.34.2 Attach the following file: 0001-monit-5.34.2.patch (set maintainer-approval+ if you're maintainer) Add "build is ok" to the description along with the port upgrade text. monit-5.35.2/system/packages/freebsd/pkg-descr0000644000016400001720000000226115007061157016171 00000000000000Monit is a utility for managing and monitoring processes, files, directories, filesystems and network services on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. monit supports: * Daemon mode - poll services at a specified interval * Group and manage groups of services, service dependencies * Logging - syslog or own logfile * Alert, start, stop and restart of services based on it's characteristics * MD5 and SHA1 checksums * Runtime Unix socket and TCP/IP port checking (tcp and udp) * Process status, timeout, memory and cpu usage, etc. * Filesystem usage monitoring (inodes and space) * File monitoring (timestamp, checksum, permission, owner, etc.) * Directory monitoring (timestamp, permission, owner, etc.) * Remote network services monitoring (ping, response time, protocol, etc.) * System load average monitoring * Flexible and customizable email alert messages and notifications * Protocol verification such as HTTP, FTP, SMTP, POP, IMAP, NNTP, NTP, etc. * A HTTP interface with XML output option and many more features :) WWW: https://mmonit.com/monit/ monit-5.35.2/system/packages/freebsd/files/0000755000016400001720000000000015007061157015550 500000000000000monit-5.35.2/system/packages/freebsd/files/monit.sh0000644000016400001720000000144115007061157017152 00000000000000#!/bin/sh # # $FreeBSD$ # # PROVIDE: monit # REQUIRE: NETWORKING SERVERS # BEFORE: DAEMON # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable monit: # monit_enable (bool): Set to "NO" by default. # Set it to "YES" to enable monit # . %%RC_SUBR%% name="monit" rcvar=`set_rcvar` restart_precmd="monit_checkconfig" reload_precmd="monit_checkconfig" default_config=%%PREFIX%%/etc/monitrc required_files=${default_config} command="%%PREFIX%%/bin/monit" command_args="-c ${default_config}" pidfile="/var/run/monit.pid" [ -z "$monit_enable" ] && monit_enable="NO" load_rc_config $name monit_checkconfig() { echo "Performing sanity check on monit configuration:" ${command} ${command_args} -t } extra_commands="reload" run_rc_command "$1" monit-5.35.2/system/startup/0000755000016400001720000000000015007061172012755 500000000000000monit-5.35.2/system/startup/rc.monit0000644000016400001720000000237015007061157014356 00000000000000#! /bin/sh # # monit Monitor Unix systems # # Author: Clinton Work, # # chkconfig: 2345 98 02 # description: Monit is a utility for managing and monitoring processes, # files, directories and filesystems on a Unix system. # processname: monit # pidfile: /var/run/monit.pid # config: /etc/monitrc # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network MONIT=/usr/bin/monit # Source monit configuration. if [ -f /etc/sysconfig/monit ] ; then . /etc/sysconfig/monit fi [ -f $MONIT ] || exit 0 RETVAL=0 # See how we were called. case "$1" in start) echo -n "Starting monit: " daemon $NICELEVEL $MONIT RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/monit ;; stop) echo -n "Stopping monit: " killproc monit RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/monit ;; restart) $0 stop $0 start RETVAL=$? ;; condrestart) [ -e /var/lock/subsys/monit ] && $0 restart ;; status) status monit RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL monit-5.35.2/system/startup/monit.service0000644000016400001720000000151115007061172015403 00000000000000# This file is systemd template for monit service. To # register monit with systemd, place the monit.service file # to the /lib/systemd/system/ directory and then start it # using systemctl (see bellow). # # Enable monit to start on boot: # systemctl enable monit.service # # Start monit immediately: # systemctl start monit.service # # Stop monit: # systemctl stop monit.service # # Status: # systemctl status monit.service [Unit] Description=Pro-active monitoring utility for unix systems After=network-online.target Documentation=man:monit(1) https://mmonit.com/wiki/Monit/HowTo [Service] Type=simple KillMode=process ExecStart=/usr/local/bin/monit -I ExecStop=/usr/local/bin/monit quit ExecReload=/usr/local/bin/monit reload Restart=on-abnormal StandardOutput=null [Install] WantedBy=multi-user.target monit-5.35.2/system/startup/monit.service.in0000644000016400001720000000150315007061157016014 00000000000000# This file is systemd template for monit service. To # register monit with systemd, place the monit.service file # to the /lib/systemd/system/ directory and then start it # using systemctl (see bellow). # # Enable monit to start on boot: # systemctl enable monit.service # # Start monit immediately: # systemctl start monit.service # # Stop monit: # systemctl stop monit.service # # Status: # systemctl status monit.service [Unit] Description=Pro-active monitoring utility for unix systems After=network-online.target Documentation=man:monit(1) https://mmonit.com/wiki/Monit/HowTo [Service] Type=simple KillMode=process ExecStart=@prefix@/bin/monit -I ExecStop=@prefix@/bin/monit quit ExecReload=@prefix@/bin/monit reload Restart=on-abnormal StandardOutput=null [Install] WantedBy=multi-user.target monit-5.35.2/system/startup/monit.upstart0000644000016400001720000000074515007061172015455 00000000000000# This is an upstart script to keep monit running. # Put this script here: # # /etc/init/monit.conf # # and reload upstart configuration: # # initctl reload-configuration # # You can then manually start and stop monit like this: # # start monit # stop monit # description "Monit service manager" limit core unlimited unlimited start on runlevel [2345] stop on starting rc RUNLEVEL=[016] expect daemon respawn exec /usr/local/bin/monit pre-stop exec /usr/local/bin/monit quit monit-5.35.2/system/startup/monit.upstart.in0000644000016400001720000000074115007061157016061 00000000000000# This is an upstart script to keep monit running. # Put this script here: # # /etc/init/monit.conf # # and reload upstart configuration: # # initctl reload-configuration # # You can then manually start and stop monit like this: # # start monit # stop monit # description "Monit service manager" limit core unlimited unlimited start on runlevel [2345] stop on starting rc RUNLEVEL=[016] expect daemon respawn exec @prefix@/bin/monit pre-stop exec @prefix@/bin/monit quit monit-5.35.2/system/bash/0000755000016400001720000000000015007061157012173 500000000000000monit-5.35.2/system/bash/monit0000644000016400001720000000524615007061157013173 00000000000000# install this file to /etc/bash_completion.d/ directory # get the path to the configuration file if specified on the command-line _monit_config() { local haveconfig opt for opt in "${COMP_WORDS[@]}" do if [[ $haveconfig == 1 ]] then local _configuration=`eval echo ${opt//>}` if [ -f "${_configuration}" ] then configuration="-c ${_configuration}" fi return elif [[ $opt == "-c" ]] then haveconfig=1 fi done } # check if we need to use sudo _monit_sudo() { if [[ $($monit $configuration -t 2>&1 | grep "Permission denied") ]] then sudo="sudo" fi } # get monit service list _monit_services() { _monit_config _monit_sudo services=$($sudo $monit $configuration -vIt | grep "Name" | sed -e "s/.* = //") } # get monit servicegroup list _monit_servicegroups() { _monit_config _monit_sudo servicegroups=$($sudo $monit $configuration -vIt | grep "Group" | sed -e "s/.* = //" | sed -e "s/, /\n/g") } _monit() { local cur prev local options="--batch --conf --daemon --group --hash --help --id --interactive --logfile --pidfile --resetid --statefile --test --verbose --version" local commands="start stop restart monitor unmonitor reload status summary report quit validate procmatch" local report="up down initialising unmonitored total" monit=${COMP_WORDS[0]} COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case "${prev}" in -c|--conf|-l|--logfile|-p|--pidfile|-s|--statefile|-H|--hash) _filedir return 0 ;; -g|--group) _monit_servicegroups COMPREPLY=( $(compgen -W "${servicegroups}" -- ${cur}) ) return 0 ;; start|stop|restart|monitor|unmonitor) _monit_services services+=" all" COMPREPLY=( $(compgen -W "${services}" -- ${cur}) ) return 0 ;; status|summary) _monit_services COMPREPLY=( $(compgen -W "${services}" -- ${cur}) ) return 0 ;; report) COMPREPLY=( $(compgen -W "${report}" -- ${cur}) ) return 0 ;; procmatch) _pnames return 0 ;; *) ;; esac case "${cur}" in -*) COMPREPLY=( $(compgen -W "${options}" -- ${cur}) ) return 0 ;; *) COMPREPLY=($(compgen -W "${commands}" -- ${cur})) ;; esac return 0 } complete -F _monit monit monit-5.35.2/Makefile.am0000644000016400001720000001067615007061157011720 00000000000000# Copyright (C) Tildeslash Ltd. All rights reserved. AUTOMAKE_OPTIONS = foreign no-dependencies subdir-objects ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = COPYING CONTRIBUTORS bootstrap doc src config monitrc system libmonit monit.1 SUBDIRS = libmonit CC = @CC@ FLEX = @FLEX@ FLEXFLAGS = -i YACC = @YACC@ YACCFLAGS = -dvt POD2MAN = @POD2MAN@ POD2MANFLAGS = @POD2MANFLAGS@ AM_CPPFLAGS = $(CPPFLAGS) $(EXTCPPFLAGS) -D@ARCH@ -DSYSCONFDIR="\"@sysconfdir@\"" -I./src -I./src/device -I./src/http -I./src/notification -I./src/process -I./src/protocols -I./src/ssl -I./src/terminal -I./libmonit/src AM_LDFLAGS = $(LDFLAGS) $(EXTLDFLAGS) -L./lib/ bin_PROGRAMS = monit monit_SOURCES = src/y.tab.c \ src/lex.yy.c \ src/monit.c \ src/alert.c \ src/control.c \ src/daemonize.c \ src/env.c \ src/event.c \ src/file.c \ src/gc.c \ src/http.c \ src/log.c \ src/md5.c \ src/md5_crypt.c \ src/net/net.c \ src/net/socket.c \ src/net/Link.c \ src/sha1.c \ src/checksum.c \ src/signal.c \ src/spawn.c \ src/state.c \ src/util.c \ src/validate.c \ src/device/device_common.c \ src/device/sysdep_@ARCH@.c \ src/http/base64.c \ src/http/cervlet.c \ src/http/client.c \ src/http/engine.c \ src/http/xml.c \ src/http/processor.c \ src/notification/Address.c \ src/notification/MMonit.c \ src/notification/SMTP.c \ src/process/SystemInfo.c \ src/process/ProcessTree.c \ src/process/sysdep_@ARCH@.c \ src/protocols/apache_status.c \ src/protocols/clamav.c \ src/protocols/default.c \ src/protocols/dns.c \ src/protocols/dwp.c \ src/protocols/fail2ban.c \ src/protocols/ftp.c \ src/protocols/generic.c \ src/protocols/gps.c \ src/protocols/http.c \ src/protocols/imap.c \ src/protocols/ldap2.c \ src/protocols/ldap3.c \ src/protocols/lmtp.c \ src/protocols/memcache.c \ src/protocols/mongodb.c \ src/protocols/mqtt.c \ src/protocols/mysql.c \ src/protocols/nntp.c \ src/protocols/ntp3.c \ src/protocols/pgsql.c \ src/protocols/pop.c \ src/protocols/postfix_policy.c \ src/protocols/protocol.c \ src/protocols/radius.c \ src/protocols/rdate.c \ src/protocols/redis.c \ src/protocols/rsync.c \ src/protocols/sieve.c \ src/protocols/sip.c \ src/protocols/smtp.c \ src/protocols/spamassassin.c \ src/protocols/ssh.c \ src/protocols/tns.c \ src/protocols/websocket.c \ src/ssl/Ssl.c \ src/terminal/TextBox.c \ src/terminal/TextColor.c \ src/statistics/Statistics.c monit_LDADD = libmonit/libmonit.la monit_LDFLAGS = -static $(EXTLDFLAGS) man_MANS = monit.1 BUILT_SOURCES = src/lex.yy.c src/y.tab.c src/y.tab.h CLEANFILES = src/y.output DISTCLEANFILES = *~ $(BUILT_SOURCES) define check-exit || exit 1 endef # ------- # Targets # ------- dist-hook:: -rm -rf `find $(distdir) -name "._*"` -rm -rf `find $(distdir) -name ".DS_Store"` -rm -rf `find $(distdir) -name ".libs"` -rm -rf `find $(distdir) -name ".git"` -rm -rf `find $(distdir) -name ".dirstamp"` -rm -rf $(distdir)/libmonit/libmonit.xcodeproj -rm -rf $(distdir)/libmonit/config.log -rm -rf $(distdir)/libmonit/config.status -rm -rf $(distdir)/libmonit/autom4te.cache -rm -f $(distdir)/src/config.h -rm -f $(distdir)/src/stamp-* -rm -f $(distdir)/src/y.output -rm -f $(distdir)/README.md -rm -f $(distdir)/libmonit/README* -mv $(distdir)/doc/CHANGES $(distdir)/ -perl -pi -e 's/^Version: .*/Version: '$(VERSION)'/' $(distdir)/system/packages/redhat/monit.spec -chmod 600 monitrc clean-local: -rm -f `find . -name "*.o" -o -name "*.lo" -o -name "*.loT" -o -name "*~"` distclean-local: -rm -rf autom4te.cache/ -rm -f monit-[0-9].*tar.gz cleanall: clean distclean -git clean -fxd monit.1: doc/monit.pod $(POD2MAN) $(POD2MANFLAGS) $< > $@ -rm -f pod2* # ------------- # Grammar rules # ------------- src/y.tab.c src/y.tab.h: run-yacc .INTERMEDIATE: run-yacc run-yacc: src/p.y $(YACC) $(YACCFLAGS) -o src/y.tab.c $< src/lex.yy.c: src/l.l $(FLEX) $(FLEXFLAGS) -o$@ $< # -------------- # MacOS codesign # -------------- if WITH_CODESIGN monit_LDFLAGS += -sectcreate __TEXT __info_plist config/Info.plist all-local: $(bin_PROGRAMS) $(foreach file, $(bin_PROGRAMS), \ codesign -s $(CODESIGN_IDENTITY) -v --deep --timestamp --options runtime $(file) \ $(check-exit)) endif monit-5.35.2/CHANGES0000644000016400001720000000004615007061157010645 00000000000000See https://mmonit.com/monit/changes/ monit-5.35.2/configure.ac0000644000016400001720000010643215007061157012146 00000000000000# Process this file with bootstrap to produce a configure script. # autoconf requirement AC_PREREQ([2.53]) # Note: in case of beta subversion, use underscore "_" rather then dash "-" # since RPM doesn't allow dash in Version # Example: 5.0_beta2 AC_INIT([monit], [5.35.2], [monit-general@nongnu.org]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/monit.c]) AC_CONFIG_SUBDIRS([libmonit]) AC_CONFIG_COMMANDS([libtool_patch],[test `uname` = "OpenBSD" && perl -p -i -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool]) AC_CONFIG_COMMANDS([monitrc], [chmod 600 monitrc]) # ------------------------------------------------------------------------ # Programs # ------------------------------------------------------------------------ AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [no], [$PATH:/usr/local/bin:/usr/bin]) if test "x$YACC" = "xno"; then # Require bison unless y.tab.c already is built if test ! -f src/y.tab.c; then AC_MSG_ERROR([Monit require bison, byacc or yacc. Download bison from http://www.gnu.org/software/bison/]) fi fi AC_PATH_PROG([FLEX], [flex], [no], [$PATH:/usr/local/bin:/usr/bin]) if test "x$FLEX" = "xno"; then # Require flex unless lex.yy.c already is built if test ! -f src/lex.yy.c; then AC_MSG_ERROR([flex is required. Download from http://www.gnu.org/software/flex/]) fi fi AC_PATH_PROG([POD2MAN], [pod2man], [no], [$PATH:/usr/local/bin:/usr/bin]) if test "x$POD2MAN" = "xno"; then # Require pod2man unless monit.1 already is built if test ! -f monit.1; then AC_MSG_ERROR([pod2man is required to build the monit.1 man file.]) fi else POD2MANFLAGS="--center 'User Commands' --release AC_PACKAGE_VERSION --date='www.mmonit.com' --lax" AC_SUBST([POD2MANFLAGS]) fi AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"]) if test `uname` != "AIX"; then AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protector-all"]) fi # ------------------------------------------------------------------------ # Libtool # ------------------------------------------------------------------------ AC_DISABLE_STATIC LT_INIT # ------------------------------------------------------------------------ # Libraries # ------------------------------------------------------------------------ # Check for libraries AC_CHECK_LIB([socket], [socket]) AC_CHECK_LIB([inet], [socket]) AC_CHECK_LIB([nsl], [inet_addr]) AC_CHECK_LIB([resolv], [inet_aton]) AC_CHECK_LIB([c], [crypt], [:], [AC_CHECK_LIB([crypt], [crypt])]) AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([POSIX thread library is required])]) # ------------------------------------------------------------------------ # Header files # ------------------------------------------------------------------------ AC_HEADER_SYS_WAIT AC_HEADER_STAT AC_CHECK_HEADERS([ \ alloca.h \ arpa/inet.h \ asm/page.h \ asm/param.h \ cf.h \ crt_externs.h \ ctype.h \ crypt.h \ CoreFoundation/CoreFoundation.h \ devstat.h \ dirent.h \ DiskArbitration/DiskArbitration.h \ errno.h \ execinfo.h \ fcntl.h \ getopt.h \ glob.h \ grp.h \ ifaddrs.h \ IOKit/storage/IOBlockStorageDriver.h \ kinfo.h \ kvm.h \ paths.h \ kstat.h \ libzfs.h \ zone.h \ sys/protosw.h \ libproc.h \ limits.h \ loadavg.h \ locale.h \ lvm.h \ mach/host_info.h \ mach/mach.h \ mach/mach_host.h \ memory.h \ mntent.h \ netdb.h \ sys/socket.h \ netinet/in.h \ netinet/tcp.h \ netinet/in_systm.h \ pam/pam_appl.h \ security/pam_appl.h \ poll.h \ procfs.h \ sys/procfs.h \ procinfo.h \ pthread.h \ pwd.h \ regex.h \ sigsetjmp.h \ signal.h \ stdarg.h \ stddef.h \ stdio.h \ string.h \ strings.h \ stropts.h \ sys/cfgodm.h \ sys/cfgdb.h \ sys/dk.h \ sys/dkstat.h \ sys/disk.h \ sys/filio.h \ sys/fs/zfs.h \ sys/instance.h \ sys/ioctl.h \ sys/iostat.h \ sys/loadavg.h \ sys/lock.h \ sys/mntent.h \ sys/mnttab.h \ sys/mutex.h \ sys/nlist.h \ sys/nvpair.h \ sys/param.h \ sys/pstat.h \ sys/queue.h \ sys/resource.h \ sys/sched.h \ sys/statfs.h \ sys/statvfs.h \ sys/sysinfo.h \ sys/sysmacros.h \ sys/systemcfg.h \ sys/time.h \ sys/tree.h \ sys/types.h \ sys/un.h \ sys/utsname.h \ sys/var.h \ sys/vmmeter.h \ sys/vm_usage.h \ sys/vfs.h \ syslog.h \ unistd.h \ utmpx.h \ uvm/uvm_extern.h \ uvm/uvm_param.h \ vm/vm.h \ net/if_media.h \ net/if_dl.h \ net/route.h ]) AC_CHECK_HEADERS([ \ libperfstat.h \ ], [], [], [ #ifdef HAVE_SYS_PROTOSW_H #include #endif ]) AC_CHECK_HEADERS([ \ netinet/ip.h \ ], [], [], [ #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif ]) AC_CHECK_HEADERS([ \ net/if.h \ netinet/ip_icmp.h \ ], [], [], [ #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IP_H #include #endif ]) AC_CHECK_HEADERS([ \ netinet/icmp6.h \ ], [], [], [ #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IP_H #include #endif ]) AC_CHECK_HEADERS([ \ sys/sysctl.h \ sys/mount.h \ sys/proc.h \ sys/swap.h \ sys/ucred.h \ sys/user.h \ ], [], [], [ #ifdef HAVE_SYS_PARAM_H #include #endif ]) AC_CHECK_HEADERS([ \ machine/vmparam.h \ vm/pmap.h \ machine/pmap.h \ vm/vm_map.h \ vm/vm_object.h \ ], [], [], [ #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_QUEUE_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_VM_PMAP_H #include #endif ]) AC_CHECK_HEADERS([ \ sys/resourcevar.h \ ], [], [], [ #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_RESOURCE_H #include #endif ]) AC_CHECK_HEADERS([ \ uvm/uvm_map.h \ uvm/uvm_pmap.h \ uvm/uvm_object.h \ ], [], [], [ #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_TREE_H #include #endif #ifdef HAVE_UVM_UVM_EXTERN_H #include #endif ]) AC_CHECK_HEADERS([ \ uvm/uvm.h \ ], [], [], [ #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif ]) # ------------------------------------------------------------------------ # Types # ------------------------------------------------------------------------ AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_PID_T # Check for structures. AC_STRUCT_TM AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_FORK AC_FUNC_STAT AC_FUNC_STRFTIME AC_CHECK_FUNCS(statfs) AC_CHECK_FUNCS(statvfs) AC_CHECK_FUNCS(setlocale) AC_CHECK_FUNCS(getaddrinfo) AC_CHECK_FUNCS(syslog) AC_CHECK_FUNCS(vsyslog) AC_CHECK_FUNCS(backtrace) AC_CHECK_FUNCS(getloadavg) AC_CHECK_FUNCS(getopt_long) # ------------------------------------------------------------------------ # Compiler # ------------------------------------------------------------------------ AC_PROG_CC AC_PROG_CXX AC_C_CONST AC_C_BIGENDIAN # Define _GNU_SOURCE so we can have Posix headers etc included. We use the # -std=cXX compiler switch which only include a minimum of C headers CFLAGS="$CFLAGS -D_GNU_SOURCE" # Compiler; tune warnings CFLAGS="$CFLAGS -Wall -Wunused "; # Require at least C99 and use C11 if available AC_COMPUTE_INT([STDC_VERSION],[__STDC_VERSION__],,[STDC_VERSION=0]) AS_IF([test "$STDC_VERSION" -ge 201112],[CFLAGS="$CFLAGS -std=c11"],[CFLAGS="$CFLAGS -std=c99"]) AC_CHECK_HEADERS([stdint.h stdbool.h], [], [AC_MSG_ERROR([toolchain does not have C99 headers])]) # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ AC_ARG_WITH(ipv6, AS_HELP_STRING([--without-ipv6], [Disable the IPv6 support (default: check)]), [ if test "x$withval" = "xno" then with_ipv6=0 elif test "x$withval" = "xyes" then with_ipv6=1 AC_DEFINE([HAVE_IPV6], 1, [Define to 1 if the system supports IPv6]) fi ], [ # Note inverse test. Check by default AC_MSG_CHECKING(for IPv6 support) AC_CACHE_VAL(ac_cv_ipv6, AC_RUN_IFELSE([ AC_LANG_SOURCE([[ #include #include #include #include /* Make sure the definitions for AF_INET6 and struct sockaddr_in6 * are defined, and that we can actually create an IPv6 TCP socket.*/ int main(void) { int fd; struct sockaddr_in6 foo; fd = socket(AF_INET6, SOCK_STREAM, 0); exit(fd >= 0 ? 0 : 1); }]])], [ac_cv_ipv6=yes], [ac_cv_ipv6=no], [ac_cv_ipv6=no]) ) AC_MSG_RESULT($ac_cv_ipv6) if test $ac_cv_ipv6 = yes then with_ipv6=1 AC_DEFINE([HAVE_IPV6], 1, [Define to 1 if the system supports IPv6]) else with_ipv6=0 fi ] ) # ------------------------------------------------------------------------ # Paths # ------------------------------------------------------------------------ # Find the right directory to put the root-mode PID file in AC_MSG_CHECKING([pid file location]) AC_ARG_WITH([piddir], [AS_HELP_STRING([--with-piddir=DIR], [Define a pid directory (default: autodetection)])], [ piddir="$withval" ], [ if test -d "/run" then piddir="/run" elif test -d "/var/run"; then piddir="/var/run" elif test -d "/etc"; then piddir="/etc" fi ]) AC_DEFINE_UNQUOTED([PIDDIR], "$piddir", [Define to the pid storage directory.]) AC_MSG_RESULT([$piddir]) # Test mounted filesystem description file if test -f "/etc/mtab" then AC_DEFINE([HAVE_MTAB], 1, [Define to 1 if you have /etc/mtab]) elif test -f "/etc/mnttab"; then AC_DEFINE([HAVE_MNTTAB], 1, [Define to 1 if you have /etc/mnttab]) fi # ------------------------------------------------------------------------ # Architecture/OS detection # ------------------------------------------------------------------------ # Backward compatibility until we get ride of arch settings architecture=`uname` if test "$architecture" = "SunOS" then ARCH="SOLARIS" CFLAGS="$CFLAGS -D _REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64" LDFLAGS="$LDFLAGS -m64" AC_CHECK_LIB([zfs], [libzfs_init]) AC_CHECK_LIB([nvpair], [nvlist_free]) AC_CHECK_LIB([kstat], [kstat_open]) if test `uname -m` = "i86pc" then if test "x$GCC" = "xyes" then CFLAGS="$CFLAGS -mtune=opteron" LDFLAGS="$LDFLAGS -mtune=opteron" else CFLAGS="$CFLAGS -xarch=sse2" LDFLAGS="$LDFLAGS -xarch=sse2" fi else if test "x$GCC" = "xyes" then CFLAGS="$CFLAGS -mtune=v9" LDFLAGS="$LDFLAGS -mtune=v9" else CFLAGS="$CFLAGS -xarch=sparc" LDFLAGS="$LDFLAGS -xarch=sparc" fi fi elif test "$architecture" = "Linux" then ARCH="LINUX" CFLAGS="$CFLAGS -D _REENTRANT" LDFLAGS="$LDFLAGS -rdynamic" elif test "$architecture" = "OpenBSD" then ARCH="OPENBSD" CFLAGS="$CFLAGS -D _REENTRANT" AC_CHECK_LIB([kvm], [kvm_open]) with_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM) AC_CHECK_LIB([execinfo], [backtrace], [ AC_DEFINE([HAVE_BACKTRACE], [1], [Define if backtrace is available]) LIBS="-lexecinfo $LIBS" ], [ AC_MSG_WARN([backtrace function not found in libexecinfo]) ] ) elif test "$architecture" = "FreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" AC_CHECK_LIB([devstat], [devstat_getnumdevs]) AC_CHECK_LIB([kvm], [kvm_open]) AC_CHECK_LIB([execinfo], [backtrace], [ AC_DEFINE([HAVE_BACKTRACE], [1], [Define if backtrace is available]) LIBS="-lexecinfo $LIBS" ], [ AC_MSG_WARN([backtrace function not found in libexecinfo]) ] ) elif test "$architecture" = "GNU/kFreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" AC_CHECK_LIB([devstat], [devstat_getnumdevs]) AC_CHECK_LIB([kvm], [kvm_open]) elif test "$architecture" = "NetBSD" then ARCH="NETBSD" CFLAGS="$CFLAGS -D _REENTRANT -Wno-char-subscripts" AC_CHECK_LIB([kvm], [kvm_open]) AC_CHECK_LIB([execinfo], [backtrace], [ AC_DEFINE([HAVE_BACKTRACE], [1], [Define if backtrace is available]) LIBS="-lexecinfo $LIBS" ], [ AC_MSG_WARN([backtrace function not found in libexecinfo]) ] ) elif test "$architecture" = "DragonFly" then ARCH="DRAGONFLY" CFLAGS="$CFLAGS -D _REENTRANT" AC_CHECK_LIB([kvm], [kvm_open]) AC_CHECK_LIB([devstat], [getnumdevs]) elif test "$architecture" = "Darwin" then ARCH="DARWIN" CFLAGS="$CFLAGS -DREENTRANT -no-cpp-precomp -DNEED_SOCKLEN_T_DEFINED" LDFLAGS="$LDFLAGS -Wl,-search_paths_first" AC_CHECK_LIB([kvm], [kvm_open]) LIBS="$LIBS -framework System -framework CoreFoundation -framework DiskArbitration -framework IOKit" elif test "$architecture" = "AIX" then ARCH="AIX" CFLAGS=`echo $CFLAGS|sed 's/-g//g'` CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" LIBS="$LIBS -lodm -lperfstat -lm" else AC_MSG_WARN([Architecture not supported: ${architecture}]) CFLAGS="$CFLAGS -D _REENTRANT" ARCH="UNKNOWN" fi AC_SUBST(ARCH) # ------------------------------------------------------------------------ # Large files code # ------------------------------------------------------------------------ # Check if we want to have large files support AC_MSG_CHECKING([for large files support]) AC_ARG_WITH(largefiles, [ --without-largefiles disable large files support (default: enabled)], [ dnl Check the withvalue if test "x$withval" = "xno" ; then with_largefiles=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then with_largefiles=1 AC_MSG_RESULT([enabled]) fi ], [ if test `uname` = "AIX" then with_largefiles=0 AC_MSG_RESULT([disabled]) else with_largefiles=1 AC_MSG_RESULT([enabled]) fi ] ) # Settings for largefiles support if test $with_largefiles -eq 1; then AC_SYS_LARGEFILE AC_DEFINE([HAVE_LARGEFILES], 1, [Define to 1 if you have large files support]) fi # ------------------------------------------------------------------------ # zlib Code # ------------------------------------------------------------------------ AC_ARG_WITH([zlib], AS_HELP_STRING([--with-zlib(=)], [Link Monit with zlib. An optional path argument may be given to specify the top-level directory to search for zlib to link with]), [ if test "x$withval" = "xyes"; then AC_CHECK_LIB([z], [zlibVersion], [], [AC_MSG_ERROR([libz not found])]) with_zlib=1 AC_CHECK_HEADERS([zlib.h]) elif test "x$withval" != "xno"; then AC_MSG_CHECKING([for zlib in $withval]) LDFLAGS="-L$withval/lib -lz $LDFLAGS " CFLAGS="-I$withval/include $CFLAGS" if test -r "$withval/lib/libz.a" -a -r "$withval/include/zlib.h"; then with_zlib=1 AC_DEFINE([HAVE_LIBZ], [1], [Define if you have zlib library]) AC_DEFINE([HAVE_ZLIB_H], [1], [Define if you have zlib header]) AC_MSG_RESULT([ok]) else with_zlib=0 AC_MSG_ERROR([zlib not found in $withval]) fi else with_zlib=0 fi ],[ AC_CHECK_LIB([z], [zlibVersion], [], [AC_MSG_ERROR([libz not found])]) with_zlib=1 AC_CHECK_HEADERS([zlib.h]) ] ) # ------------------------------------------------------------------------ # PAM Code # ------------------------------------------------------------------------ AC_MSG_CHECKING([for PAM support]) AC_ARG_WITH(pam, [ --without-pam disable the use of pam (default: enabled)], [ dnl Check the withvalue if test "x$withval" = "xno" || test "x$with_pam" = "x0"; then with_pam=0 AC_MSG_RESULT([disabled]) else with_pam=1 AC_MSG_RESULT([enabled]) fi ], [ # Note inverse test. On by default with_pam=1 AC_MSG_RESULT([enabled]) ] ) if test $with_pam -eq 1; then AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([PAM enabled but headers or library not found, install the PAM development support or run configure --without-pam])]) fi # ------------------------------------------------------------------------ # AddressSanitizer # ------------------------------------------------------------------------ AC_MSG_CHECKING([for AddressSanitizer support]) AC_ARG_WITH(asan, [ --with-asan enable the use of AddressSanitizer (default: disabled)], [ dnl Check the withvalue if test "x$withval" = "xno" ; then with_asan=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then with_asan=1 AC_MSG_RESULT([enabled]) fi ], [ with_asan=0 AC_MSG_RESULT([disabled]) ] ) if test $with_asan -eq 1; then AX_CHECK_COMPILE_FLAG([-fsanitize=address], [CFLAGS="$CFLAGS -fsanitize=address"]) AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], [CFLAGS="$CFLAGS -fno-omit-frame-pointer"]) AX_CHECK_COMPILE_FLAG([-fsanitize=bool], [CFLAGS="$CFLAGS -fsanitize=bool"]) AX_CHECK_COMPILE_FLAG([-fsanitize=enum], [CFLAGS="$CFLAGS -fsanitize=enum"]) AX_CHECK_COMPILE_FLAG([-fsanitize=float-divide-by-zero], [CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero"]) AX_CHECK_COMPILE_FLAG([-fsanitize-address-use-after-scope], [CFLAGS="$CFLAGS -fsanitize-address-use-after-scope"]) AX_CHECK_COMPILE_FLAG([-fsanitize=signed-integer-overflow], [CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow"]) AX_CHECK_COMPILE_FLAG([-fsanitize=vla-bound], [CFLAGS="$CFLAGS -fsanitize=vla-bound"]) AX_CHECK_COMPILE_FLAG([-fsanitize=bounds-strict], [CFLAGS="$CFLAGS -fsanitize=bounds-strict"]) AX_CHECK_COMPILE_FLAG([-fsanitize=null], [CFLAGS="$CFLAGS -fsanitize=null "]) AX_CHECK_COMPILE_FLAG([-fsanitize=object-size], [CFLAGS="$CFLAGS -fsanitize=object-size"]) AX_CHECK_COMPILE_FLAG([-fsanitize=undefined], [CFLAGS="$CFLAGS -fsanitize=undefined"]) AC_DEFINE([HAVE_ASAN], 1, [Define to 1 if you have address sanitizer.]) fi # ------------------------------------------------------------------------ # SSL Code # ------------------------------------------------------------------------ # Check for ssl includes checksslincldir() { : if test -f "$1/openssl/ssl.h"; then sslincldir="$1" return 0 fi return 1 } # Check for ssl libraries checkssllibdirdynamic() { : CRYPTOLIB=`ls -1 $1/libcrypto.so* $1/libcrypto.dylib* 2>/dev/null | wc -l` SSLLIB=`ls -1 $1/libssl.so* $1/libssl.dylib* 2>/dev/null | wc -l` if test "(" $CRYPTOLIB -gt 0 -a $SSLLIB -gt 0 ")" then ssllibdir="$1" return 0 fi return 1 } checkssllibdirstatic() { : if test "(" -f "$1/libcrypto.a" ")" -a \ "(" -f "$1/libssl.a" ")" ; then ssllibdir="$1" return 0 fi return 1 } # Check if we want to have SSL AC_MSG_CHECKING([for static SSL support]) AC_ARG_WITH(ssl-static, [ --with-ssl-static=DIR location of SSL installation], [ dnl Check the specified location only for dir in "$withval" "$withval/include"; do checksslincldir "$dir" done for dir in "$withval" "$withval/lib"; do checkssllibdirstatic "$dir" && break done with_sslstatic=1 LDFLAGS="`echo $LDFLAGS | sed -e 's/-rdynamic/-ldl/g'`" AC_MSG_RESULT([enabled]) AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.]) AC_SUBST(sslincldir) AC_SUBST(ssllibdir) CFLAGS="$CFLAGS -I$sslincldir" LIBS="$LIBS $ssllibdir/libssl.a $ssllibdir/libcrypto.a" if test `uname` = "Linux" && test `uname -m` = "aarch64"; then LIBS="$LIBS -ldl" fi ], [ with_sslstatic=0 AC_MSG_RESULT([disabled]) ] ) if test $with_sslstatic -eq 0 then AC_MSG_CHECKING([for SSL support]) AC_ARG_WITH(ssl, [ --without-ssl disable the use of ssl (default: enabled)], [ dnl Check the withvalue if test "x$withval" = "xno" ; then with_ssl=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then with_ssl=1 AC_MSG_RESULT([enabled]) fi ], [ # Note inverse test. On by default with_ssl=1 AC_MSG_RESULT([enabled]) ] ) # Check for SSL directory if test $with_ssl -eq 1; then AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location of SSL installation], [ dnl Check the specified location only for dir in "$withval" "$withval/include"; do checksslincldir "$dir" done for dir in "$withval" "$withval/lib"; do checkssllibdirdynamic "$dir" && break done ] ) AC_MSG_CHECKING([for SSL include directory]) AC_ARG_WITH(ssl-incl-dir, [ --with-ssl-incl-dir=DIR location of installed SSL include files], [ dnl Check the specified location only checksslincldir "$withval" ], [ if test -z "$sslincldir"; then dnl Search default locations of SSL includes for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw /opt/freeware; do for dir in "$maindir/include"\ "$maindir/include/openssl"\ "$maindir/include/ssl"\ "$maindir/ssl/include"; do checksslincldir $dir && break 2 done done fi ] ) if test -z "$sslincldir"; then AC_MSG_RESULT([Not found]) echo echo "Couldn't find your SSL header files." echo "Use --with-ssl-incl-dir option to fix this problem or disable" echo "the SSL support with --without-ssl" echo exit 1 fi AC_MSG_RESULT([$sslincldir]) AC_MSG_CHECKING([for SSL library directory]) AC_ARG_WITH(ssl-lib-dir, [ --with-ssl-lib-dir=DIR location of installed SSL library files], [ dnl Check the specified location only checkssllibdirdynamic "$withval" ], [ if test -z "$ssllibdir"; then dnl Search default locations of SSL libraries for maindir in "" \ /usr \ /usr/local \ /usr/pkg \ /var \ /opt \ /usr/sfw \ /opt/csw \ /opt/freeware; do for dir in $maindir \ $maindir/openssl \ $maindir/ssl \ $maindir/lib \ $maindir/lib/openssl \ $maindir/lib/ssl \ $maindir/ssl/lib \ $maindir/lib/64 \ $maindir/lib/64/openssl \ $maindir/lib/64/ssl \ $maindir/ssl/lib/64 \ $maindir/lib64 \ $maindir/lib64/openssl \ $maindir/lib64/ssl \ $maindir/ssl/lib64 \ $maindir/lib/${host} \ $maindir/lib/${host_alias}; do checkssllibdirdynamic $dir && break 2 done done fi ] ) if test -z "$ssllibdir"; then AC_MSG_RESULT([Not found]) dnl Let the compiler find the library using default paths AC_CHECK_LIB([ssl], [SSL_new], [], [AC_MSG_ERROR([Could not find SSL library, please use --with-ssl-lib-dir option or disabled the SSL support using --without-ssl])]) AC_CHECK_LIB([crypto],[CRYPTO_new_ex_data], [], [AC_MSG_ERROR([Could not find SSL library, please use --with-ssl-lib-dir option or disabled the SSL support using --without-ssl])]) else AC_MSG_RESULT([$ssllibdir]) fi AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have openssl.]) AC_SUBST(sslincldir) AC_SUBST(ssllibdir) fi # Add SSL includes and libraries if test "$sslincldir" -a "$ssllibdir" then if test "x$ARCH" = "xDARWIN"; then # Darwin already knows about ssldirs LIBS="$LIBS -lssl -lcrypto" elif test -f "/usr/kerberos/include/krb5.h"; then # Redhat 9 compilation fix: CFLAGS="$CFLAGS -I$sslincldir -I/usr/kerberos/include" LIBS="$LIBS -L$ssllibdir -lssl -lcrypto" else CFLAGS="$CFLAGS -I$sslincldir" LIBS="$LIBS -L$ssllibdir -lssl -lcrypto" fi fi fi # Check TLS version if test $with_sslstatic -eq 1 || test $with_ssl -eq 1; then if test "x$sslincldir" != "x"; then CFLAGS="$CFLAGS -I$sslincldir" fi if test "x$ssllibdir" != "x"; then LIBS="$LIBS -L$ssllibdir" fi AC_MSG_CHECKING([for SSLv2]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [SSLv2_client_method()])], [sslv2=yes], [sslv2=no]) AC_MSG_RESULT($sslv2) if test "$sslv2" = "yes" ; then AC_DEFINE([HAVE_SSLV2], 1, [Define to 1 if you have openssl with SSLv2]) fi AC_CHECK_DECL([SSL_OP_NO_TLSv1_1], [AC_DEFINE([HAVE_TLSV1_1], 1, [Define to 1 if you have openssl with TLSv1.1])], [], [[#include ]]) AC_CHECK_DECL([SSL_OP_NO_TLSv1_2], [AC_DEFINE([HAVE_TLSV1_2], 1, [Define to 1 if you have openssl with TLSv1.2])], [], [[#include ]]) AC_CHECK_DECL([SSL_OP_NO_TLSv1_3], [AC_DEFINE([HAVE_TLSV1_3], 1, [Define to 1 if you have openssl with TLSv1.3])], [], [[#include ]]) AC_MSG_CHECKING([for EC_KEY support]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [EC_KEY_new_by_curve_name(0)])], [ec=yes], [ec=no]) AC_MSG_RESULT($ec) if test "$ec" = "yes" ; then AC_DEFINE([HAVE_EC_KEY], 1, [Define to 1 if you have openssl with EC_KEY]) fi AC_MSG_CHECKING([for ASN1_TIME_diff support]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [ASN1_TIME_diff(0, 0, 0, 0)])], [asn1timediff=yes], [asn1timediff=no]) AC_MSG_RESULT($asn1timediff) if test "$asn1timediff" = "yes" ; then AC_DEFINE([HAVE_ASN1_TIME_DIFF], 1, [Define to 1 if you have openssl with ASN1_TIME_diff]) fi AC_MSG_CHECKING([for SSL_CTX_set_keylog_callback support]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [SSL_CTX_set_keylog_callback(0, 0)])], [sslkeylogfile=yes], [sslkeylogfile=no]) AC_MSG_RESULT($sslkeylogfile) if test "$sslkeylogfile" = "yes" ; then AC_DEFINE([HAVE_SSL_CTX_SET_KEYLOG_CALLBACK], 1, [Define to 1 if you have ssl library with SSL_CTX_set_keylog_callback]) fi fi # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- AC_ARG_ENABLE(optimized, AS_HELP_STRING([--enable-optimized], [Build software optimized]), [ CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g[[^ ]]*//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -O3 -DNDEBUG" enable_optimized=1 else enable_optimized=0 fi ], [ enable_optimized=0 ] ) AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors (default: warnings are not errors)])], [enable_werror="$enableval"], [enable_werror=no]) AS_IF([test "x$enable_werror" = "xyes"], [CFLAGS="$CFLAGS -Werror"]) AC_ARG_ENABLE(profiling, AS_HELP_STRING([--enable-profiling], [Build with debug and profiling options]), [ if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g.//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -g -pg -fprofile-arcs -ftest-coverage" enable_profile=1 else enable_profile=0 fi ], [ enable_profile=0 ] ) AC_ARG_ENABLE([codesign], AS_HELP_STRING([--enable-codesign=identity], [Add code signature to the monit binary on macOS]), [ if test "x$enableval" = "xno" ; then enable_codesign=0 else AC_MSG_CHECKING([for validity of signing identity]) if test "x$enableval" = "xyes"; then AC_MSG_ERROR([Please provide a signing identity]) else if test -n "$(security find-identity -v|grep $enableval)"; then enable_codesign=1 AC_SUBST([CODESIGN_IDENTITY], [$enableval]) AC_MSG_RESULT(yes) else AC_MSG_ERROR([Signing identity not found]) fi fi fi ],[enable_codesign=0] ) AM_CONDITIONAL([WITH_CODESIGN], [test $enable_codesign -eq 1]) # Determine the minimum macOS version we can build if [[ $(uname) == "Darwin" ]]; then AC_MSG_CHECKING([for minimum macOS version supported]) # Create a simple C program echo "int main() { return 0; }" > t.c # Try to compile it with the specified macOS version $CC -mmacosx-version-min=10.15 -o t t.c || AC_MSG_ERROR([Could not compile test program]) # Extract the minos value using otool min_macos_version=$(otool -l t | awk '/minos/{print $2}') # Clean up the test files rm -f t.c t # Check if min_macos_version is set if test -z "$min_macos_version"; then AC_MSG_ERROR([Could not determine minimum macOS version]) else # Set CFLAGS with the determined minimum macOS version CFLAGS="$CFLAGS -mmacosx-version-min=$min_macos_version" AC_MSG_RESULT([$min_macos_version]) fi fi # ------------------------------------------------------------------------ # Outputs # ------------------------------------------------------------------------ AH_BOTTOM([ /* Mask out GCC __attribute__ extension for non-gcc compilers. */ #ifndef __GNUC__ #define __attribute__(x) #endif ]) AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([system/startup/monit.upstart]) AC_CONFIG_FILES([system/startup/monit.service]) AC_OUTPUT echo echo "Monit Build Information:" echo echo " Architecture: ${ARCH}" if test $with_sslstatic -eq 1 || test $with_ssl -eq 1; then echo " SSL include directory: ${sslincldir}" echo " SSL library directory: ${ssllibdir}" fi echo " Compiler flags: ${CFLAGS}" echo " Linker flags: ${LIBS}" echo " pid file location: ${piddir}" echo " Install directory: ${prefix}" echo AX_INFO_AGPL() AX_INFO_TITLE([Monit has been configured with the following options:]) AX_INFO_ENABLED([Compression:], [test $with_zlib -eq 1]) AX_INFO_ENABLED([PAM support:], [test $with_pam -eq 1]) AX_INFO_ENABLED([SSL support:], [test $with_sslstatic -eq 1 || test $with_ssl -eq 1]) AX_INFO_ENABLED([Large files support:], [test $with_largefiles -eq 1]) AX_INFO_ENABLED([ASAN support:], [test $with_asan -eq 1]) AX_INFO_ENABLED([IPv6 support:], [test $with_ipv6 -eq 1]) AX_INFO_ENABLED([Optimized:], [test $enable_optimized -eq 1]) AX_INFO_ENABLED([Profiling:], [test $enable_profile -eq 1]) if test "x$ARCH" = "xDARWIN"; then AX_INFO_SEPARATOR() AX_INFO_ENABLED([MacOS Code Signing:], [test $enable_codesign -eq 1]) AX_INFO_VAR([Minimum macOS Version:], [$min_macos_version]) fi AX_INFO_BREAK() monit-5.35.2/m4/0000755000016400001720000000000015007061177010254 500000000000000monit-5.35.2/m4/libtool.m40000644000016400001720000112677115007061157012117 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cr} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS monit-5.35.2/m4/ltoptions.m40000644000016400001720000003426215007061157012476 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) monit-5.35.2/m4/ltversion.m40000644000016400001720000000127315007061160012456 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) monit-5.35.2/m4/lt~obsolete.m40000644000016400001720000001377415007061160013014 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) monit-5.35.2/m4/ltsugar.m40000644000016400001720000001044015007061160012106 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) monit-5.35.2/CONTRIBUTORS0000644000016400001720000000126015007061157011531 00000000000000# This is a sorted list of awsome people who have contributed in some # way or the other to the Monit project over the years Arkadiusz Miskiewicz Artyom Khafizov Bret "Trixter" McDanel Christian Hopp Dave Cheney David Fletcher Francois Isabelle Hippo Lin Igor Homyakov Jan-Henrik Haukeland Joe Bryant Kianusch Sayah Karadji Klaus Heinz Lior Okman Marco Bisioli Margarida Sequeira Mark Ferlatte Martin Pala Michael Amster Mostafa Hosseini Oliver Jehle Olivier Beyssac Peter Holdaway Philipp Berndt Philippe Kueck Pierrick Grasland Richard Schwaninger Rick Robino Rory Toma Sébastien Debrard Tatsuya Nonogaki Thomas "Leppo" Oppel Thomas Lohmueller Will Bryant monit-5.35.2/libmonit/0000755000016400001720000000000015007061177011551 500000000000000monit-5.35.2/libmonit/config/0000755000016400001720000000000015007061163013011 500000000000000monit-5.35.2/libmonit/config/compile0000755000016400001720000001635015007061163014314 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: monit-5.35.2/libmonit/config/ax_check_compile_flag.m40000644000016400001720000000407015007061157017445 00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS monit-5.35.2/libmonit/config/ltmain.sh0000755000016400001720000117720315007061161014565 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.6 Debian-2.4.6-15build2" package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd _G_rc_run_hooks=false case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do if eval $_G_hook '"$@"'; then # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift _G_rc_run_hooks=: fi done $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, you may remove/edit # any options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. In this case you also must return $EXIT_SUCCESS to let the # hook's caller know that it should pay attention to # '_result'. Returning $EXIT_FAILURE signalizes that # arguments are left untouched by the hook and therefore caller will ignore the # result variable. # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). There is # # no need to do the equivalent (but slower) action: # # func_quote_for_eval ${1+"$@"} # # my_options_prep_result=$func_quote_for_eval_result # false # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: # args_changed=: # ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@", we could need that later # # if $args_changed is true. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # if $args_changed; then # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # fi # # $args_changed # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # false # } # func_add_hook func_validate_options my_option_validation # # You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd _G_func_options_finish_exit=false if func_run_hooks func_options ${1+"$@"}; then func_options_finish_result=$func_run_hooks_result _G_func_options_finish_exit=: fi $_G_func_options_finish_exit } # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd _G_rc_options=false for my_func in options_prep parse_options validate_options options_finish do if eval func_$my_func '${1+"$@"}'; then eval _G_res_var='$'"func_${my_func}_result" eval set dummy "$_G_res_var" ; shift _G_rc_options=: fi done # Save modified positional parameters for caller. As a top-level # options-parser function we always need to set the 'func_options_result' # variable (regardless the $_G_rc_options value). if $_G_rc_options; then func_options_result=$_G_res_var else func_quote_for_eval ${1+"$@"} func_options_result=$func_quote_for_eval_result fi $_G_rc_options } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= _G_rc_options_prep=false if func_run_hooks func_options_prep ${1+"$@"}; then _G_rc_options_prep=: # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result fi $_G_rc_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. if func_run_hooks func_parse_options ${1+"$@"}; then eval set dummy "$func_run_hooks_result"; shift _G_rc_parse_options=: fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_rc_parse_options=: break fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac $_G_match_parse_options && _G_rc_parse_options=: done if $_G_rc_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result fi $_G_rc_parse_options } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd _G_rc_validate_options=false # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" if func_run_hooks func_validate_options ${1+"$@"}; then # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result _G_rc_validate_options=: fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE $_G_rc_validate_options } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname $scriptversion Debian-2.4.6-15build2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= _G_rc_lt_options_prep=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result fi $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"} ; shift _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result fi $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # 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 BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -static-* direct GCC to link specific libraries statically # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: monit-5.35.2/libmonit/config/install-sh0000755000016400001720000003577615007061163014757 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: monit-5.35.2/libmonit/config/missing0000755000016400001720000001533615007061163014340 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: monit-5.35.2/libmonit/config/config.guess0000755000016400001720000014051215007061163015254 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI=${LIBC}x32 fi fi GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; x86_64:Haiku:*:*) GUESS=x86_64-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&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` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.35.2/libmonit/config/config.sub0000755000016400001720000010511615007061163014720 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2022-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ | linux-musl* | linux-relibc* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.35.2/libmonit/Makefile.in0000644000016400001720000007733115007061163013544 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) Tildeslash Ltd. All rights reserved. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/config/ax_check_compile_flag.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/xconfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmonit_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am_libmonit_la_OBJECTS = src/Bootstrap.lo src/exceptions/assert.lo \ src/exceptions/Exception.lo src/io/Dir.lo src/io/File.lo \ src/io/InputStream.lo src/io/OutputStream.lo src/system/Mem.lo \ src/system/Net.lo src/system/Command.lo src/system/Random.lo \ src/system/System.lo src/system/Time.lo src/util/Fmt.lo \ src/util/Array.lo src/util/List.lo src/util/Str.lo \ src/util/StringBuffer.lo src/thread/Thread.lo libmonit_la_OBJECTS = $(am_libmonit_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmonit_la_SOURCES) DIST_SOURCES = $(libmonit_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/compile \ $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ $(top_srcdir)/config/missing $(top_srcdir)/src/xconfig.h.in \ COPYING README config/compile config/config.guess \ config/config.sub config/install-sh config/ltmain.sh \ config/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 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@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNIT_TEST = @UNIT_TEST@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign no-dependencies subdir-objects ACLOCAL_AMFLAGS = -I m4 SUBDIRS = . $(UNIT_TEST) DIST_SUBDIRS = . test EXTRA_DIST = README COPYING bootstrap test src config AM_CPPFLAGS = $(CPPFLAGS) $(DBCPPFLAGS) -I./src -I./src/exceptions -I./src/io -I./src/net -I./src/util -I./src/thread # libmonit is built static noinst_LTLIBRARIES = libmonit.la libmonit_la_SOURCES = \ src/Bootstrap.c \ src/exceptions/assert.c \ src/exceptions/Exception.c \ src/io/Dir.c \ src/io/File.c \ src/io/InputStream.c \ src/io/OutputStream.c \ src/system/Mem.c \ src/system/Net.c \ src/system/Command.c \ src/system/Random.c \ src/system/System.c \ src/system/Time.c \ src/util/Fmt.c \ src/util/Array.c \ src/util/List.c \ src/util/Str.c \ src/util/StringBuffer.c \ src/thread/Thread.c all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): src/xconfig.h: src/stamp-h1 @test -f $@ || rm -f src/stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) src/stamp-h1 src/stamp-h1: $(top_srcdir)/src/xconfig.h.in $(top_builddir)/config.status @rm -f src/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/xconfig.h $(top_srcdir)/src/xconfig.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f src/stamp-h1 touch $@ distclean-hdr: -rm -f src/xconfig.h src/stamp-h1 clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/Bootstrap.lo: src/$(am__dirstamp) src/exceptions/$(am__dirstamp): @$(MKDIR_P) src/exceptions @: > src/exceptions/$(am__dirstamp) src/exceptions/assert.lo: src/exceptions/$(am__dirstamp) src/exceptions/Exception.lo: src/exceptions/$(am__dirstamp) src/io/$(am__dirstamp): @$(MKDIR_P) src/io @: > src/io/$(am__dirstamp) src/io/Dir.lo: src/io/$(am__dirstamp) src/io/File.lo: src/io/$(am__dirstamp) src/io/InputStream.lo: src/io/$(am__dirstamp) src/io/OutputStream.lo: src/io/$(am__dirstamp) src/system/$(am__dirstamp): @$(MKDIR_P) src/system @: > src/system/$(am__dirstamp) src/system/Mem.lo: src/system/$(am__dirstamp) src/system/Net.lo: src/system/$(am__dirstamp) src/system/Command.lo: src/system/$(am__dirstamp) src/system/Random.lo: src/system/$(am__dirstamp) src/system/System.lo: src/system/$(am__dirstamp) src/system/Time.lo: src/system/$(am__dirstamp) src/util/$(am__dirstamp): @$(MKDIR_P) src/util @: > src/util/$(am__dirstamp) src/util/Fmt.lo: src/util/$(am__dirstamp) src/util/Array.lo: src/util/$(am__dirstamp) src/util/List.lo: src/util/$(am__dirstamp) src/util/Str.lo: src/util/$(am__dirstamp) src/util/StringBuffer.lo: src/util/$(am__dirstamp) src/thread/$(am__dirstamp): @$(MKDIR_P) src/thread @: > src/thread/$(am__dirstamp) src/thread/Thread.lo: src/thread/$(am__dirstamp) libmonit.la: $(libmonit_la_OBJECTS) $(libmonit_la_DEPENDENCIES) $(EXTRA_libmonit_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libmonit_la_OBJECTS) $(libmonit_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/*.$(OBJEXT) -rm -f src/*.lo -rm -f src/exceptions/*.$(OBJEXT) -rm -f src/exceptions/*.lo -rm -f src/io/*.$(OBJEXT) -rm -f src/io/*.lo -rm -f src/system/*.$(OBJEXT) -rm -f src/system/*.lo -rm -f src/thread/*.$(OBJEXT) -rm -f src/thread/*.lo -rm -f src/util/*.$(OBJEXT) -rm -f src/util/*.lo distclean-compile: -rm -f *.tab.c .c.o: $(AM_V_CC)$(COMPILE) -c -o $@ $< .c.obj: $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs -rm -rf src/exceptions/.libs src/exceptions/_libs -rm -rf src/io/.libs src/io/_libs -rm -rf src/system/.libs src/system/_libs -rm -rf src/thread/.libs src/thread/_libs -rm -rf src/util/.libs src/util/_libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f src/$(am__dirstamp) -rm -f src/exceptions/$(am__dirstamp) -rm -f src/io/$(am__dirstamp) -rm -f src/system/$(am__dirstamp) -rm -f src/thread/$(am__dirstamp) -rm -f src/util/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool clean-local clean-noinstLTLIBRARIES cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-local distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile dist-hook:: -rm -rf `find $(distdir) -name "._*"` -rm -rf `find $(distdir) -name ".DS_Store"` -rm -rf `find $(distdir) -name ".libs"` -rm -rf `find $(distdir) -name ".git"` -rm -f $(distdir)/src/xconfig.h $(distdir)/Makefile $(distdir)/src/stamp-* clean-local: -rm -f `find . -name "*.o" -o -name "*.lo" -o -name "*.loT" -o -name "*~"` distclean-local: -rm -rf autom4te.cache/ cleanall: clean distclean git clean -fxd verify: libmonit.la cd $(srcdir)/test && $(MAKE) verify # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: monit-5.35.2/libmonit/libtool0000755000016400001720000125033715007061176013075 00000000000000#! /bin/bash # Generated automatically by config.status (libmonit) 1.0 # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : ${LT_SYS_LIBRARY_PATH=""} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=2.4.6 macro_revision=2.4.6 # Whether or not to build shared libraries. build_libtool_libs=yes # Whether or not to build static libraries. build_old_libs=yes # What type of objects to build. pic_mode=default # Whether or not to optimize for fast installation. fast_install=needless # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec= # Shell to use when invoking shell scripts. SHELL="/bin/bash" # An echo program that protects backslashes. ECHO="printf %s\\n" # The PATH separator for the build system. PATH_SEPARATOR=":" # The host system. host_alias= host=x86_64-pc-linux-gnu host_os=linux-gnu # The build system. build_alias= build=x86_64-pc-linux-gnu build_os=linux-gnu # A sed program that does not truncate output. SED="/usr/bin/sed" # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # A grep program that handles long lines. GREP="/usr/bin/grep" # An ERE matcher. EGREP="/usr/bin/grep -E" # A literal string matcher. FGREP="/usr/bin/grep -F" # A BSD- or MS-compatible name lister. NM="/usr/bin/nm -B" # Whether we need soft or hard links. LN_S="ln -s" # What is the maximum length of a command? max_cmd_len=1572864 # Object file suffix (normally "o"). objext=o # Executable file suffix (normally ""). exeext= # whether the shell understands "unset". lt_unset=unset # turn spaces into newlines. SP2NL="tr \\040 \\012" # turn newlines into spaces. NL2SP="tr \\015\\012 \\040\\040" # convert $build file names to $host format. to_host_file_cmd=func_convert_file_noop # convert $build files to toolchain format. to_tool_file_cmd=func_convert_file_noop # An object symbol dumper. OBJDUMP="objdump" # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" # Command to use when deplibs_check_method = "file_magic". file_magic_cmd="\$MAGIC_CMD" # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob="" # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob="no" # DLL creation program. DLLTOOL="false" # Command to associate shared and link libraries. sharedlib_from_linklib_cmd="printf %s\\n" # The archiver. AR="ar" # Flags to create an archive. AR_FLAGS="cr" # How to feed a file listing to the archiver. archiver_list_spec="@" # A symbol stripping program. STRIP="strip" # Commands used to install an old-style archive. RANLIB="ranlib" old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib" old_postuninstall_cmds="" # Whether to use a lock for old archive extraction. lock_old_archive_extraction=no # A C compiler. LTCC="gcc" # LTCC compiler flags. LTCFLAGS="-g -O2 -Wextra -fstack-protector-all -D _REENTRANT -D_GNU_SOURCE -Wall -Wunused -std=c11" # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'" # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import="" # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'" # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'" # The name lister interface. nm_interface="BSD nm" # Specify filename containing input files for $NM. nm_file_list_spec="@" # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot= # Command to truncate a binary pipe. lt_truncate_bin="/usr/bin/dd bs=4096 count=1" # The name of the directory that contains temporary libtool files. objdir=.libs # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=file # Must we lock files when doing compilation? need_locks="no" # Manifest tool. MANIFEST_TOOL=":" # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL="" # Tool to change global to local symbols on Mac OS X. NMEDIT="" # Tool to manipulate fat objects and archives on Mac OS X. LIPO="" # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL="" # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64="" # Old archive suffix (normally "a"). libext=a # Shared library suffix (normally ".so"). shrext_cmds=".so" # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds="" # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" # Do we need the "lib" prefix for modules? need_lib_prefix=no # Do we need a version for libraries? need_version=no # Library versioning type. version_type=linux # Shared library runtime path variable. runpath_var=LD_RUN_PATH # Shared library path variable. shlibpath_var=LD_LIBRARY_PATH # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=yes # Format of library name prefix. libname_spec="lib\$name" # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext" # The coded name of the library, if different from the real name. soname_spec="\$libname\$release\$shared_ext\$major" # Permission mode override for installation of shared libraries. install_override_mode="" # Command to use after installation of a shared archive. postinstall_cmds="" # Command to use after uninstallation of a shared archive. postuninstall_cmds="" # Commands used to finish a libtool library installation in a directory. finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval="" # Whether we should hardcode library paths into libraries. hardcode_into_libs=yes # Compile-time system search path for libraries. sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/11 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib " # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/fakechroot /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 " # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path="" # Whether dlopen is supported. dlopen_support=unknown # Whether dlopen of programs is supported. dlopen_self=unknown # Whether dlopen of statically linked programs is supported. dlopen_self_static=unknown # Commands to strip libraries. old_striplib="strip --strip-debug" striplib="strip --strip-unneeded" # The linker used to build libraries. LD="/usr/bin/ld -m elf_x86_64" # How to create reloadable object files. reload_flag=" -r" reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" # Commands used to build an old-style archive. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" # A language specific compiler. CC="gcc" # Is the compiler the GNU compiler? with_gcc=yes # Compiler flag to turn off builtin functions. no_builtin_flag=" -fno-builtin" # Additional compiler flags for building library objects. pic_flag=" -fPIC -DPIC" # How to pass a linker flag through the compiler. wl="-Wl," # Compiler flag to prevent dynamic linking. link_static_flag="-static" # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=no # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=no # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec="\$wl--export-dynamic" # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive" # Whether the compiler copes with passing no objects directly. compiler_needs_object="no" # Create an old-style archive from a shared archive. old_archive_from_new_cmds="" # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds="" # Commands used to build a shared archive. archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib" archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib" # Commands used to build a loadable module if different from building # a shared archive. module_cmds="" module_expsym_cmds="" # Whether we are building with GNU ld or not. with_gnu_ld="yes" # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag="" # Flag that enforces no undefined symbols. no_undefined_flag="" # Flag to hardcode $libdir into a binary during linking. # This must work even if $libdir does not exist hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir" # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator="" # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=no # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting $shlibpath_var if the # library is relocated. hardcode_direct_absolute=no # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=no # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=unsupported # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=no # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=no # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=no # Set to "yes" if exported symbols are required. always_export_symbols=no # The commands to list exported symbols. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" # Symbols that should not be listed in the preloaded symbols. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" # Symbols that must always be exported. include_expsyms="" # Commands necessary for linking programs (against libraries) with templates. prelink_cmds="" # Commands necessary for finishing linking programs. postlink_cmds="" # Specify filename containing input files. file_list_spec="" # How to hardcode a shared library path into an executable. hardcode_action=immediate # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs="" # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects="" postdep_objects="" predeps="" postdeps="" # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path="" # ### END LIBTOOL CONFIG # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE #! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.6 Debian-2.4.6-15build2" package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd _G_rc_run_hooks=false case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do if eval $_G_hook '"$@"'; then # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift _G_rc_run_hooks=: fi done $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, you may remove/edit # any options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. In this case you also must return $EXIT_SUCCESS to let the # hook's caller know that it should pay attention to # '_result'. Returning $EXIT_FAILURE signalizes that # arguments are left untouched by the hook and therefore caller will ignore the # result variable. # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). There is # # no need to do the equivalent (but slower) action: # # func_quote_for_eval ${1+"$@"} # # my_options_prep_result=$func_quote_for_eval_result # false # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: # args_changed=: # ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@", we could need that later # # if $args_changed is true. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # if $args_changed; then # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # fi # # $args_changed # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # false # } # func_add_hook func_validate_options my_option_validation # # You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd _G_func_options_finish_exit=false if func_run_hooks func_options ${1+"$@"}; then func_options_finish_result=$func_run_hooks_result _G_func_options_finish_exit=: fi $_G_func_options_finish_exit } # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd _G_rc_options=false for my_func in options_prep parse_options validate_options options_finish do if eval func_$my_func '${1+"$@"}'; then eval _G_res_var='$'"func_${my_func}_result" eval set dummy "$_G_res_var" ; shift _G_rc_options=: fi done # Save modified positional parameters for caller. As a top-level # options-parser function we always need to set the 'func_options_result' # variable (regardless the $_G_rc_options value). if $_G_rc_options; then func_options_result=$_G_res_var else func_quote_for_eval ${1+"$@"} func_options_result=$func_quote_for_eval_result fi $_G_rc_options } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= _G_rc_options_prep=false if func_run_hooks func_options_prep ${1+"$@"}; then _G_rc_options_prep=: # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result fi $_G_rc_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. if func_run_hooks func_parse_options ${1+"$@"}; then eval set dummy "$func_run_hooks_result"; shift _G_rc_parse_options=: fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_rc_parse_options=: break fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac $_G_match_parse_options && _G_rc_parse_options=: done if $_G_rc_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result fi $_G_rc_parse_options } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd _G_rc_validate_options=false # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" if func_run_hooks func_validate_options ${1+"$@"}; then # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result _G_rc_validate_options=: fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE $_G_rc_validate_options } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname $scriptversion Debian-2.4.6-15build2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= _G_rc_lt_options_prep=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result fi $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"} ; shift _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result fi $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # 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 BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -static-* direct GCC to link specific libraries statically # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD="/usr/bin/ld -m elf_x86_64" # How to create reloadable object files. reload_flag=" -r" reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" # Commands used to build an old-style archive. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" # A language specific compiler. CC="g++" # Is the compiler the GNU compiler? with_gcc=yes # Compiler flag to turn off builtin functions. no_builtin_flag=" -fno-builtin" # Additional compiler flags for building library objects. pic_flag=" -fPIC -DPIC" # How to pass a linker flag through the compiler. wl="-Wl," # Compiler flag to prevent dynamic linking. link_static_flag="-static" # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=no # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=no # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec="\$wl--export-dynamic" # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive" # Whether the compiler copes with passing no objects directly. compiler_needs_object="no" # Create an old-style archive from a shared archive. old_archive_from_new_cmds="" # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds="" # Commands used to build a shared archive. archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib" archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname \$wl-retain-symbols-file \$wl\$export_symbols -o \$lib" # Commands used to build a loadable module if different from building # a shared archive. module_cmds="" module_expsym_cmds="" # Whether we are building with GNU ld or not. with_gnu_ld="yes" # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag="" # Flag that enforces no undefined symbols. no_undefined_flag="" # Flag to hardcode $libdir into a binary during linking. # This must work even if $libdir does not exist hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir" # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator="" # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=no # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting $shlibpath_var if the # library is relocated. hardcode_direct_absolute=no # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=no # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=unsupported # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=no # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=no # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=no # Set to "yes" if exported symbols are required. always_export_symbols=no # The commands to list exported symbols. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" # Symbols that should not be listed in the preloaded symbols. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" # Symbols that must always be exported. include_expsyms="" # Commands necessary for linking programs (against libraries) with templates. prelink_cmds="" # Commands necessary for finishing linking programs. postlink_cmds="" # Specify filename containing input files. file_list_spec="" # How to hardcode a shared library path into an executable. hardcode_action=immediate # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs="/usr/lib/gcc/x86_64-linux-gnu/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/11/../../.." # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects="/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o" postdep_objects="/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o" predeps="" postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path="-L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.." # ### END LIBTOOL TAG CONFIG: CXX monit-5.35.2/libmonit/Makefile.am0000644000016400001720000000321615007061157013525 00000000000000# Copyright (C) Tildeslash Ltd. All rights reserved. AUTOMAKE_OPTIONS = foreign no-dependencies subdir-objects ACLOCAL_AMFLAGS = -I m4 SUBDIRS = . $(UNIT_TEST) DIST_SUBDIRS = . test EXTRA_DIST = README COPYING bootstrap test src config AM_CPPFLAGS = $(CPPFLAGS) $(DBCPPFLAGS) -I./src -I./src/exceptions -I./src/io -I./src/net -I./src/util -I./src/thread # libmonit is built static noinst_LTLIBRARIES = libmonit.la libmonit_la_SOURCES = \ src/Bootstrap.c \ src/exceptions/assert.c \ src/exceptions/Exception.c \ src/io/Dir.c \ src/io/File.c \ src/io/InputStream.c \ src/io/OutputStream.c \ src/system/Mem.c \ src/system/Net.c \ src/system/Command.c \ src/system/Random.c \ src/system/System.c \ src/system/Time.c \ src/util/Fmt.c \ src/util/Array.c \ src/util/List.c \ src/util/Str.c \ src/util/StringBuffer.c \ src/thread/Thread.c dist-hook:: -rm -rf `find $(distdir) -name "._*"` -rm -rf `find $(distdir) -name ".DS_Store"` -rm -rf `find $(distdir) -name ".libs"` -rm -rf `find $(distdir) -name ".git"` -rm -f $(distdir)/src/xconfig.h $(distdir)/Makefile $(distdir)/src/stamp-* clean-local: -rm -f `find . -name "*.o" -o -name "*.lo" -o -name "*.loT" -o -name "*~"` distclean-local: -rm -rf autom4te.cache/ cleanall: clean distclean git clean -fxd verify: libmonit.la cd $(srcdir)/test && $(MAKE) verify monit-5.35.2/libmonit/THIRDPARTY0000644000016400001720000000236015007061157013105 00000000000000This product use some modified parts from the CII software library by David R. Hanson. (http://www.cs.princeton.edu/software/cii/) Copyright (c) 1994,1995,1996,1997 by David R. Hanson. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. monit-5.35.2/libmonit/configure.ac0000644000016400001720000003535015007061157013763 00000000000000# Copyright (C) Tildeslash Ltd. All rights reserved. AC_PREREQ([2.53]) AC_INIT([libmonit], [1.0], [monit-dev@tildeslash.com]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src]) # --------------------------------------------------------------------------- # Programs # --------------------------------------------------------------------------- AC_PROG_CC AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"]) if test `uname` != "AIX"; then AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protector-all"]) fi # --------------------------------------------------------------------------- # Libtool # --------------------------------------------------------------------------- LT_INIT # ------------------------------------------------------------------------ # AddressSanitizer # ------------------------------------------------------------------------ AC_MSG_CHECKING([for AddressSanitizer support]) AC_ARG_WITH(asan, [ --with-asan enable the use of AddressSanitizer (default: disabled)], [ dnl Check the withvalue if test "x$withval" = "xno" ; then use_asan=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then use_asan=1 AC_MSG_RESULT([enabled]) fi ], [ use_asan=0 AC_MSG_RESULT([disabled]) ] ) if test "$use_asan" = "1"; then AX_CHECK_COMPILE_FLAG([-fsanitize=address], [CFLAGS="$CFLAGS -fsanitize=address"]) AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], [CFLAGS="$CFLAGS -fno-omit-frame-pointer"]) AX_CHECK_COMPILE_FLAG([-fsanitize=bool], [CFLAGS="$CFLAGS -fsanitize=bool"]) AX_CHECK_COMPILE_FLAG([-fsanitize=enum], [CFLAGS="$CFLAGS -fsanitize=enum"]) AX_CHECK_COMPILE_FLAG([-fsanitize=float-divide-by-zero], [CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero"]) AX_CHECK_COMPILE_FLAG([-fsanitize-address-use-after-scope], [CFLAGS="$CFLAGS -fsanitize-address-use-after-scope"]) AX_CHECK_COMPILE_FLAG([-fsanitize=signed-integer-overflow], [CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow"]) AX_CHECK_COMPILE_FLAG([-fsanitize=vla-bound], [CFLAGS="$CFLAGS -fsanitize=vla-bound"]) AX_CHECK_COMPILE_FLAG([-fsanitize=bounds-strict], [CFLAGS="$CFLAGS -fsanitize=bounds-strict"]) AX_CHECK_COMPILE_FLAG([-fsanitize=null], [CFLAGS="$CFLAGS -fsanitize=null "]) AX_CHECK_COMPILE_FLAG([-fsanitize=object-size], [CFLAGS="$CFLAGS -fsanitize=object-size"]) fi # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- UNIT_TEST="test" AC_ARG_ENABLE(optimized, AS_HELP_STRING([--enable-optimized], [Build software optimized. Unit Tests are not enabled with this option]), [ if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g[[^ ]]*//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -O3 -DNDEBUG" OPTIMIZED=1 UNIT_TEST="" else OPTIMIZED=0 fi ], [ OPTIMIZED=0 ] ) AC_SUBST(UNIT_TEST) AC_ARG_ENABLE(profiling, AS_HELP_STRING([--enable-profiling], [Build with debug and profiling options]), [ if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g.//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -g -pg -fprofile-arcs -ftest-coverage" profile="true" fi ], [ profile="false" ] ) AC_ARG_WITH([zlib], AS_HELP_STRING([--with-zlib(=)], [Link Monit with zlib. An optional path argument may be given to specify the top-level directory to search for zlib to link with]), [ if test "x$withval" = "xyes"; then AC_CHECK_LIB([z], [zlibVersion], [], [ zlib="false" AC_MSG_ERROR([libz not found]) ]) AC_CHECK_HEADERS([zlib.h]) elif test "x$withval" != "xno"; then AC_MSG_CHECKING([for zlib in $withval]) LDFLAGS="-L$withval/lib -lz $LDFLAGS " CFLAGS="-I$withval/include $CFLAGS" if test -r "$withval/lib/libz.a" -a -r "$withval/include/zlib.h"; then AC_DEFINE([HAVE_LIBZ], [1], [Define if you have zlib library]) AC_DEFINE([HAVE_ZLIB_H], [1], [Define if you have zlib header]) AC_MSG_RESULT([ok]) else zlib="false" AC_MSG_ERROR([zlib not found in $withval]) fi else zlib="false" fi ],[ AC_CHECK_LIB([z], [zlibVersion], [], [ zlib="false" AC_MSG_ERROR([libz not found]) ]) AC_CHECK_HEADERS([zlib.h]) ] ) # --------------------------------------------------------------------------- # Libraries # --------------------------------------------------------------------------- AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([POSIX thread library is required])]) AC_CHECK_LIB([m], [round], [], [AC_MSG_ERROR([Math library is required])]) # --------------------------------------------------------------------------- # Header files # --------------------------------------------------------------------------- AC_CHECK_HEADERS([ctype.h \ errno.h \ execinfo.h \ fcntl.h \ ifaddrs.h \ kstat.h \ limits.h \ net/if_dl.h \ net/if_media.h\ netinet/in.h \ poll.h \ pthread.h \ setjmp.h \ signal.h \ stdarg.h \ stdio.h \ string.h \ strings.h \ stropts.h \ sys/dirent.h \ sys/event.h \ sys/filio.h \ sys/ioctl.h \ sys/poll.h \ sys/protosw.h \ sys/random.h \ sys/sendfile.h \ sys/socket.h \ sys/sysctl.h \ sys/time.h \ sys/types.h \ unistd.h \ usersec.h]) AC_CHECK_HEADERS([net/if.h net/route.h], [], [], [ #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IP_H #include #endif ]) AC_CHECK_HEADERS([ \ libperfstat.h \ ], [], [], [ #ifdef HAVE_SYS_PROTOSW_H #include #endif ]) # ------------------------------------------------------------------------ # Types # ------------------------------------------------------------------------ AC_CHECK_TYPES([uchar_t]) # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Require a working sigsetjmp AC_CHECK_DECLS([sigsetjmp], [], [AC_MSG_FAILURE([sigsetjmp is required])], [[#include ]]) # Require that we have vsnprintf that conforms to c99. I.e. does bounds check AC_CHECK_FUNC([vsnprintf], [], [AC_MSG_FAILURE([vsnprintf is required])]) AC_CHECK_FUNCS([timegm getgrouplist getrandom arc4random_buf clock_gettime]) # ------------------------------------------------------------------------ # Architecture/OS # ------------------------------------------------------------------------ architecture=`uname` if test "$architecture" = "Linux" then CFLAGS="$CFLAGS -D _REENTRANT" LDFLAGS="$LDFLAGS -lrt" AC_DEFINE([LINUX], 1, [Define to 1 if the system is Linux]) elif test "$architecture" = "FreeBSD" then CFLAGS="$CFLAGS -D _REENTRANT" AC_DEFINE([FREEBSD], 1, [Define to 1 if the system is FreeBSD]) elif test "$architecture" = "GNU/kFreeBSD" then CFLAGS="$CFLAGS -D _REENTRANT" AC_DEFINE([FREEBSD], 1, [Define to 1 if the system is FreeBSD]) elif test "$architecture" = "OpenBSD" then CFLAGS="$CFLAGS -D _REENTRANT" AC_DEFINE([OPENBSD], 1, [Define to 1 if the system is OpenBSD]) elif test "$architecture" = "DragonFly" then CFLAGS="$CFLAGS -D _REENTRANT" AC_DEFINE([DRAGONFLY], 1, [Define to 1 if the system is DragonFly]) elif test "$architecture" = "Darwin" then CFLAGS="$CFLAGS -DREENTRANT" AC_DEFINE([DARWIN], 1, [Define to 1 if the system is OSX]) elif test "$architecture" = "SunOS" then LIBS="$LIBS -lsocket -lnsl -lkstat" CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64" LDFLAGS="$LDFLAGS -m64" if test `uname -m` != "i86pc" then CFLAGS="$CFLAGS -mtune=v9" LDFLAGS="$LDFLAGS -mtune=v9" fi AC_DEFINE([SOLARIS], 1, [Define to 1 if the system is SOLARIS]) elif test "$architecture" = "NetBSD" then CFLAGS="$CFLAGS -D_REENTRANT -Wno-char-subscripts" AC_DEFINE([NETBSD], 1, [Define to 1 if the system is NETBSD]) elif test "$architecture" = "AIX" then CFLAGS=`echo $CFLAGS|sed 's/-g//'` CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" AC_DEFINE([AIX], 1, [Define to 1 if the system is AIX]) LIBS="$LIBS -lcfg -lodm -lperfstat" else AC_MSG_ERROR([Architecture not supported: ${architecture}]) fi # --------------------------------------------------------------------------- # Compiler # --------------------------------------------------------------------------- AC_PROG_CC AC_PROG_CXX AC_C_CONST AC_C_BIGENDIAN # Define _GNU_SOURCE so we can have Posix headers etc included. We use the # -std=cXX compiler switch which only include a minimum of C headers CFLAGS="$CFLAGS -D_GNU_SOURCE" # Compiler; tune warnings CFLAGS="$CFLAGS -Wall -Wunused " # Require at least C99 and use C11 if available AC_COMPUTE_INT([STDC_VERSION],[__STDC_VERSION__],,[STDC_VERSION=0]) AS_IF([test "$STDC_VERSION" -ge 201112],[CFLAGS="$CFLAGS -std=c11"],[CFLAGS="$CFLAGS -std=c99"]) AC_CHECK_HEADERS([stdint.h stdbool.h], [], [AC_MSG_ERROR([toolchain does not have C99 headers])]) # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ AC_ARG_WITH(ipv6, AS_HELP_STRING([--without-ipv6], [Disable the IPv6 support (default: check)]), [ if test "x$withval" = "xno" then with_ipv6=0 elif test "x$withval" = "xyes" then with_ipv6=1 AC_DEFINE([HAVE_IPV6], 1, [Define to 1 if the system supports IPv6]) fi ], [ # Note inverse test. Check by default AC_MSG_CHECKING(for IPv6 support) AC_CACHE_VAL(ac_cv_ipv6, AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include #include /* Make sure the definitions for AF_INET6 and struct sockaddr_in6 * are defined, and that we can actually create an IPv6 TCP socket.*/ int main(void) { int fd; struct sockaddr_in6 foo; fd = socket(AF_INET6, SOCK_STREAM, 0); exit(fd >= 0 ? 0 : 1); }]])], [ac_cv_ipv6=yes], [ac_cv_ipv6=no], [ac_cv_ipv6=no]) ) AC_MSG_RESULT($ac_cv_ipv6) if test $ac_cv_ipv6 = yes then with_ipv6=1 AC_DEFINE([HAVE_IPV6], 1, [Define to 1 if the system supports IPv6]) else with_ipv6=0 fi ] ) # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- # Determine the minimum macOS version we can build if [[ $(uname) == "Darwin" ]]; then AC_MSG_CHECKING([for minimum macOS version supported]) # Create a simple C program echo "int main() { return 0; }" > t.c # Try to compile it with the specified macOS version $CC -mmacosx-version-min=10.15 -o t t.c || AC_MSG_ERROR([Could not compile test program]) # Extract the minos value using otool min_macos_version=$(otool -l t | egrep minos | awk '{print $2}') # Clean up the test files rm -f t.c t # Check if min_macos_version is set if test -z "$min_macos_version"; then AC_MSG_ERROR([Could not determine minimum macOS version]) else # Set CFLAGS with the determined minimum macOS version CFLAGS="$CFLAGS -mmacosx-version-min=$min_macos_version" AC_MSG_RESULT([$min_macos_version]) fi fi # --------------------------------------------------------------------------- # Outputs # --------------------------------------------------------------------------- AC_CONFIG_HEADERS(src/xconfig.h) AC_CONFIG_FILES([Makefile test/Makefile]) AC_OUTPUT cat <. ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cr} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS monit-5.35.2/libmonit/m4/ltoptions.m40000644000016400001720000003426215007061161014306 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) monit-5.35.2/libmonit/m4/ltversion.m40000644000016400001720000000127315007061161014274 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) monit-5.35.2/libmonit/m4/lt~obsolete.m40000644000016400001720000001377415007061161014632 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) monit-5.35.2/libmonit/m4/ltsugar.m40000644000016400001720000001044015007061161013724 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) monit-5.35.2/libmonit/configure0000755000016400001720000245751215007061163013413 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for libmonit 1.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 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. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (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 \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: monit-dev@tildeslash.com about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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=`printf "%s\n" "$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 || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop 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_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libmonit' PACKAGE_TARNAME='libmonit' PACKAGE_VERSION='1.0' PACKAGE_STRING='libmonit 1.0' PACKAGE_BUGREPORT='monit-dev@tildeslash.com' PACKAGE_URL='' ac_unique_file="src" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX UNIT_TEST LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_asan enable_optimized enable_profiling with_zlib with_ipv6 ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CXX CXXFLAGS CCC CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) 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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) 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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --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" ;; *=*) 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 eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libmonit 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libmonit] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libmonit 1.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-optimized Build software optimized. Unit Tests are not enabled with this option --enable-profiling Build with debug and profiling options Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-asan enable the use of AddressSanitizer (default: disabled) --with-zlib(=) Link Monit with zlib. An optional path argument may be given to specify the top-level directory to search for zlib to link with --without-ipv6 Disable the IPv6 support (default: check) Some influential environment variables: CC C compiler command CFLAGS C compiler flags 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 you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libmonit configure 1.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 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 ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop 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 $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop 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. */ #include #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 (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { 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 (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR # ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_check_decl # 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 conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_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\"" printf "%s\n" "$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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_try_run LINENO # ---------------------- # Try to run 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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid; break else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=$ac_mid; break else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval (void) { return $2; } static unsigned long int ulongval (void) { return $2; } #include #include int main (void) { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : echo >>conftest.val; read $3 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 libmonit $as_me 1.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "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=`printf "%s\n" "$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=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " # Auxiliary files required by this configure script. ac_aux_files="config.guess config.sub ltmain.sh compile missing install-sh" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}/config" # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # 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 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # 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. MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." 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 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='libmonit' VERSION='1.0' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # --------------------------------------------------------------------------- # Programs # --------------------------------------------------------------------------- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$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_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$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 (void) { 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. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$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 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra" >&5 printf %s "checking whether C compiler accepts -Wextra... " >&6; } if test ${ax_cv_check_cflags___Wextra+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wextra" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___Wextra=yes else $as_nop ax_cv_check_cflags___Wextra=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wextra" >&5 printf "%s\n" "$ax_cv_check_cflags___Wextra" >&6; } if test "x$ax_cv_check_cflags___Wextra" = xyes then : CFLAGS="$CFLAGS -Wextra" else $as_nop : fi if test `uname` != "AIX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector-all" >&5 printf %s "checking whether C compiler accepts -fstack-protector-all... " >&6; } if test ${ax_cv_check_cflags___fstack_protector_all+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fstack-protector-all" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fstack_protector_all=yes else $as_nop ax_cv_check_cflags___fstack_protector_all=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstack_protector_all" >&5 printf "%s\n" "$ax_cv_check_cflags___fstack_protector_all" >&6; } if test "x$ax_cv_check_cflags___fstack_protector_all" = xyes then : CFLAGS="$CFLAGS -fstack-protector-all" else $as_nop : fi fi # --------------------------------------------------------------------------- # Libtool # --------------------------------------------------------------------------- case `pwd` in *\ * | *\ *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 printf "%s\n" "printf" >&6; } ;; print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 printf "%s\n" "print -r" >&6; } ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 printf "%s\n" "cat" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 printf %s "checking for fgrep... " >&6; } if test ${ac_cv_path_FGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in fgrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test ${lt_cv_path_NM+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 printf "%s\n" "$DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 printf %s "checking the name lister ($NM) interface... " >&6; } if test ${lt_cv_nm_interface+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 printf "%s\n" "$lt_cv_nm_interface" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 printf %s "checking the maximum length of command line arguments... " >&6; } if test ${lt_cv_sys_max_cmd_len+y} then : printf %s "(cached) " >&6 else $as_nop i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 printf %s "checking how to convert $build file names to $host format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 printf %s "checking how to convert $build file names to toolchain format... " >&6; } if test ${lt_cv_to_tool_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 printf %s "checking for $LD option to reload object files... " >&6; } if test ${lt_cv_ld_reload_flag+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_reload_flag='-r' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 printf "%s\n" "$OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 printf %s "checking how to recognize dependent libraries... " >&6; } if test ${lt_cv_deplibs_check_method+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 printf "%s\n" "$DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 printf %s "checking how to associate runtime and link libraries... " >&6; } if test ${lt_cv_sharedlib_from_linklib_cmd+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cr} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 printf %s "checking for archiver @FILE support... " >&6; } if test ${lt_cv_ar_at_file+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 printf %s "checking command to parse $NM output from $compiler object... " >&6; } if test ${lt_cv_sys_global_symbol_pipe+y} then : printf %s "(cached) " >&6 else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 printf "%s\n" "failed" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test ${with_sysroot+y} then : withval=$with_sysroot; else $as_nop with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 printf "%s\n" "${lt_sysroot:-no}" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 printf %s "checking for a working dd... " >&6; } if test ${ac_cv_path_lt_DD+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in dd do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 printf "%s\n" "$ac_cv_path_lt_DD" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 printf %s "checking how to truncate binary pipes... " >&6; } if test ${lt_cv_truncate_bin+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 printf "%s\n" "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test ${enable_libtool_lock+y} then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 printf %s "checking whether the C compiler needs -belf... " >&6; } if test ${lt_cv_cc_needs_belf+y} then : printf %s "(cached) " >&6 else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_cc_needs_belf=yes else $as_nop lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 printf "%s\n" "$MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if test ${lt_cv_path_mainfest_tool+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 printf "%s\n" "$DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 printf "%s\n" "$NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 printf "%s\n" "$ac_ct_NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 printf "%s\n" "$LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 printf "%s\n" "$ac_ct_LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 printf "%s\n" "$OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 printf "%s\n" "$ac_ct_OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 printf "%s\n" "$OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 printf "%s\n" "$ac_ct_OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 printf %s "checking for -single_module linker flag... " >&6; } if test ${lt_cv_apple_cc_single_mod+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_ld_exported_symbols_list=yes else $as_nop lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 printf %s "checking for -force_load linker flag... " >&6; } if test ${lt_cv_ld_force_load+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cr libconftest.a conftest.o" >&5 $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[912]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes then : printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_shared=yes fi # Check whether --enable-static was given. if test ${enable_static+y} then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_static=yes fi # Check whether --with-pic was given. if test ${with_pic+y} then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop pic_mode=default fi # Check whether --enable-fast-install was given. if test ${enable_fast_install+y} then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test ${with_aix_soname+y} then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else $as_nop if test ${lt_cv_with_aix_soname+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 printf %s "checking for objdir... " >&6; } if test ${lt_cv_objdir+y} then : printf %s "(cached) " >&6 else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 printf %s "checking for ${ac_tool_prefix}file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 printf %s "checking for file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test ${lt_cv_prog_compiler_rtti_exceptions+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test ${lt_cv_prog_compiler_pic_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 printf %s "checking if $CC understands -b... " >&6; } if test ${lt_cv_prog_compiler__b+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_irix_exported_symbol=yes else $as_nop lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes then : lt_cv_dlopen=shl_load else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char shl_load (); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes then : lt_cv_dlopen=dlopen else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 printf %s "checking for dlopen in -lsvld... " >&6; } if test ${ac_cv_lib_svld_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_svld_dlopen=yes else $as_nop ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 printf %s "checking for dld_link in -ldld... " >&6; } if test ${ac_cv_lib_dld_dld_link+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dld_link (); int main (void) { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_dld_link=yes else $as_nop ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 printf %s "checking whether a program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 printf %s "checking whether a statically linked program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self_static+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi # Report what library types will actually be built { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 printf %s "checking if libtool supports shared libraries... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 printf "%s\n" "$can_build_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 printf "%s\n" "$enable_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 printf "%s\n" "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: # ------------------------------------------------------------------------ # AddressSanitizer # ------------------------------------------------------------------------ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AddressSanitizer support" >&5 printf %s "checking for AddressSanitizer support... " >&6; } # Check whether --with-asan was given. if test ${with_asan+y} then : withval=$with_asan; if test "x$withval" = "xno" ; then use_asan=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test "x$withval" = "xyes" ; then use_asan=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi else $as_nop use_asan=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test "$use_asan" = "1"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=address" >&5 printf %s "checking whether C compiler accepts -fsanitize=address... " >&6; } if test ${ax_cv_check_cflags___fsanitize_address+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=address" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_address=yes else $as_nop ax_cv_check_cflags___fsanitize_address=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_address" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_address" >&6; } if test "x$ax_cv_check_cflags___fsanitize_address" = xyes then : CFLAGS="$CFLAGS -fsanitize=address" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-omit-frame-pointer" >&5 printf %s "checking whether C compiler accepts -fno-omit-frame-pointer... " >&6; } if test ${ax_cv_check_cflags___fno_omit_frame_pointer+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fno-omit-frame-pointer" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fno_omit_frame_pointer=yes else $as_nop ax_cv_check_cflags___fno_omit_frame_pointer=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fno_omit_frame_pointer" >&5 printf "%s\n" "$ax_cv_check_cflags___fno_omit_frame_pointer" >&6; } if test "x$ax_cv_check_cflags___fno_omit_frame_pointer" = xyes then : CFLAGS="$CFLAGS -fno-omit-frame-pointer" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=bool" >&5 printf %s "checking whether C compiler accepts -fsanitize=bool... " >&6; } if test ${ax_cv_check_cflags___fsanitize_bool+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=bool" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_bool=yes else $as_nop ax_cv_check_cflags___fsanitize_bool=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_bool" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_bool" >&6; } if test "x$ax_cv_check_cflags___fsanitize_bool" = xyes then : CFLAGS="$CFLAGS -fsanitize=bool" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=enum" >&5 printf %s "checking whether C compiler accepts -fsanitize=enum... " >&6; } if test ${ax_cv_check_cflags___fsanitize_enum+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=enum" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_enum=yes else $as_nop ax_cv_check_cflags___fsanitize_enum=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_enum" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_enum" >&6; } if test "x$ax_cv_check_cflags___fsanitize_enum" = xyes then : CFLAGS="$CFLAGS -fsanitize=enum" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=float-divide-by-zero" >&5 printf %s "checking whether C compiler accepts -fsanitize=float-divide-by-zero... " >&6; } if test ${ax_cv_check_cflags___fsanitize_float_divide_by_zero+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_float_divide_by_zero=yes else $as_nop ax_cv_check_cflags___fsanitize_float_divide_by_zero=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_float_divide_by_zero" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_float_divide_by_zero" >&6; } if test "x$ax_cv_check_cflags___fsanitize_float_divide_by_zero" = xyes then : CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize-address-use-after-scope" >&5 printf %s "checking whether C compiler accepts -fsanitize-address-use-after-scope... " >&6; } if test ${ax_cv_check_cflags___fsanitize_address_use_after_scope+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize-address-use-after-scope" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_address_use_after_scope=yes else $as_nop ax_cv_check_cflags___fsanitize_address_use_after_scope=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_address_use_after_scope" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_address_use_after_scope" >&6; } if test "x$ax_cv_check_cflags___fsanitize_address_use_after_scope" = xyes then : CFLAGS="$CFLAGS -fsanitize-address-use-after-scope" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=signed-integer-overflow" >&5 printf %s "checking whether C compiler accepts -fsanitize=signed-integer-overflow... " >&6; } if test ${ax_cv_check_cflags___fsanitize_signed_integer_overflow+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_signed_integer_overflow=yes else $as_nop ax_cv_check_cflags___fsanitize_signed_integer_overflow=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_signed_integer_overflow" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_signed_integer_overflow" >&6; } if test "x$ax_cv_check_cflags___fsanitize_signed_integer_overflow" = xyes then : CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=vla-bound" >&5 printf %s "checking whether C compiler accepts -fsanitize=vla-bound... " >&6; } if test ${ax_cv_check_cflags___fsanitize_vla_bound+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=vla-bound" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_vla_bound=yes else $as_nop ax_cv_check_cflags___fsanitize_vla_bound=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_vla_bound" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_vla_bound" >&6; } if test "x$ax_cv_check_cflags___fsanitize_vla_bound" = xyes then : CFLAGS="$CFLAGS -fsanitize=vla-bound" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=bounds-strict" >&5 printf %s "checking whether C compiler accepts -fsanitize=bounds-strict... " >&6; } if test ${ax_cv_check_cflags___fsanitize_bounds_strict+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=bounds-strict" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_bounds_strict=yes else $as_nop ax_cv_check_cflags___fsanitize_bounds_strict=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_bounds_strict" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_bounds_strict" >&6; } if test "x$ax_cv_check_cflags___fsanitize_bounds_strict" = xyes then : CFLAGS="$CFLAGS -fsanitize=bounds-strict" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=null" >&5 printf %s "checking whether C compiler accepts -fsanitize=null... " >&6; } if test ${ax_cv_check_cflags___fsanitize_null+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_null=yes else $as_nop ax_cv_check_cflags___fsanitize_null=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_null" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_null" >&6; } if test "x$ax_cv_check_cflags___fsanitize_null" = xyes then : CFLAGS="$CFLAGS -fsanitize=null " else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=object-size" >&5 printf %s "checking whether C compiler accepts -fsanitize=object-size... " >&6; } if test ${ax_cv_check_cflags___fsanitize_object_size+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=object-size" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_object_size=yes else $as_nop ax_cv_check_cflags___fsanitize_object_size=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_object_size" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_object_size" >&6; } if test "x$ax_cv_check_cflags___fsanitize_object_size" = xyes then : CFLAGS="$CFLAGS -fsanitize=object-size" else $as_nop : fi fi # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- UNIT_TEST="test" # Check whether --enable-optimized was given. if test ${enable_optimized+y} then : enableval=$enable_optimized; if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g[^ ]*//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -O3 -DNDEBUG" OPTIMIZED=1 UNIT_TEST="" else OPTIMIZED=0 fi else $as_nop OPTIMIZED=0 fi # Check whether --enable-profiling was given. if test ${enable_profiling+y} then : enableval=$enable_profiling; if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g.//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -g -pg -fprofile-arcs -ftest-coverage" profile="true" fi else $as_nop profile="false" fi # Check whether --with-zlib was given. if test ${with_zlib+y} then : withval=$with_zlib; if test "x$withval" = "xyes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 printf %s "checking for zlibVersion in -lz... " >&6; } if test ${ac_cv_lib_z_zlibVersion+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char zlibVersion (); int main (void) { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_z_zlibVersion=yes else $as_nop ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 printf "%s\n" "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes then : printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h LIBS="-lz $LIBS" else $as_nop zlib="false" as_fn_error $? "libz not found" "$LINENO" 5 fi ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes then : printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h fi elif test "x$withval" != "xno"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib in $withval" >&5 printf %s "checking for zlib in $withval... " >&6; } LDFLAGS="-L$withval/lib -lz $LDFLAGS " CFLAGS="-I$withval/include $CFLAGS" if test -r "$withval/lib/libz.a" -a -r "$withval/include/zlib.h"; then printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } else zlib="false" as_fn_error $? "zlib not found in $withval" "$LINENO" 5 fi else zlib="false" fi else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 printf %s "checking for zlibVersion in -lz... " >&6; } if test ${ac_cv_lib_z_zlibVersion+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char zlibVersion (); int main (void) { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_z_zlibVersion=yes else $as_nop ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 printf "%s\n" "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes then : printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h LIBS="-lz $LIBS" else $as_nop zlib="false" as_fn_error $? "libz not found" "$LINENO" 5 fi ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes then : printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h fi fi # --------------------------------------------------------------------------- # Libraries # --------------------------------------------------------------------------- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 printf %s "checking for pthread_create in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_create+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_create (); int main (void) { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_create=yes else $as_nop ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes then : printf "%s\n" "#define HAVE_LIBPTHREAD 1" >>confdefs.h LIBS="-lpthread $LIBS" else $as_nop as_fn_error $? "POSIX thread library is required" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for round in -lm" >&5 printf %s "checking for round in -lm... " >&6; } if test ${ac_cv_lib_m_round+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char round (); int main (void) { return round (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_round=yes else $as_nop ac_cv_lib_m_round=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_round" >&5 printf "%s\n" "$ac_cv_lib_m_round" >&6; } if test "x$ac_cv_lib_m_round" = xyes then : printf "%s\n" "#define HAVE_LIBM 1" >>confdefs.h LIBS="-lm $LIBS" else $as_nop as_fn_error $? "Math library is required" "$LINENO" 5 fi # --------------------------------------------------------------------------- # Header files # --------------------------------------------------------------------------- ac_fn_c_check_header_compile "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" if test "x$ac_cv_header_ctype_h" = xyes then : printf "%s\n" "#define HAVE_CTYPE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes then : printf "%s\n" "#define HAVE_ERRNO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default" if test "x$ac_cv_header_execinfo_h" = xyes then : printf "%s\n" "#define HAVE_EXECINFO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes then : printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "$ac_includes_default" if test "x$ac_cv_header_ifaddrs_h" = xyes then : printf "%s\n" "#define HAVE_IFADDRS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "kstat.h" "ac_cv_header_kstat_h" "$ac_includes_default" if test "x$ac_cv_header_kstat_h" = xyes then : printf "%s\n" "#define HAVE_KSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes then : printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/if_dl.h" "ac_cv_header_net_if_dl_h" "$ac_includes_default" if test "x$ac_cv_header_net_if_dl_h" = xyes then : printf "%s\n" "#define HAVE_NET_IF_DL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/if_media.h" "ac_cv_header_net_if_media_h" "$ac_includes_default" if test "x$ac_cv_header_net_if_media_h" = xyes then : printf "%s\n" "#define HAVE_NET_IF_MEDIA_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" if test "x$ac_cv_header_poll_h" = xyes then : printf "%s\n" "#define HAVE_POLL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "setjmp.h" "ac_cv_header_setjmp_h" "$ac_includes_default" if test "x$ac_cv_header_setjmp_h" = xyes then : printf "%s\n" "#define HAVE_SETJMP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" if test "x$ac_cv_header_signal_h" = xyes then : printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" if test "x$ac_cv_header_stdarg_h" = xyes then : printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" if test "x$ac_cv_header_stdio_h" = xyes then : printf "%s\n" "#define HAVE_STDIO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes then : printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" if test "x$ac_cv_header_strings_h" = xyes then : printf "%s\n" "#define HAVE_STRINGS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stropts.h" "ac_cv_header_stropts_h" "$ac_includes_default" if test "x$ac_cv_header_stropts_h" = xyes then : printf "%s\n" "#define HAVE_STROPTS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/dirent.h" "ac_cv_header_sys_dirent_h" "$ac_includes_default" if test "x$ac_cv_header_sys_dirent_h" = xyes then : printf "%s\n" "#define HAVE_SYS_DIRENT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default" if test "x$ac_cv_header_sys_event_h" = xyes then : printf "%s\n" "#define HAVE_SYS_EVENT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_filio_h" = xyes then : printf "%s\n" "#define HAVE_SYS_FILIO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ioctl_h" = xyes then : printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default" if test "x$ac_cv_header_sys_poll_h" = xyes then : printf "%s\n" "#define HAVE_SYS_POLL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/protosw.h" "ac_cv_header_sys_protosw_h" "$ac_includes_default" if test "x$ac_cv_header_sys_protosw_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PROTOSW_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/random.h" "ac_cv_header_sys_random_h" "$ac_includes_default" if test "x$ac_cv_header_sys_random_h" = xyes then : printf "%s\n" "#define HAVE_SYS_RANDOM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/sendfile.h" "ac_cv_header_sys_sendfile_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sendfile_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SENDFILE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysctl_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes then : printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "usersec.h" "ac_cv_header_usersec_h" "$ac_includes_default" if test "x$ac_cv_header_usersec_h" = xyes then : printf "%s\n" "#define HAVE_USERSEC_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IP_H #include #endif " if test "x$ac_cv_header_net_if_h" = xyes then : printf "%s\n" "#define HAVE_NET_IF_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/route.h" "ac_cv_header_net_route_h" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IP_H #include #endif " if test "x$ac_cv_header_net_route_h" = xyes then : printf "%s\n" "#define HAVE_NET_ROUTE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "libperfstat.h" "ac_cv_header_libperfstat_h" " #ifdef HAVE_SYS_PROTOSW_H #include #endif " if test "x$ac_cv_header_libperfstat_h" = xyes then : printf "%s\n" "#define HAVE_LIBPERFSTAT_H 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Types # ------------------------------------------------------------------------ ac_fn_c_check_type "$LINENO" "uchar_t" "ac_cv_type_uchar_t" "$ac_includes_default" if test "x$ac_cv_type_uchar_t" = xyes then : printf "%s\n" "#define HAVE_UCHAR_T 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Require a working sigsetjmp { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" # This test program should *not* compile successfully. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { (void) strchr; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the # off chance that they somehow elicit warnings. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include extern void ac_decl (int, char *); int main (void) { (void) ac_decl (0, (char *) 0); (void) ac_decl; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' else $as_nop ac_cv_c_undeclared_builtin_options=$ac_arg fi break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins See \`config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; esac ac_fn_check_decl "$LINENO" "sigsetjmp" "ac_cv_have_decl_sigsetjmp" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_sigsetjmp" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_SIGSETJMP $ac_have_decl" >>confdefs.h if test $ac_have_decl = 1 then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "sigsetjmp is required See \`config.log' for more details" "$LINENO" 5; } fi # Require that we have vsnprintf that conforms to c99. I.e. does bounds check ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" if test "x$ac_cv_func_vsnprintf" = xyes then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "vsnprintf is required See \`config.log' for more details" "$LINENO" 5; } fi ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" if test "x$ac_cv_func_timegm" = xyes then : printf "%s\n" "#define HAVE_TIMEGM 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "getgrouplist" "ac_cv_func_getgrouplist" if test "x$ac_cv_func_getgrouplist" = xyes then : printf "%s\n" "#define HAVE_GETGROUPLIST 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "getrandom" "ac_cv_func_getrandom" if test "x$ac_cv_func_getrandom" = xyes then : printf "%s\n" "#define HAVE_GETRANDOM 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "arc4random_buf" "ac_cv_func_arc4random_buf" if test "x$ac_cv_func_arc4random_buf" = xyes then : printf "%s\n" "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" if test "x$ac_cv_func_clock_gettime" = xyes then : printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Architecture/OS # ------------------------------------------------------------------------ architecture=`uname` if test "$architecture" = "Linux" then CFLAGS="$CFLAGS -D _REENTRANT" LDFLAGS="$LDFLAGS -lrt" printf "%s\n" "#define LINUX 1" >>confdefs.h elif test "$architecture" = "FreeBSD" then CFLAGS="$CFLAGS -D _REENTRANT" printf "%s\n" "#define FREEBSD 1" >>confdefs.h elif test "$architecture" = "GNU/kFreeBSD" then CFLAGS="$CFLAGS -D _REENTRANT" printf "%s\n" "#define FREEBSD 1" >>confdefs.h elif test "$architecture" = "OpenBSD" then CFLAGS="$CFLAGS -D _REENTRANT" printf "%s\n" "#define OPENBSD 1" >>confdefs.h elif test "$architecture" = "DragonFly" then CFLAGS="$CFLAGS -D _REENTRANT" printf "%s\n" "#define DRAGONFLY 1" >>confdefs.h elif test "$architecture" = "Darwin" then CFLAGS="$CFLAGS -DREENTRANT" printf "%s\n" "#define DARWIN 1" >>confdefs.h elif test "$architecture" = "SunOS" then LIBS="$LIBS -lsocket -lnsl -lkstat" CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64" LDFLAGS="$LDFLAGS -m64" if test `uname -m` != "i86pc" then CFLAGS="$CFLAGS -mtune=v9" LDFLAGS="$LDFLAGS -mtune=v9" fi printf "%s\n" "#define SOLARIS 1" >>confdefs.h elif test "$architecture" = "NetBSD" then CFLAGS="$CFLAGS -D_REENTRANT -Wno-char-subscripts" printf "%s\n" "#define NETBSD 1" >>confdefs.h elif test "$architecture" = "AIX" then CFLAGS=`echo $CFLAGS|sed 's/-g//'` CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" printf "%s\n" "#define AIX 1" >>confdefs.h LIBS="$LIBS -lcfg -lodm -lperfstat" else as_fn_error $? "Architecture not supported: ${architecture}" "$LINENO" 5 fi # --------------------------------------------------------------------------- # Compiler # --------------------------------------------------------------------------- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else $as_nop 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 /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_98+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CXX_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 printf %s "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test ${ac_cv_prog_CXXCPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CXX needs to be expanded for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 printf "%s\n" "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if test ${lt_cv_prog_compiler_pic_works_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc_CXX+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 printf "%s\n" "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_const=yes else $as_nop ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then printf "%s\n" "#define const /**/" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 printf %s "checking whether byte ordering is bigendian... " >&6; } if test ${ac_cv_c_bigendian+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_bigendian=no else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac # Define _GNU_SOURCE so we can have Posix headers etc included. We use the # -std=cXX compiler switch which only include a minimum of C headers CFLAGS="$CFLAGS -D_GNU_SOURCE" # Compiler; tune warnings CFLAGS="$CFLAGS -Wall -Wunused " # Require at least C99 and use C11 if available if ac_fn_c_compute_int "$LINENO" "__STDC_VERSION__" "STDC_VERSION" "" then : else $as_nop STDC_VERSION=0 fi if test "$STDC_VERSION" -ge 201112 then : CFLAGS="$CFLAGS -std=c11" else $as_nop CFLAGS="$CFLAGS -std=c99" fi for ac_header in stdint.h stdbool.h do : as_ac_Header=`printf "%s\n" "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 `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else $as_nop as_fn_error $? "toolchain does not have C99 headers" "$LINENO" 5 fi done # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ # Check whether --with-ipv6 was given. if test ${with_ipv6+y} then : withval=$with_ipv6; if test "x$withval" = "xno" then with_ipv6=0 elif test "x$withval" = "xyes" then with_ipv6=1 printf "%s\n" "#define HAVE_IPV6 1" >>confdefs.h fi else $as_nop # Note inverse test. Check by default { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IPv6 support" >&5 printf %s "checking for IPv6 support... " >&6; } if test ${ac_cv_ipv6+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_ipv6=no else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Make sure the definitions for AF_INET6 and struct sockaddr_in6 * are defined, and that we can actually create an IPv6 TCP socket.*/ int main(void) { int fd; struct sockaddr_in6 foo; fd = socket(AF_INET6, SOCK_STREAM, 0); exit(fd >= 0 ? 0 : 1); } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_ipv6=yes else $as_nop ac_cv_ipv6=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ipv6" >&5 printf "%s\n" "$ac_cv_ipv6" >&6; } if test $ac_cv_ipv6 = yes then with_ipv6=1 printf "%s\n" "#define HAVE_IPV6 1" >>confdefs.h else with_ipv6=0 fi fi # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- # Determine the minimum macOS version we can build if [ $(uname) == "Darwin" ]; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for minimum macOS version supported" >&5 printf %s "checking for minimum macOS version supported... " >&6; } # Create a simple C program echo "int main() { return 0; }" > t.c # Try to compile it with the specified macOS version $CC -mmacosx-version-min=10.15 -o t t.c || as_fn_error $? "Could not compile test program" "$LINENO" 5 # Extract the minos value using otool min_macos_version=$(otool -l t | egrep minos | awk '{print $2}') # Clean up the test files rm -f t.c t # Check if min_macos_version is set if test -z "$min_macos_version"; then as_fn_error $? "Could not determine minimum macOS version" "$LINENO" 5 else # Set CFLAGS with the determined minimum macOS version CFLAGS="$CFLAGS -mmacosx-version-min=$min_macos_version" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $min_macos_version" >&5 printf "%s\n" "$min_macos_version" >&6; } fi fi # --------------------------------------------------------------------------- # Outputs # --------------------------------------------------------------------------- ac_config_headers="$ac_config_headers src/xconfig.h" ac_config_files="$ac_config_files Makefile test/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `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" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= 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 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 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 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 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # 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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$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_nop 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_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$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 || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libmonit $as_me 1.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ libmonit config.status 1.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "src/xconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS src/xconfig.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$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 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cat < Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. 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 them 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. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . License Exception In addition, as a special exception, The copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. monit-5.35.2/libmonit/aclocal.m40000644000016400001720000012301415007061162013324 00000000000000# generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, [m4_warning([this file was generated for autoconf 2.71. 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'.])]) # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # 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". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([config/ax_check_compile_flag.m4]) monit-5.35.2/libmonit/src/0000755000016400001720000000000015007061177012340 500000000000000monit-5.35.2/libmonit/src/thread/0000755000016400001720000000000015007061157013605 500000000000000monit-5.35.2/libmonit/src/thread/Thread.h0000644000016400001720000003013515007061157015107 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef THREAD_INCLUDED #define THREAD_INCLUDED #include #include #include #include #include #include #include "system/System.h" /** * General purpose Thread abstractions. This interface defines object * types and methods for handling threads, synchronization and semaphores. * * @author https://tildeslash.com * @see https://mmonit.com * @file */ /** @cond hidden */ #define __trapper(F) do { \ int status = (F); if (! (status == 0 || status==ETIMEDOUT)) \ THROW(AssertException, "%s -- %s", #F, System_getError(status)); \ } while (0) /** @endcond */ /** @name Abstract Data Types */ //@{ /** * Thread object type * @hideinitializer */ #define Thread_T pthread_t /** * Semaphore object type * @hideinitializer */ #define Sem_T pthread_cond_t /** * Mutex object type * @hideinitializer */ #define Mutex_T pthread_mutex_t /** * Read/Write Lock object type * @hideinitializer */ #define Lock_T pthread_rwlock_t /** * Thread Data object type * @hideinitializer */ #define ThreadData_T pthread_key_t //@} /** @name Thread methods */ //@{ /** * Create a new thread * @param thread The thread to create * @param threadFunc The thread routine to execute * @param threadArgs Arguments to threadFunc * @exception AssertException If thread creation failed * @hideinitializer */ #define Thread_create(thread, threadFunc, threadArgs) \ __trapper(pthread_create(&thread, NULL, threadFunc, (void*)threadArgs)) /** * Returns the thread ID of the calling thread * @return The id of the calling thread * @hideinitializer */ #define Thread_self() pthread_self() /** * Detach a thread * @param thread The thread to detach * @exception AssertException If detaching the thread failed * @hideinitializer */ #define Thread_detach(thread) __trapper(pthread_detach(thread)) /** * Cancel execution of a thread * @param thread The thread to cancel * @exception AssertException If thread cancellation failed * @hideinitializer */ #define Thread_cancel(thread) __trapper(pthread_cancel(thread)) /** * Wait for thread termination * @param thread The thread to wait for * @exception AssertException If thread join failed * @hideinitializer */ #define Thread_join(thread) __trapper(pthread_join(thread, NULL)) //@} /** @name Semaphore methods */ //@{ /** * Initialize a new semaphore * @param sem The semaphore to initialize * @exception AssertException If initialization failed * @hideinitializer */ #define Sem_init(sem) __trapper(pthread_cond_init(&sem, NULL)) /** * Wait on a semaphore * @param sem The semaphore to wait on * @param mutex A mutex to unlock on wait * @exception AssertException If wait failed * @hideinitializer */ #define Sem_wait(sem, mutex) __trapper(pthread_cond_wait(&sem, &(mutex))) /** * Unblock a thread waiting for a semaphore * @param sem The semaphore to signal * @exception AssertException If signal failed * @hideinitializer */ #define Sem_signal(sem) __trapper(pthread_cond_signal(&sem)) /** * Unblock all threads waiting for a semaphore * @param sem The semaphore to broadcast * @exception AssertException If broadcast failed * @hideinitializer */ #define Sem_broadcast(sem) __trapper(pthread_cond_broadcast(&sem)) /** * Destroy a semaphore * @param sem The semaphore to destroy * @exception AssertException If destroy failed * @hideinitializer */ #define Sem_destroy(sem) __trapper(pthread_cond_destroy(&sem)) /** * Wait on a semaphore for a specific amount of time. During the wait * the mutex is unlocked and reacquired afterwards * @param sem The semaphore to wait on * @param mutex A mutex to unlock on wait * @param time time to wait * @exception AssertException If the timed wait failed * @hideinitializer */ #define Sem_timeWait(sem, mutex, time) \ __trapper(pthread_cond_timedwait(&sem, &(mutex), &time)) //@} /** @name Mutex methods */ //@{ /** * Initialize a new mutex * @param mutex The mutex to initialize * @exception AssertException If initialization failed * @hideinitializer */ #define Mutex_init(mutex) __trapper(pthread_mutex_init(&(mutex), NULL)) /** * Destroy a the given mutex * @param mutex The mutex to destroy * @exception AssertException If destroy failed * @hideinitializer */ #define Mutex_destroy(mutex) __trapper(pthread_mutex_destroy(&(mutex))) /** * Locks a mutex * @param mutex The mutex to lock * @exception AssertException If mutex lock failed * @hideinitializer */ #define Mutex_lock(mutex) __trapper(pthread_mutex_lock(&(mutex))) /** * Unlocks a mutex * @param mutex The mutex to unlock * @exception AssertException If mutex unlock failed * @hideinitializer */ #define Mutex_unlock(mutex) __trapper(pthread_mutex_unlock(&(mutex))) /** * Defines a block of code to execute after the given mutex is locked * @param mutex The mutex to lock * @hideinitializer */ #define LOCK(mutex) do { Mutex_T *_yymutex=&(mutex); int _yystatus=pthread_mutex_lock(_yymutex); assert(_yystatus==0); /** * Ends a LOCK block * @hideinitializer */ #define END_LOCK _yystatus=pthread_mutex_unlock(_yymutex); assert(_yystatus==0); } while (0) //@} /** @name Read/Write Lock methods */ //@{ /** * Initialize a new read/write lock * @param lock The lock to initialize * @exception AssertException If initialization failed * @hideinitializer */ #define Lock_init(lock) __trapper(pthread_rwlock_init(&(lock), NULL)) /** * Destroy a read/write lock * @param lock The lock to destroy * @exception AssertException If destroy failed * @hideinitializer */ #define Lock_destroy(lock) __trapper(pthread_rwlock_destroy(&(lock))) /** * Acquire a read/write lock for reading * @param lock A read/write lock * @exception AssertException If failed * @hideinitializer */ #define Lock_read(lock) __trapper(pthread_rwlock_rdlock(&(lock))) /** * Acquire a read/write lock for writing * @param lock A read/write lock * @exception AssertException If failed * @hideinitializer */ #define Lock_write(lock) __trapper(pthread_rwlock_wrlock(&(lock))) /** * Release a read/write lock * @param lock A read/write lock * @exception AssertException If failed * @hideinitializer */ #define Lock_unlock(lock) __trapper(pthread_rwlock_unlock(&(lock))) /** * Defines a block of code to execute after the given read locked is acquired * @param lock The read lock * @hideinitializer */ #define RLOCK(lock) do { Lock_T *_yyrlock=&(lock); int _yystatus=pthread_rwlock_rdlock(_yyrlock); assert(_yystatus==0); /** * Ends a RLOCK block * @hideinitializer */ #define END_RLOCK _yystatus=pthread_rwlock_unlock(_yyrlock); assert(_yystatus==0);} while (0) /** * Defines a block of code to execute after the given write locked is acquired * @param lock The write lock * @hideinitializer */ #define WLOCK(lock) do { Lock_T *_yywlock=&(lock); int _yystatus=pthread_rwlock_wrlock(_yywlock); assert(_yystatus==0); /** * Ends a RLOCK block * @hideinitializer */ #define END_WLOCK _yystatus=pthread_rwlock_unlock(_yywlock); assert(_yystatus==0); } while (0) //@} /** @name Thread data methods */ //@{ /** * Creates a thread-specific data key. * @param key The ThreadData_T key to create * @exception AssertException If thread data creation failed * @hideinitializer */ #define ThreadData_create(key) __trapper(pthread_key_create(&(key), NULL)) /** * Sets a thread-specific data value. The key is of type ThreadData_T * @param key The ThreadData_T key to set a new value for * @param value The value for key * @exception AssertException If setting thread data failed * @hideinitializer */ #define ThreadData_set(key, value) __trapper(pthread_setspecific((key), (value))) /** * Gets a thread-specific data value * @param key The ThreadData_T key * @return value of key or NULL of no value was set for the key * @hideinitializer */ #define ThreadData_get(key) pthread_getspecific((key)) //@} /** @name Atomic Thread */ //@{ /** * An Atomic Thread object encapsulates a thread, along with synchronization * primitives and thread-specific data. It is designed to facilitate thread * creation, synchronization, and cleanup in a thread-safe manner. * * An Atomic Thread should be initialized using `AtomicThread_init`. This * ensure that the synchronization primitives `sem` and `mutex` are initialized * before the thread is created and that the threads active state is false. * * Use `AtomicThread_createDetached` or `AtomicThread_create` to create the * thread. You can reuse the same AtomicThread_T variable to call these methods * to restart the thread if needed. Use `AtomicThread_isActive` to test * if the thread is active/running. Finally, use `AtomicThread_destroy` * to destroy the semaphore and mutex in a deterministic manner. * @hideinitializer */ typedef struct { Sem_T sem; Mutex_T mutex; Thread_T value; _Atomic(bool) active; void *threadArgs; void *(*threadFunc)(void *threadArgs); } AtomicThread_T; //@} // ------------------------------------------------------------- Public Methods /** * Initialize Threads. This method should be called at program startup */ void Thread_init(void); /** * Create a new thread in a detached state * @param thread The thread to create * @param threadFunc The thread routine to execute * @param threadArgs Arguments to threadFunc * @exception AssertException If thread creation failed */ void Thread_createDetached(Thread_T *thread, void *(*threadFunc)(void *threadArgs), void *threadArgs); // -------------------------------------------------------------- Atomic Thread /** * Initialize an Atomic Thread object. * This function initializes the synchronization primitives (`sem` and `mutex`) * and sets the `active` flag to false. It must be called before creating the * thread using `Thread_createAtomic` or `Thread_createAtomicDetached`. * @param thread A pointer to the Atomic Thread object to initialize * @exception AssertException If `thread` is NULL */ void AtomicThread_init(AtomicThread_T *thread); /** * Create a new Atomic Thread * @param thread The Atomic thread to create * @param threadFunc The thread routine to execute * @param threadArgs Arguments to threadFunc * @exception AssertException If thread creation failed or if the thread has * not been initialized using `AtomicThread_init` */ void AtomicThread_create(AtomicThread_T *thread, void *(*threadFunc)(void *threadArgs), void *threadArgs); /** * Create a new Atomic Thread in a detached state * @param thread The Atomic thread to create * @param threadFunc The thread routine to execute * @param threadArgs Arguments to threadFunc * @exception AssertException If thread creation failed or if the thread has * not been initialized using` AtomicThread_init` */ void AtomicThread_createDetached(AtomicThread_T *thread, void *(*threadFunc)(void *threadArgs), void *threadArgs); /** * Returns true if the Atomic Thread is active/running * @param thread An Atomic thread * @return True if thread is active, otherwise false */ bool AtomicThread_isActive(AtomicThread_T *thread); /** * Destroy the synchronization primitives in the Atomic Thread * @param thread An Atomic thread */ void AtomicThread_destroy(AtomicThread_T *thread); #endif monit-5.35.2/libmonit/src/thread/Thread.c0000644000016400001720000001044115007061157015100 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include "system/System.h" #include "Thread.h" /** * Implementation of the Thread.h interface * * @author https://tildeslash.com * @see https://mmonit.com * @file */ /* ----------------------------------------------------------- Definitions */ static pthread_attr_t myDetachStateAttribute; static pthread_once_t once_control = PTHREAD_ONCE_INIT; /* --------------------------------------------------------------- Private */ /* Called at program termination for cleanup */ static void _fini(void) { pthread_attr_destroy(&myDetachStateAttribute); } /* Setup common thread attribute */ static void _once(void) { int status = pthread_attr_init(&myDetachStateAttribute); if (status != 0) THROW(AssertException, "pthread_attr_init -- %s", System_getError(status)); status = pthread_attr_setdetachstate(&myDetachStateAttribute, PTHREAD_CREATE_DETACHED); if (status != 0) { pthread_attr_destroy(&myDetachStateAttribute); THROW(AssertException, "pthread_attr_setdetachstate -- %s", System_getError(status)); } atexit(_fini); } // Automatically set active state to false on thread exit static void *_atomicWrapper(void *arg) { AtomicThread_T *thread = (AtomicThread_T *)arg; atomic_store(&thread->active, true); thread->threadFunc(thread->threadArgs); atomic_store(&thread->active, false); return NULL; } /* ----------------------------------------------------- Protected Methods */ // Called from Bootstrap() void Thread_init(void) { pthread_once(&once_control, _once); } /* ---------------------------------------------------------------- Public */ void Thread_createDetached(Thread_T *thread, void *(*threadFunc)(void *threadArgs), void *threadArgs) { assert(thread); assert(threadFunc); int status = pthread_create(thread, &myDetachStateAttribute, threadFunc, threadArgs); if (status != 0) THROW(AssertException, "pthread_create -- %s", System_getError(status)); } void AtomicThread_init(AtomicThread_T *thread) { assert(thread); Sem_init(thread->sem); Mutex_init(thread->mutex); atomic_store(&thread->active, false); } void AtomicThread_create(AtomicThread_T *thread, void *(*threadFunc)(void *threadArgs), void *threadArgs) { assert(thread); assert(threadFunc); assert(atomic_load(&thread->active) == false); thread->threadFunc = threadFunc; thread->threadArgs = threadArgs; Thread_create(thread->value, _atomicWrapper, thread); } void AtomicThread_createDetached(AtomicThread_T *thread, void *(*threadFunc)(void *threadArgs), void *threadArgs) { assert(thread); assert(threadFunc); assert(atomic_load(&thread->active) == false); thread->threadFunc = threadFunc; thread->threadArgs = threadArgs; Thread_createDetached(&thread->value, _atomicWrapper, thread); } bool AtomicThread_isActive(AtomicThread_T *thread) { assert(thread); return atomic_load(&thread->active); } void AtomicThread_destroy(AtomicThread_T *thread) { assert(thread); Sem_destroy(thread->sem); Mutex_destroy(thread->mutex); atomic_store(&thread->active, false); } monit-5.35.2/libmonit/src/xconfig.h.in0000644000016400001720000001433515007061162014473 00000000000000/* src/xconfig.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if the system is AIX */ #undef AIX /* Define to 1 if the system is OSX */ #undef DARWIN /* Define to 1 if the system is DragonFly */ #undef DRAGONFLY /* Define to 1 if the system is FreeBSD */ #undef FREEBSD /* Define to 1 if you have the `arc4random_buf' function. */ #undef HAVE_ARC4RANDOM_BUF /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define to 1 if you have the declaration of `sigsetjmp', and to 0 if you don't. */ #undef HAVE_DECL_SIGSETJMP /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `getgrouplist' function. */ #undef HAVE_GETGROUPLIST /* Define to 1 if you have the `getrandom' function. */ #undef HAVE_GETRANDOM /* Define to 1 if you have the header file. */ #undef HAVE_IFADDRS_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if the system supports IPv6 */ #undef HAVE_IPV6 /* Define to 1 if you have the header file. */ #undef HAVE_KSTAT_H /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the header file. */ #undef HAVE_LIBPERFSTAT_H /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_DL_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_MEDIA_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_ROUTE_H /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_SETJMP_H /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_EVENT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PROTOSW_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RANDOM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SENDFILE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the `timegm' function. */ #undef HAVE_TIMEGM /* Define to 1 if the system has the type `uchar_t'. */ #undef HAVE_UCHAR_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_USERSEC_H /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H /* Define to 1 if the system is Linux */ #undef LINUX /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if the system is NETBSD */ #undef NETBSD /* Define to 1 if the system is OpenBSD */ #undef OPENBSD /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* 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 /* Define to 1 if the system is SOLARIS */ #undef SOLARIS /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to empty if `const' does not conform to ANSI C. */ #undef const monit-5.35.2/libmonit/src/io/0000755000016400001720000000000015007061157012745 500000000000000monit-5.35.2/libmonit/src/io/InputStream.h0000644000016400001720000001176215007061157015320 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef INPUTSTREAM_INCLUDED #define INPUTSTREAM_INCLUDED #include /** * An InputStream can be used for reading text or binary * data (8 bits) from a descriptor. * * The method InputStream_isClosed() can be used to test the * underlying descriptor for an error, a read timeout or for EOF. * * Clients can use this stream in a non-blocking manner by setting * InputStream_setTimeout() to 0. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define T InputStream_T typedef struct T *T; /** * Create a new InputStream object. * @param descriptor The descriptor for this inputstream * @return An InputStream object */ T InputStream_new(int descriptor); /** * Destroy an InputStream object and release allocated resources. * Call this method to release an InputStream object allocated with * InputStream_new() * @param S An InputStream object reference */ void InputStream_free(T *S); /** @name Properties */ //@{ /** * Returns the underlying descriptor for this stream * @param S An InputStream object * @return The descriptor for this stream */ int InputStream_getDescriptor(T S); /** * Set a read timeout in milliseconds. During a read * operation the stream will wait up to timeout * milliseconds for data to become available if not already present. * @param S An InputStream object * @param timeout The timeout value in milliseconds * @exception AssertException if timeout is < 0 */ void InputStream_setTimeout(T S, time_t timeout); /** * Get the read timeout in milliseconds. * @param S An InputStream object * @return The timeout value in milliseconds */ time_t InputStream_getTimeout(T S); /** * Returns true if the underlying descriptor was closed. The stream is * closed if an I/O error occurs. * @param S An InputStream object * @return true if the descriptor was closed, otherwise false */ bool InputStream_isClosed(T S); /** * Returns the number of bytes in the InputStream's cache buffer. * I.e. bytes that are cached in the stream's internal buffer * @param S An InputStream object * @return Number of input bytes cached */ int InputStream_buffered(T S); //@} /** * Read a single byte. The byte is returned as an int in the range 0-255. * @param S An InputStream object * @return The byte read, or -1 if the end of the stream has been reached * If the stream uses non-blocking I/O, i.e. timeout is 0, then -1 is also * returned if a read would block, indicating that the caller should try again * later. */ int InputStream_read(T S); /** * Reads in at most one less than size characters and stores * them into the buffer pointed to by s. Reading stops after * an EOF, a newline or '\\0'. If a newline is read, it is stored into the buffer. * A '\\0' is stored after the last character in the buffer. * @param S An InputStream object * @param s A character buffer to store the string in * @param size The size of the string buffer s * @return s on success or NULL when end of file or an error occurs. * If the stream uses non-blocking I/O, i.e. timeout is 0, then NULL is also * returned if a read would block, indicating that the caller should try again * later. */ char *InputStream_readLine(T S, char *s, int size); /** * Reads size bytes and stores them into the byte buffer * pointed to by b. Reading stops when size bytes are read * or if no more data is available. The buffer is not NUL terminated. * @param S An InputStream object * @param b A Byte buffer * @param size The size of the buffer b * @return Number of bytes read, 0 when end of file or -1 if an error occurs. * If the stream uses non-blocking I/O, i.e. timeout is 0, then 0 is also * returned if a read would block, indicating that the caller should try again * later. */ int InputStream_readBytes(T S, void *b, int size); /** * Clears any data that exist in the buffer * @param S An InputStream object */ void InputStream_clear(T S); #undef T #endif monit-5.35.2/libmonit/src/io/Dir.h0000644000016400001720000000534715007061157013565 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef DIR_INCLUDED #define DIR_INCLUDED /** * A collection of class methods for operating on a dir * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** @name class methods */ //@{ /** * Creates the directory named by this absolute pathname. The optional * perm parameter specify the permission for the created * directory. If perm is 0 the directory is created with standard * permission as modified by the process umask. * @param dir An absolute directory path * @param perm An octal number specifying a permission bit pattern, e.g. 0775 * or 0 for the default. * @return true if success otherwise false, System_lastError() can be * used to get a description of the error that occurred * @see File_umask() */ bool Dir_mkdir(const char *dir, int perm); /** * Delete the directory named by this absolute pathname. This method * fails if the directory dir is not empty. * @param dir An absolute directory path * @return true if success otherwise false and System_lastError() can be * used to get a description of the error that occurred */ bool Dir_delete(const char *dir); /** * Changes the current working directory of the process to the given * path. * @param path An absolute directory path * @return true if success otherwise false and System_lastError() can be * used to get a description of the error that occurred */ bool Dir_chdir(const char *path); /** * Returns the current working directory of the process. * @param result A buffer to write the result to. * @param length The length of the result buffer * @return A pointer to the result buffer or NULL in case of error */ const char *Dir_cwd(char *result, int length); //@} #endif monit-5.35.2/libmonit/src/io/Dir.c0000644000016400001720000000462215007061157013553 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #include #include "system/System.h" #include "Str.h" #include "File.h" #include "Dir.h" /** * Implementation of the Dir interface * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ /* ---------------------------------------------------------------- Public */ /* ----------------------------------------------------------------- Class */ bool Dir_mkdir(const char *dir, int perm) { if (dir) { if (mkdir(dir, 0777) == 0) { if (perm != 0) File_chmod(dir, perm); return true; } } errno = EINVAL; return false; } bool Dir_delete(const char *dir) { if (dir) return File_delete(dir); errno = EINVAL; return false; } bool Dir_chdir(const char *path) { if (path) return (chdir(path)==0); errno = EINVAL; return false; } const char *Dir_cwd(char *result, int length) { if (result) return getcwd(result, length); errno = EINVAL; return result; } monit-5.35.2/libmonit/src/io/File.c0000644000016400001720000001736115007061157013720 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #include #include "Str.h" #include "system/System.h" #include "File.h" /** * Implementation of the File Facade for Unix systems. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ #define DEFAULT_PERM 0666 const char SEPARATOR_CHAR = '/'; const char *SEPARATOR = "/"; const char PATH_SEPARATOR_CHAR = ':'; const char *PATH_SEPARATOR = ":"; /* ---------------------------------------------------------------- Public */ int File_open(const char *file, const char *mode) { if (file && mode) { switch (mode[0]) { case 'r': switch (mode[1]) { case '+': return open(file, O_RDWR|O_NONBLOCK); default: return open(file, O_RDONLY|O_NONBLOCK); } case 'w': switch (mode[1]) { case '+': return open(file, O_CREAT|O_RDWR|O_TRUNC|O_NONBLOCK, DEFAULT_PERM); default: return open(file, O_CREAT|O_WRONLY|O_TRUNC|O_NONBLOCK, DEFAULT_PERM); } case 'a': switch (mode[1]) { case '+': return open(file, O_CREAT|O_RDWR|O_APPEND|O_NONBLOCK, DEFAULT_PERM); default: return open(file, O_CREAT|O_WRONLY|O_APPEND|O_NONBLOCK, DEFAULT_PERM); } } } errno = EINVAL; return -1; } bool File_close(int fd) { int r; do r = close(fd); while (r == -1 && errno == EINTR); return (r == 0); } bool File_rewind(int fd) { return (lseek(fd, 0, SEEK_SET) >=0); } time_t File_mtime(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) == 0) return buf.st_mtime; } return -1; } time_t File_ctime(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) == 0) return buf.st_ctime; } return -1; } time_t File_atime(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) == 0) return buf.st_atime; } return -1; } bool File_isFile(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0 && S_ISREG(buf.st_mode)); } return false; } bool File_isSocket(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0 && S_ISSOCK(buf.st_mode)); } return false; } bool File_isDirectory(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0 && S_ISDIR(buf.st_mode)); } return false; } bool File_exist(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0); } return false; } char File_type(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) == 0) switch ((buf.st_mode) & S_IFMT) { case S_IFREG: return 'r'; case S_IFDIR: return 'd'; case S_IFCHR: return 'c'; case S_IFBLK: return 'b'; case S_IFLNK: return 'l'; case S_IFIFO: return 'p'; case S_IFSOCK: return 's'; default: return '?'; } } return '?'; } off_t File_size(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) < 0) return -1; return buf.st_size; } return -1; } bool File_chmod(const char *file, mode_t mode) { if (file) return (chmod(file, mode) == 0); errno = EINVAL; return false; } int File_mod(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) == 0) return buf.st_mode; } return -1; } int File_umask(void) { mode_t omask = umask(0); umask(omask); return omask; } mode_t File_setUmask(mode_t mask) { mode_t omask = umask(mask); return omask; } bool File_isReadable(const char *file) { if (file) return (access(file, R_OK) == 0); return false; } bool File_isWritable(const char *file) { if (file) return (access(file, W_OK) == 0); return false; } bool File_isExecutable(const char *file) { if (file) return (access(file, X_OK) == 0); return false; } bool File_delete(const char *file) { if (file) return (remove(file) == 0); errno = ENOENT; return false; } bool File_rename(const char *file, const char *name) { if (file) return (rename(file, name) == 0); errno = ENOENT; return false; } const char *File_basename(const char *path) { if ((STR_DEF(path))) { char *f = strrchr(path, SEPARATOR_CHAR); return (f ? ++f : path); } return path; } char *File_dirname(char *path) { if ((STR_DEF(path))) { char *d = strrchr(path, SEPARATOR_CHAR); if (d) *(d + 1) = 0; /* Keep last separator */ else { path[0] = '.'; path[1] = 0; } } return path; } const char *File_extension(const char *path) { if (STR_DEF(path)) { char *e = strrchr(path, '.'); return (e ? ++e : NULL); } return NULL; } char *File_removeTrailingSeparator(char *path) { if (STR_DEF(path)) { char *p; for (p = path; *p; p++); do *(p--) = 0; while ((p > path) && (isspace(*p) || *p == SEPARATOR_CHAR)); } return path; } char *File_realPath(const char *path, char *resolved) { if (path && resolved) return realpath(path, resolved); return NULL; } monit-5.35.2/libmonit/src/io/OutputStream.c0000644000016400001720000003733615007061157015521 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (c) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #ifdef OPENBSD #include #endif #include "system/Net.h" #include "OutputStream.h" /** * Implementation of the OutputStream interface. The printf implementation is * based on "Fmt" from David Hanson's excellent CII library. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ // One TCP frame data size #define BUFFER_SIZE 1500 #define T OutputStream_T struct T { int fd; time_t timeout; uchar_t *limit; uchar_t *length; bool isclosed; int sessionWritten; long long bytesWritten; uchar_t buffer[BUFFER_SIZE + 1]; }; typedef struct va_list_box { va_list ap; } va_list_box; typedef void (*fmt_t)(T S, int code, va_list_box *box, unsigned char flags[256], int width, int precision); /* --------------------------------------------------------------- Private */ /* Write the output buffer to the underlying file descriptor */ static int flush(T S) { if (S->isclosed) return -1; errno = 0; int n = (int)Net_write(S->fd, S->buffer, S->length - S->buffer, S->timeout); if (n > 0) { S->bytesWritten += n; if ((S->buffer + n) < S->length) { // Did not write all, shift remaining to the front of buffer // TODO: Instead of shifting, use buffer as a circular buffer memmove(S->buffer, S->buffer + n, S->length - (S->buffer + n)); } S->length -= n; } else if (n < 0) { n = -1; S->isclosed = true; } else if (! (errno == EAGAIN || errno == EWOULDBLOCK)) // peer closed connection n = -1; return n; } /* Write a single byte. The byte is written as an int in the range 0 to 255. Returns the byte written, or -1 if a write error occurred */ static inline int write_byte(T S, uchar_t byte) { if (S->length == S->limit) { if (flush(S) <= 0) return -1; } *S->length++ = byte; S->sessionWritten++; return byte; } /* ------------------------------------------------------- Format handlers */ #define pad(n,c) do { int nn = (n); while (nn-- > 0) write_byte(S, (c)); } while (0) static void putd(T S, const char *str, int len, unsigned char flags[], int width, int precision) { int sign; assert(str); assert(len >= 0); assert(flags); if (width == INT_MIN) width = 0; if (width < 0) { flags['-'] = 1; width = -width; } if (precision >= 0) flags['0'] = 0; if (len > 0 && (*str == '-' || *str == '+')) { sign = *str++; len--; } else if (flags['+']) sign = '+'; else if (flags[' ']) sign = ' '; else sign = 0; { int n; if (precision < 0) precision = 1; if (len < precision) n = precision; else if (precision == 0 && len == 1 && str[0] == '0') n = 0; else n = len; if (sign) n++; if (flags['-']) { if (sign) write_byte(S, sign); } else if (flags['0']) { if (sign) write_byte(S, sign); pad(width - n, '0'); } else { pad(width - n, ' '); if (sign) write_byte(S, sign); } pad(precision - len, '0'); for (int i = 0; i < len; i++) write_byte(S, (uchar_t)*str++); if (flags['-']) pad(width - n, ' '); } } static void cvt_s(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { uchar_t *str = va_arg(box->ap, uchar_t *); assert(str); int len = (int)strlen((char*)str); assert(len >= 0); assert(flags); if (width == INT_MIN) width = 0; if (width < 0) { flags['-'] = 1; width = -width; } if (precision >= 0) flags['0'] = 0; if (precision >= 0 && precision < len) len = precision; if (!flags['-']) pad(width - len, ' '); for (int i = 0; i < len; i++) write_byte(S, *str++); if (flags['-']) pad(width - len, ' '); } static void cvt_d(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { int val = va_arg(box->ap, int); unsigned int m; char buf[43]; char *p = buf + sizeof buf; if (val == INT_MIN) m = INT_MAX + 1UL; else if (val < 0) m = -val; else m = val; do *--p = m%10 + '0'; while ((m /= 10) > 0); if (val < 0) *--p = '-'; putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision); } static void cvt_l(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { long val = va_arg(box->ap, long); unsigned long m; char buf[43]; char *p = buf + sizeof buf; if (val == LONG_MIN) m = LONG_MAX + 1UL; else if (val < 0) m = -val; else m = val; do *--p = m%10 + '0'; while ((m /= 10) > 0); if (val < 0) *--p = '-'; putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision); } static void cvt_u(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { unsigned long m = va_arg(box->ap, unsigned long); char buf[43]; char *p = buf + sizeof buf; do *--p = m%10 + '0'; while ((m /= 10) > 0); putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision); } static void cvt_o(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { unsigned long m = va_arg(box->ap, unsigned long); char buf[43]; char *p = buf + sizeof buf; do *--p = (m&0x7) + '0'; while ((m>>= 3) != 0); putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision); } static void cvt_x(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { unsigned long m = va_arg(box->ap, unsigned long); char buf[43]; char *p = buf + sizeof buf; do *--p = "0123456789abcdef"[m&0xf]; while ((m>>= 4) != 0); putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision); } static void cvt_p(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, int precision) { unsigned long m = (unsigned long)va_arg(box->ap, void*); char buf[43]; char *p = buf + sizeof buf; precision = INT_MIN; do *--p = "0123456789abcdef"[m&0xf]; while ((m>>= 4) != 0); putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision); } static void cvt_c(T S, __attribute__ ((unused)) int code, va_list_box *box, unsigned char flags[], int width, __attribute__ ((unused)) int precision) { if (width == INT_MIN) width = 0; if (width < 0) { flags['-'] = 1; width = -width; } if (!flags['-']) pad(width - 1, ' '); write_byte(S, va_arg(box->ap, int)); if (flags['-']) pad(width - 1, ' '); } static void cvt_f(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) { char buf[DBL_MAX_10_EXP+1+1+99+1]; if (precision < 0) precision = 6; if (code == 'g' && precision == 0) precision = 1; { char fmt[] = "%.dd?"; assert(precision <= 99); fmt[4] = code; fmt[3] = precision%10 + '0'; fmt[2] = (precision/10)%10 + '0'; snprintf(buf, sizeof(buf), fmt, va_arg(box->ap, double)); } putd(S, buf, (int)strlen(buf), flags, width, precision); } static const char *Fmt_flags = "-+ 0"; static fmt_t cvt[256] = { /* 0- 7 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 8- 15 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 16- 23 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 24- 31 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 32- 39 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 40- 47 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 48- 55 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 56- 63 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 64- 71 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 72- 79 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 80- 87 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 88- 95 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 96-103 */ 0, 0, 0, cvt_c, cvt_d, cvt_f, cvt_f, cvt_f, /* 104-111 */ 0, cvt_d, 0, 0, cvt_l, 0, 0, cvt_o, /* 112-119 */ cvt_p, 0, 0, cvt_s, 0, cvt_u, 0, 0, /* 120-127 */ cvt_x, 0, 0, 0, 0, 0, 0, 0 }; /* ---------------------------------------------------------------- Public */ T OutputStream_new(int descriptor) { T S; NEW(S); S->fd = descriptor; S->timeout = NET_WRITE_TIMEOUT; S->length = S->buffer; S->limit = S->buffer + BUFFER_SIZE; return S; } void OutputStream_free(T *S) { assert(S && *S); OutputStream_flush(*S); FREE(*S); } /* ------------------------------------------------------------ Properties */ int OutputStream_getDescriptor(T S) { assert(S); return S->fd; } int OutputStream_buffered(T S) { assert(S); return (int)(S->length - S->buffer); } void OutputStream_setTimeout(T S, time_t timeout) { assert(S); assert(timeout >= 0); S->timeout = timeout; } time_t OutputStream_getTimeout(T S) { assert(S); return S->timeout; } bool OutputStream_isClosed(T S) { assert(S); return S->isclosed; } long long OutputStream_getBytesWritten(T S) { assert(S); return S->bytesWritten; } /* ---------------------------------------------------------------- Public */ int OutputStream_print(T S, const char *s, ...) { assert(S); assert(s); va_list ap; va_start(ap, s); int n = OutputStream_vprint(S, s, ap); va_end(ap); return n; } int OutputStream_vprint(T S, const char *fmt, va_list ap) { assert(S); assert(fmt); va_list_box box; va_copy(box.ap, ap); S->sessionWritten = 0; while (*fmt) { if (*fmt != '%' || *++fmt == '%') write_byte(S, *fmt++); else { uchar_t c, flags[256] = {0}; int width = INT_MIN, precision = INT_MIN; for (c = *fmt; c && strchr(Fmt_flags, c); c = *++fmt) { assert(flags[c] < 255); flags[c]++; } if (*fmt == '*' || isdigit(*fmt)) { int n; if (*fmt == '*') { n = va_arg(box.ap, int); assert(n != INT_MIN); fmt++; } else for (n = 0; isdigit(*fmt); fmt++) { int d = *fmt - '0'; assert(n <= (INT_MAX - d)/10); n = 10*n + d; } width = n; } if (*fmt == '.' && (*++fmt == '*' || isdigit(*fmt))) { int n; if (*fmt == '*') { n = va_arg(box.ap, int); assert(n != INT_MIN); fmt++; } else for (n = 0; isdigit(*fmt); fmt++) { int d = *fmt - '0'; assert(n <= (INT_MAX - d)/10); n = 10*n + d; } precision = n; } c = *fmt++; if (c == 'l') { c = *fmt++; if (c == 'd' || c == 'i') c = 'l'; } assert(cvt[c]); cvt[c](S, c, &box, flags, width, precision); } } va_end(box.ap); return S->isclosed ? -1 : S->sessionWritten; } int OutputStream_write(T S, const void *b, int size) { assert(S); assert(b); S->sessionWritten = 0; for (const uchar_t *t = (const uchar_t*)b; (size-- > 0); t++) if (write_byte(S, *t) < 0) break; return S->isclosed ? -1 : S->sessionWritten; } int OutputStream_flush(T S) { assert(S); if (S->length > S->buffer) return flush(S); return 0; } void OutputStream_clear(T S) { assert(S); S->length = S->buffer; } monit-5.35.2/libmonit/src/io/InputStream.c0000644000016400001720000001143115007061157015304 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include "Str.h" #include "system/Net.h" #include "InputStream.h" /** * Implementation of the InputStream interface. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ // One TCP frame data size #define BUFFER_SIZE 1500 #define T InputStream_T struct T { int fd; int offset; int length; time_t timeout; bool isclosed; uchar_t buffer[BUFFER_SIZE]; }; /* --------------------------------------------------------------- Private */ /* Fill the internal buffer. Only read once, since we may have read all and an extra read would just be an extra system call. Returns true (the length of data read), -1 if an error occurred or if the connection was closed by the client. 0 is returned if a read returned 0 (eof) and read should be retried because it would block. If an error occurred the stream is also set in closed mode. */ static inline int fill(T S) { if (S->isclosed) return -1; S->length = 0; S->offset = 0; errno = 0; int n = (int)Net_read(S->fd, S->buffer, BUFFER_SIZE, S->timeout); if (n > 0) S->length = n; else if (n < 0) { n = -1; S->isclosed = true; S->offset = S->length = 0; } else if (! (errno == EAGAIN || errno == EWOULDBLOCK)) // peer closed connection n = -1; return n; } /* Read a single byte. The byte is returned as an int in the range 0 to 255. Returns the byte read, or -1 if the end of the stream has been reached or if a read error occurred */ static inline int read_byte(T S) { if (S->offset >= S->length) { if (fill(S) <= 0) { return -1; } } return S->buffer[S->offset++]; } /* ---------------------------------------------------------------- Public */ T InputStream_new(int descriptor) { T S; NEW(S); S->fd = descriptor; S->timeout = NET_READ_TIMEOUT; return S; } void InputStream_free(T *S) { assert(S && *S); FREE(*S); } /* ------------------------------------------------------------ Properties */ int InputStream_getDescriptor(T S) { assert(S); return S->fd; } void InputStream_setTimeout(T S, time_t timeout) { assert(S); assert(timeout >= 0); S->timeout = timeout; } time_t InputStream_getTimeout(T S) { assert(S); return S->timeout; } bool InputStream_isClosed(T S) { assert(S); return S->isclosed; } int InputStream_buffered(T S) { assert(S); return S->length - S->offset; } /* ---------------------------------------------------------------- Public */ int InputStream_read(T S) { assert(S); return read_byte(S); } char *InputStream_readLine(T S, char *s, int size) { assert(S); assert(s); uchar_t *p = (uchar_t *)s; for (int c = 0; (--size > 0) && ((c = read_byte(S)) > 0);) { // Stop if \0 is read or no more data *p++ = c; if (c == '\n') break; } *p = 0; return *s ? s : NULL; } int InputStream_readBytes(T S, void *b, int size) { assert(S); assert(b); uchar_t *p = (uchar_t*)b; for (int c = 0; (size-- > 0) && ((c = read_byte(S)) != -1);) *p++ = c; return S->isclosed ? -1 : (int)(p - (uchar_t*)b); } void InputStream_clear(T S) { assert(S); S->offset = S->length = 0; } monit-5.35.2/libmonit/src/io/File.h0000644000016400001720000002710115007061157013716 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef FILE_INCLUDED #define FILE_INCLUDED #include /** * A set of low-level class methods for operating on a file. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * The system-dependent filename separator character. On UNIX systems * the value of this char is '/' on Win32 systems it is '\'. */ extern const char SEPARATOR_CHAR; /** * The separator character, provided as a string for convenience. This * string contains a single character, namely SEPARATOR_CHAR. */ extern const char *SEPARATOR; /** * The system-dependent path-separator character. This character is * used to separate filenames in a sequence of files given as a path * list. On UNIX systems, this character is ':' on Win32 systems it is ';'. */ extern const char PATH_SEPARATOR_CHAR; /** * The system-dependent path-separator character, provided as a string * for convenience. This string contains a single character, namely * PATH_SEPARATOR_CHAR. */ extern const char *PATH_SEPARATOR; /** * Open file and return its file descriptor. The file is * opened in non-blocking mode, meaning that read and write operations * will usually not block. Clients can pass the descriptor to an Input- * and/or an OutputStream for reading/writing to the file. The mode * parameter is used to specify the access requested for the file. The * mode may be one of *
    *
  1. "r" Open for reading. The stream is positioned at the beginning * of the file
  2. *
  3. "w" Open for writing. If the file does not exist it will be * created, if it exist it is truncated to length 0. The stream is * positioned at the beginning of the file
  4. *
  5. "r+" Open for reading and writing. The stream is positioned * at the beginning of the file
  6. *
  7. "w+" Open for reading and writing. If the file does not exist it * will be created, if it exist it is truncated to length 0. The stream is * positioned at the beginning of the file
  8. *
  9. "a" Open for writing at the end of the file (appending). If the * file does not exist it will be created. The stream is positioned at * the end of the file
  10. *
  11. "a+" Open for reading and writing. If the file does not exist it * will be created. The stream is positioned at the end of the file
  12. *
* @param file An absolute file path * @param mode the file access mode * @return A file descriptor or -1 if the file cannot be opened. Use * System_lastError() to get a description of the error that occurred */ int File_open(const char *file, const char *mode); /** * Close the file descriptor fd * @param fd An open file descriptor * @return true on success or false if an error occurred. */ bool File_close(int fd); /** * Move the read position in the file to the beginning * of input. * @param fd An open file descriptor * @return true if success otherwise false and errno is set accordingly */ bool File_rewind(int fd); /** * Returns the last modified time stamp for the given file. * A file's mtime is changed by a file write operation * @param file An absolute file path * @return the last modified time stamp or -1 if the file was not found. */ time_t File_mtime(const char *file); /** * Returns the time when the file status was last changed. * A file ctime is changed by a file write, chmod, chown, rename, etc. * @param file An absolute file path * @return the last changed time stamp or -1 if the file was not found */ time_t File_ctime(const char *file); /** * Returns the time when file data was last accessed. * A file atime is changed by a file read operation * @param file An absolute file path * @return the last accessed time stamp or -1 if the file was not found. */ time_t File_atime(const char *file); /** * Check if this is a regular file. * @param file An absolute file path * @return true if file exist and is a regular file, otherwise false */ bool File_isFile(const char *file); /** * Returns true if file is a Unix Domain socket * @param file An absolute file path * @return true if file is a socket file, otherwise false */ bool File_isSocket(const char *file); /** * Check if file is a directory * @param file An absolute file path * @return true if file exist and is a directory, otherwise false */ bool File_isDirectory(const char *file); /** * Check if the file exist * @param file An absolute file path * @return true if file exist otherwise false */ bool File_exist(const char *file); /** * Returns the file type. The returned char is one of *
    *
  • r - regular file
  • *
  • d - directory
  • *
  • c - char special
  • *
  • b - block special
  • *
  • l - symbolic link
  • *
  • p - fifo or socket
  • *
  • s - socket
  • *
  • ? - file does not exist
  • *
* @param file An absolute file path * @return The file type */ char File_type(const char *file); /** * Returns the file size in bytes * @param file An absolute file path * @return The file size or -1 if it does not exist */ off_t File_size(const char *file); /** * Changes permission bits on the file to the bit pattern * represented by perm. On POSIX systems, see chmod(1) for * details. Example, File_chmod(file, 0644); sets read and * write permission for the File owner and read-only permission for others. * @param file An absolute file path * @param perm An octal number specifying a permission bit pattern. * @return true if success otherwise false if for instance the File does * not exist in the file system. */ bool File_chmod(const char *file, mode_t perm); /** * Returns the permission bit pattern for the file. See also * File_chmod(). * @param file An absolute file path * @return An octal number specifying the permission set for this file * or -1 if the file does not exist */ int File_mod(const char *file); /** * Returns the current umask value for this process. Umask values are * subtracted from the default permissions. Files and directories * are created with default permission set to 0666 and 0777 respectively. * * Simply put, the umask value is a set of permission bits to turn back off * a file creation mode. When a file or directory is created, the permission * bits specified are anded with the complement of the umask value to * determine the actual bits that will be set. For instance, when a file is * created with File_open() the permission for the new file is set * according to *
 * 0666 & ~File_umask(). If File_umask() is 022 then; 0666 & ~022 = 0644
 * 
* If a new directory is created with Dir_mkdir() then permission is set * according to, *
 * 0777 & ~File_umask(). If File_umask() is 022 then; 0777 & ~022 = 0755
 * 
* Here is a ruby on-liner to play with, to see how umask modifies default * permissions *
 * ruby -e 'printf("%#o\n", (0666 & ~0022))'
 * 
* See also http://en.wikipedia.org/wiki/Umask and umask(2) on Unix * @return An octal number representing the umask value for this process */ int File_umask(void); /** * Set the umask value for this process. The default value is 022, unless * changed by the user. See also File_umask() * @param mask The new umask value, as a 3 digit octal number, e.g. 007 * @return The old umask value for this process */ mode_t File_setUmask(mode_t mask); /** * Check if the file is readable for the real user id (uid) of * this process * @param file An absolute path * @return true if the file is readable, otherwise false */ bool File_isReadable(const char *file); /** * Check if the file is writable for the real user id (uid) of * this process * @param file An absolute path * @return true if the file is writable, otherwise false */ bool File_isWritable(const char *file); /** * Check if the file is executable for the real user id (uid) of * this process * @param file An absolute path * @return true if the file is executable, otherwise false */ bool File_isExecutable(const char *file); /** * Delete file from the filesystem * @param file An absolute path * @return true if success otherwise false */ bool File_delete(const char *file); /** * Renames the given file to the new name * Both file and name should contain a full path. * @param file The name of the file to be renamed * @param name The new name for the file. * @return true if success otherwise false */ bool File_rename(const char *file, const char *name); /** * Returns only the filename with leading directory components * removed. This function does not modify the path string. * @param path A file path string * @return A pointer to the base name in path */ const char *File_basename(const char *path); /** * Strip the filename and return only the path, including the last path * separator. The path parameter is modified so if you need to preserve * the path string, copy the string before it is passed to this function. * If no file separator can be found in the given path the following string * is returned "." meaning the current directory. * @param path A file path string * @return The dir name from the path */ char *File_dirname(char *path); /** * Returns only the file extension from the path. This * function does not modify the path string. For instance given * the file path: zild/webapps/ROOT/hello.html this method * returns a pointer to the sub-string html. If the * path string does not contain an extension this * method returns NULL. * @param path A file path string * @return A pointer to the file extension in the path * string or NULL if no extension is found. */ const char *File_extension(const char *path); /** * If path is a directory, remove the last SEPARATOR char if any. * Example: *
 * File_removeTrailingSeparator("/tmp/")    -> "/tmp"
 * File_removeTrailingSeparator("/tmp")     -> "/tmp"
 * File_removeTrailingSeparator(".monitrc") -> ".monitrc"
 * 
* @param path A file path string * @return A pointer to the path string */ char *File_removeTrailingSeparator(char *path); /** * Returns the canonicalized absolute pathname of the path * parameter. The resolved buffer must have size equal to * PATH_MAX * @param path The file path to normalize * @param resolved The buffer to write the real path too * @return A pointer to the resolved buffer or NULL if an error occurred */ char *File_realPath(const char *path, char *resolved); #endif monit-5.35.2/libmonit/src/io/OutputStream.h0000644000016400001720000001433115007061157015514 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef OUTPUTSTREAM_INCLUDED #define OUTPUTSTREAM_INCLUDED #include /** * An OutputStream can be used for writing text or binary * data (8 bits) to a descriptor. * * The method OutputStream_isClosed() can be used to test the * underlying descriptor for an error, a write timeout or for EOF. * * Clients can use this stream in a non-blocking manner by setting * OutputStream_setTimeout() to 0. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define T OutputStream_T typedef struct T *T; /** * Create a new OutputStream object. * @param descriptor The descriptor for this OutputStream * @return An OutputStream object */ T OutputStream_new(int descriptor); /** * Destroy an OutputStream object, release allocated resources and flush * any remaining buffered data in the stream. Call this method to release * an OutputStream object allocated with OutputStream_new() * @param S An OutputStream object reference */ void OutputStream_free(T *S); /** @name Properties */ //@{ /** * Returns the underlying descriptor for this stream * @param S An OutputStream object * @return The descriptor for this stream */ int OutputStream_getDescriptor(T S); /** * Returns the number of bytes in the OutputStream's cache buffer. * I.e. bytes that are cached in stream's internal buffer * @param S An OutputStream object * @return Number of output bytes cached */ int OutputStream_buffered(T S); /** * Set a write timeout in milliseconds. During a write * operation the stream will wait up to timeout * milliseconds for write to be performed. * @param S An OutputStream object * @param timeout The timeout value in milliseconds * @exception AssertException if timeout isd < 0 */ void OutputStream_setTimeout(T S, time_t timeout); /** * Get the write timeout in milliseconds. * @param S An OutputStream object * @return The timeout value in milliseconds */ time_t OutputStream_getTimeout(T S); /** * Returns true if the stream was closed. The stream is closed * if an I/O error occurs * @param S An OutputStream object * @return true if the stream is closed, otherwise false */ bool OutputStream_isClosed(T S); /** * Get the total number of bytes written by the stream to the * underlying descriptor * @param S An OutputStream object * @return The total number of bytes written */ long long OutputStream_getBytesWritten(T S); //@} /** * Writes a character string. Use this function to send text * based data to the underlying descriptor. * @param S An OutputStream object * @param s A String to send to the client. The string may contain * format specifiers similar to the ones used by printf(3). The format * specifiers supported are: *
    *
  • %s, %c - Prints a string (s) or a single char (c) *
  • %d, %i, %u, %o, %x - The int argument is printed as a * signed decimal (d or i), unsigned decimal (u), unsigned octal (o) or * unsigned hexadecimal (x), respectively. An optional length modifier, * 'l' can be used to prefix d, i, n, o, u or x to specify a long argument * instead of an int argument. *
  • %e, %f, %g - Prints a real number (see printf(3) for details) *
  • %p - The void * pointer argument is printed in hexadecimal *
* @return The number of bytes written or -1 if an error occurred. If the * stream uses non-blocking I/O, i.e. timeout is 0, then 0 is also returned * if a write would block, indicating that the caller should try again later. * @exception AssertException if an unknown format specifier is used in s. */ int OutputStream_print(T S, const char *s, ...) __attribute__((format (printf, 2, 3))); /** * Writes a character string with a variable argument list. * @param S An OutputStream object * @param s A String to send to the client. The string may contain * format specifiers similar to the ones used by printf(3). * @param ap A variable argument lists * @return The number of bytes written or -1 if an error occurred. If the * stream uses non-blocking I/O, i.e. timeout is 0, then 0 is also returned * if a write would block, indicating that the caller should try again later. * @exception AssertException if an unknown format specifier is used in s. */ int OutputStream_vprint(T S, const char *s, va_list ap); /** * Write size bytes from the buffer b. * @param S An OutputStream object * @param b The data to be written * @param size The size of the data in b * @return The number of bytes written or -1 if an error occurred. If the * stream uses non-blocking I/O, i.e. timeout is 0, then 0 is also returned * if a write would block, indicating that the caller should try again later. */ int OutputStream_write(T S, const void *b, int size); /** * Flushes this output stream and write any buffered output bytes. * @param S An OutputStream object * @return The number of bytes written or -1 if an error occurred. If the * stream uses non-blocking I/O, i.e. timeout is 0, then 0 is also returned * if a write would block, indicating that the caller should try again later. */ int OutputStream_flush(T S); /** * Clears any data that exists in the output buffer * @param S An OutputStream object */ void OutputStream_clear(T S); #undef T #endif monit-5.35.2/libmonit/src/system/0000755000016400001720000000000015007061157013662 500000000000000monit-5.35.2/libmonit/src/system/Mem.c0000644000016400001720000000466615007061157014500 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include "assert.h" #include "System.h" #include "MemoryException.h" /** * Implementation of the Mem interface * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ---------------------------------------------------------------- Public */ void *Mem_alloc(long nbytes, const char *func, const char *file, int line){ void *ptr; assert(nbytes > 0); ptr = malloc(nbytes); if (ptr == NULL) Exception_vthrow(&(MemoryException), func, file, line, "%s", System_lastError()); return ptr; } void *Mem_calloc(long count, long nbytes, const char *func, const char *file, int line) { void *ptr; assert(count > 0); assert(nbytes > 0); ptr = calloc(count, nbytes); if (ptr == NULL) Exception_vthrow(&(MemoryException), func, file, line, "%s", System_lastError()); return ptr; } void Mem_free(void *ptr, __attribute__ ((unused)) const char *func, __attribute__ ((unused)) const char *file, __attribute__ ((unused)) int line) { if (ptr) free(ptr); } void *Mem_resize(void *ptr, long nbytes, const char *func, const char *file, int line) { assert(nbytes > 0); if (! ptr) return Mem_alloc(nbytes, func, file, line); ptr = realloc(ptr, nbytes); if (ptr == NULL) Exception_vthrow(&(MemoryException), func, file, line, "%s", System_lastError()); return ptr; } monit-5.35.2/libmonit/src/system/Time.c0000644000016400001720000012054615007061157014654 00000000000000/* Generated by re2c 1.3 on Sat Jun 20 14:58:47 2020 */ /* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include "Str.h" #include "system/System.h" #include "system/Random.h" #include "system/Time.h" /** * Implementation of the Time interface * * @author https://tildeslash.com * @see https://mmonit.com * @file */ /* ----------------------------------------------------------- Definitions */ #ifndef HAVE_TIMEGM /* * Spdylay - SPDY Library * * Copyright (c) 2013 Tatsuhiro Tsujikawa * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Counter the number of leap year in the range [0, y). The |y| is the year, including century (e.g., 2012) */ static int count_leap_year(int y) { y -= 1; return y/4-y/100+y/400; } /* Returns nonzero if the |y| is the leap year. The |y| is the year, including century (e.g., 2012) */ static bool is_leap_year(int y) { return y%4 == 0 && (y%100 != 0 || y%400 == 0); } /* The number of days before ith month begins */ static int daysum[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; /* Based on the algorithm of Python 2.7 calendar.timegm. */ time_t timegm(struct tm *tm) { int days; int num_leap_year; long long t; if(tm->tm_mon > 11) { return -1; } num_leap_year = count_leap_year(tm->tm_year + 1900) - count_leap_year(1970); days = (tm->tm_year - 70) * 365 + num_leap_year + daysum[tm->tm_mon] + tm->tm_mday-1; if(tm->tm_mon >= 2 && is_leap_year(tm->tm_year + 1900)) { ++days; } t = ((long long)days * 24 + tm->tm_hour) * 3600 + tm->tm_min * 60 + tm->tm_sec; if(sizeof(time_t) == 4) { if(t < INT_MIN || t > INT_MAX) { return -1; } } return t; } #endif /* !HAVE_TIMEGM */ /* ----------------------------------------------------------------------- */ #if HAVE_STRUCT_TM_TM_GMTOFF #define TM_GMTOFF tm_gmtoff #else #define TM_GMTOFF tm_wday #endif #define _i2a(i, x) ((x)[0] = ((i) / 10) + '0', (x)[1] = ((i) % 10) + '0') #define _isValidDate ((tm.tm_mday < 32 && tm.tm_mday >= 1) && (tm.tm_mon < 12 && tm.tm_mon >= 0)) #define _isValidTime ((tm.tm_hour < 24 && tm.tm_hour >= 0) && (tm.tm_min < 60 && tm.tm_min >= 0) && (tm.tm_sec < 61 && tm.tm_sec >= 0)) #define TEST_RANGE(v, f, t) \ do { \ if (v < f || v > t) \ THROW(AssertException, "#v is outside the range (%d..%d)", f, t); \ } while (0) static const char _days[] = "SunMonTueWedThuFriSat"; static const char _months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; /* --------------------------------------------------------------- Private */ static inline int _a2i(const char *a, int l) { int n = 0; for (; *a && l--; a++) n = n * 10 + (*a) - '0'; return n; } static inline int _m2i(const char m[static 3]) { char month[3] = {[0] = tolower(m[0]), [1] = tolower(m[1]), [2] = tolower(m[2])}; static const char *months = "janfebmaraprmayjunjulaugsepoctnovdec"; for (int i = 0; i < 34; i += 3) { if (memcmp(months + i, month, 3) == 0) return i / 3; } return -1; } // Exponential backoff https://en.wikipedia.org/wiki/Exponential_backoff // Expected mean backoff time: (2^10 - 1)/2 × slot = 2.6 seconds static inline void _backoff(int step) { static int slot = 5100; // µs switch (step) { case 0: Time_usleepComplete(slot * (Random_number() % 2)); break; case 1: Time_usleepComplete(slot * (Random_number() % 4)); break; default: // slot µs * R[0...2^step - 1] Time_usleepComplete(slot * (Random_number() % (1 << step))); break; } } /* ----------------------------------------------------------------- Class */ time_t Time_build(int year, int month, int day, int hour, int min, int sec) { struct tm tm = {.tm_isdst = -1}; TEST_RANGE(year, 1970, 2037); TEST_RANGE(month, 1, 12); TEST_RANGE(day, 1, 31); TEST_RANGE(hour, 0, 23); TEST_RANGE(min, 0, 59); TEST_RANGE(sec, 0, 61); tm.tm_year = (year - 1900); tm.tm_mon = (month - 1); tm.tm_mday = day; tm.tm_hour = hour; tm.tm_min = min; tm.tm_sec = sec; return timegm(&tm); } time_t Time_toTimestamp(const char *s) { if (STR_DEF(s)) { struct tm t = {}; if (Time_toDateTime(s, &t)) { t.tm_year -= 1900; time_t offset = t.TM_GMTOFF; return timegm(&t) - offset; } } return 0; } struct tm *Time_toDateTime(const char *s, struct tm *t) { assert(t); assert(s); struct tm tm = {.tm_isdst = -1}; bool have_date = false, have_time = false; const char *limit = s + strlen(s), *marker, *token, *cursor = s; while (true) { if (cursor >= limit) { if (have_date || have_time) { *(struct tm*)t = tm; return t; } THROW(AssertException, "Invalid date or time"); } token = cursor; { unsigned char yych; unsigned int yyaccept = 0; yych = *cursor; switch (yych) { case '+': case '-': goto yy4; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy5; default: if (limit <= cursor) { goto yyeof; } goto yy2; } yy2: ++cursor; yy3: { continue; } yy4: yyaccept = 0; yych = *(marker = ++cursor); switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy6; default: if (limit <= cursor) { } goto yy3; } yy5: yyaccept = 0; yych = *(marker = ++cursor); switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy8; default: if (limit <= cursor) { } goto yy3; } yy6: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy9; default: if (limit <= cursor) { } goto yy7; } yy7: cursor = marker; switch (yyaccept) { case 0: goto yy3; case 1: goto yy10; case 2: goto yy43; case 3: goto yy49; default: goto yy56; } yy8: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy12; case ':': goto yy13; default: if (limit <= cursor) { goto yy7; } goto yy11; } yy9: yyaccept = 1; yych = *(marker = ++cursor); switch (yych) { case '\n': goto yy10; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy15; default: if (limit <= cursor) { goto yy10; } goto yy14; } yy10: { // Timezone: +-HH:MM, +-HH or +-HHMM is offset from UTC in seconds if (have_time) { // Only set timezone if we have parsed time tm.TM_GMTOFF = _a2i(token + 1, 2) * 3600; if (isdigit(token[3])) tm.TM_GMTOFF += _a2i(token + 3, 2) * 60; else if (isdigit(token[4])) tm.TM_GMTOFF += _a2i(token + 4, 2) * 60; if (token[0] == '-') tm.TM_GMTOFF *= -1; } continue; } yy11: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy16; case 'A': case 'a': goto yy17; case 'D': case 'd': goto yy18; case 'F': case 'f': goto yy19; case 'J': case 'j': goto yy20; case 'M': case 'm': goto yy21; case 'N': case 'n': goto yy22; case 'O': case 'o': goto yy23; case 'S': case 's': goto yy24; default: if (limit <= cursor) { } goto yy7; } yy12: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy25; default: if (limit <= cursor) { } goto yy7; } yy13: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy26; case 'A': case 'a': goto yy17; case 'D': case 'd': goto yy18; case 'F': case 'f': goto yy19; case 'J': case 'j': goto yy20; case 'M': case 'm': goto yy21; case 'N': case 'n': goto yy22; case 'O': case 'o': goto yy23; case 'S': case 's': goto yy24; default: if (limit <= cursor) { } goto yy7; } yy14: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy27; default: if (limit <= cursor) { } goto yy7; } yy15: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy28; default: if (limit <= cursor) { } goto yy7; } yy16: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy29; default: if (limit <= cursor) { } goto yy7; } yy17: yych = *++cursor; switch (yych) { case 'P': case 'p': goto yy30; case 'U': case 'u': goto yy31; default: if (limit <= cursor) { } goto yy7; } yy18: yych = *++cursor; switch (yych) { case 'E': case 'e': goto yy32; default: if (limit <= cursor) { } goto yy7; } yy19: yych = *++cursor; switch (yych) { case 'E': case 'e': goto yy33; default: if (limit <= cursor) { } goto yy7; } yy20: yych = *++cursor; switch (yych) { case 'A': case 'a': goto yy34; case 'U': case 'u': goto yy35; default: if (limit <= cursor) { } goto yy7; } yy21: yych = *++cursor; switch (yych) { case 'A': case 'a': goto yy36; default: if (limit <= cursor) { } goto yy7; } yy22: yych = *++cursor; switch (yych) { case 'O': case 'o': goto yy37; default: if (limit <= cursor) { } goto yy7; } yy23: yych = *++cursor; switch (yych) { case 'C': case 'c': goto yy38; default: if (limit <= cursor) { } goto yy7; } yy24: yych = *++cursor; switch (yych) { case 'E': case 'e': goto yy39; default: if (limit <= cursor) { } goto yy7; } yy25: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy41; default: if (limit <= cursor) { goto yy7; } goto yy40; } yy26: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy42; default: if (limit <= cursor) { } goto yy7; } yy27: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy44; default: if (limit <= cursor) { } goto yy7; } yy28: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy44; default: if (limit <= cursor) { } goto yy10; } yy29: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy7; default: if (limit <= cursor) { goto yy7; } goto yy45; } yy30: yych = *++cursor; switch (yych) { case 'R': case 'r': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy31: yych = *++cursor; switch (yych) { case 'G': case 'g': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy32: yych = *++cursor; switch (yych) { case 'C': case 'c': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy33: yych = *++cursor; switch (yych) { case 'B': case 'b': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy34: yych = *++cursor; switch (yych) { case 'N': case 'n': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy35: yych = *++cursor; switch (yych) { case 'L': case 'N': case 'l': case 'n': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy36: yych = *++cursor; switch (yych) { case 'R': case 'Y': case 'r': case 'y': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy37: yych = *++cursor; switch (yych) { case 'V': case 'v': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy38: yych = *++cursor; switch (yych) { case 'T': case 't': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy39: yych = *++cursor; switch (yych) { case 'P': case 'p': goto yy46; default: if (limit <= cursor) { } goto yy7; } yy40: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy47; default: if (limit <= cursor) { } goto yy7; } yy41: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy48; default: if (limit <= cursor) { } goto yy7; } yy42: yyaccept = 2; yych = *(marker = ++cursor); switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy43; default: if (limit <= cursor) { goto yy43; } goto yy45; } yy43: { // Time: HH:MM tm.tm_hour = _a2i(token, 2); tm.tm_min = _a2i(token + 3, 2); tm.tm_sec = 0; have_time = _isValidTime; continue; } yy44: ++cursor; goto yy10; yy45: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy50; default: if (limit <= cursor) { } goto yy7; } yy46: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy7; default: if (limit <= cursor) { goto yy7; } goto yy51; } yy47: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy52; default: if (limit <= cursor) { } goto yy7; } yy48: yyaccept = 3; yych = *(marker = ++cursor); switch (yych) { case ',': case '.': goto yy53; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy54; default: if (limit <= cursor) { } goto yy49; } yy49: { // Compressed Time: HHMMSS tm.tm_hour = _a2i(token, 2); tm.tm_min = _a2i(token + 2, 2); tm.tm_sec = _a2i(token + 4, 2); have_time = _isValidTime; continue; } yy50: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy55; default: if (limit <= cursor) { } goto yy7; } yy51: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy57; default: if (limit <= cursor) { } goto yy7; } yy52: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy7; default: if (limit <= cursor) { goto yy7; } goto yy58; } yy53: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy59; default: if (limit <= cursor) { } goto yy7; } yy54: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy61; default: if (limit <= cursor) { } goto yy7; } yy55: yyaccept = 4; yych = *(marker = ++cursor); switch (yych) { case ',': case '.': goto yy63; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy64; default: if (limit <= cursor) { } goto yy56; } yy56: { // Time: HH:MM:SS tm.tm_hour = _a2i(token, 2); tm.tm_min = _a2i(token + 3, 2); tm.tm_sec = _a2i(token + 6, 2); have_time = _isValidTime; continue; } yy57: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy65; default: if (limit <= cursor) { } goto yy7; } yy58: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy66; default: if (limit <= cursor) { } goto yy7; } yy59: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy59; default: if (limit <= cursor) { } goto yy49; } yy61: ++cursor; { // Compressed Date: YYYYMMDD tm.tm_year = _a2i(token, 4); tm.tm_mon = _a2i(token + 4, 2) - 1; tm.tm_mday = _a2i(token + 6, 2); have_date = _isValidDate; continue; } yy63: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy67; default: if (limit <= cursor) { } goto yy7; } yy64: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy69; default: if (limit <= cursor) { } goto yy7; } yy65: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy71; default: if (limit <= cursor) { } goto yy7; } yy66: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy72; default: if (limit <= cursor) { } goto yy7; } yy67: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy67; default: if (limit <= cursor) { } goto yy56; } yy69: ++cursor; { // Date: dd/mm/yyyy tm.tm_mday = _a2i(token, 2); tm.tm_mon = _a2i(token + 3, 2) - 1; tm.tm_year = _a2i(token + 6, 4); have_date = _isValidDate; continue; } yy71: yych = *++cursor; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy74; default: if (limit <= cursor) { } goto yy7; } yy72: ++cursor; { // Date: YYYY-MM-DD tm.tm_year = _a2i(token, 4); tm.tm_mon = _a2i(token + 5, 2) - 1; tm.tm_mday = _a2i(token + 8, 2); have_date = _isValidDate; continue; } yy74: ++cursor; { // Date: Parse date part of RFC 7231 IMF-fixdate (HTTP date), e.g. Sun, 06 Nov 1994 08:49:37 GMT tm.tm_mday = _a2i(token, 2); tm.tm_mon = _m2i(token + 3); tm.tm_year = _a2i(token + 7, 4); have_date = _isValidDate; continue; } yyeof: { // EOF THROW(AssertException, "Invalid date or time"); } } } return NULL; } time_t Time_now(void) { struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_lastError()); return t.tv_sec; } long long Time_milli(void) { struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_lastError()); return (long long)t.tv_sec * 1000 + (long long)t.tv_usec / 1000; } long long Time_micro(void) { struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_lastError()); return (long long)t.tv_sec * 1000000 + (long long)t.tv_usec; } struct time_monotonic_t Time_monotonic(void) { struct time_monotonic_t tm; #ifdef HAVE_CLOCK_GETTIME struct timespec t; clockid_t clockid; #ifdef CLOCK_MONOTONIC_RAW clockid = CLOCK_MONOTONIC_RAW; #elif defined CLOCK_MONOTONIC clockid = CLOCK_MONOTONIC; #else #error "clock_gettime() present but no monotonic clock available" #endif if (clock_gettime(clockid, &t) != 0) THROW(AssertException, "%s", System_lastError()); tm.seconds = t.tv_sec; tm.milliseconds = t.tv_sec * 1000LL + t.tv_nsec / 1000000LL; tm.microseconds = t.tv_sec * 1000000LL + t.tv_nsec / 1000LL; tm.nanoseconds = t.tv_sec * 1000000000LL + t.tv_nsec; #else #warning "no monotonic clock available, falling back to gettimeofday" struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_lastError()); tm.seconds = t.tv_sec; tm.milliseconds = t.tv_sec * 1000LL + t.tv_usec / 1000LL; tm.microseconds = t.tv_sec * 1000000LL + t.tv_usec; tm.nanoseconds = t.tv_sec * 1000000000LL + t.tv_usec * 1000LL; // Approximation #endif return tm; } int Time_seconds(time_t time) { struct tm tm; localtime_r(&time, &tm); return tm.tm_sec; } int Time_minutes(time_t time) { struct tm tm; localtime_r(&time, &tm); return tm.tm_min; } int Time_hour(time_t time) { struct tm tm; localtime_r(&time, &tm); return tm.tm_hour; } int Time_weekday(time_t time) { struct tm tm; localtime_r(&time, &tm); return tm.tm_wday; } int Time_day(time_t time) { struct tm tm; localtime_r(&time, &tm); return tm.tm_mday; } int Time_month(time_t time) { struct tm tm; localtime_r(&time, &tm); return (tm.tm_mon + 1); } int Time_year(time_t time) { struct tm tm; localtime_r(&time, &tm); return (tm.tm_year + 1900); } char *Time_localStr(time_t time, char result[static 26]) { if (result) { struct tm ts; /* This implementation needs to be fast and is around 50% faster than strftime */ localtime_r((const time_t *)&time, &ts); memcpy(result, "aaa, xx aaa xxxx xx:xx:xx\0", 26); /* 0 5 8 1214 17 20 23 25 */ memcpy(result, _days + (3 * ts.tm_wday), 3); _i2a(ts.tm_mday, &result[5]); memcpy(result + 8, _months + (3 * ts.tm_mon), 3); _i2a((ts.tm_year+1900) / 100, &result[12]); _i2a((ts.tm_year+1900) % 100, &result[14]); _i2a(ts.tm_hour, &result[17]); _i2a(ts.tm_min, &result[20]); _i2a(ts.tm_sec, &result[23]); } return result; } char *Time_str(time_t time, char result[static 30]) { if (result) { struct tm ts; /* This implementation needs to be fast and is around 50% faster than strftime */ gmtime_r(&time, &ts); memcpy(result, "aaa, xx aaa xxxx xx:xx:xx GMT\0", 30); /* 0 5 8 1214 17 20 23 29 */ memcpy(result, _days + (3 * ts.tm_wday), 3); _i2a(ts.tm_mday, &result[5]); memcpy(result + 8, _months + (3 * ts.tm_mon), 3); _i2a((ts.tm_year+1900) / 100, &result[12]); _i2a((ts.tm_year+1900) % 100, &result[14]); _i2a(ts.tm_hour, &result[17]); _i2a(ts.tm_min, &result[20]); _i2a(ts.tm_sec, &result[23]); } return result; } char *Time_localFmt(char *result, int size, const char *format, time_t time) { struct tm tm; assert(result); assert(format); localtime_r(&time, &tm); if (strftime(result, size, format, &tm) == 0) *result = 0; return result; } char *Time_fmt(char *result, int size, const char *format, time_t time) { struct tm tm; assert(result); assert(format); gmtime_r(&time, &tm); if (strftime(result, size, format, &tm) == 0) *result = 0; return result; } char *Time_uptime(long sec, char result[static 24]) { // Write max 24 bytes to result if (result) { int n = 0; long r = 0; result[0] = 0; if (sec > 0) { if ((r = sec/86400) > 0) { n = snprintf(result, 24, "%lldd", (long long)r); sec -= r * 86400; } if ((r = sec/3600) > 0) { n += snprintf(result + n, (24 - n), "%s%lldh", n ? ", " : "", (long long)r); sec -= r * 3600; } r = sec/60; snprintf(result + n, (24 - n), "%s%lldm", n ? ", " : "", (long long)r); } } return result; } /* cron string is on format "minute hour day month wday" where fields may have a numeric type, an asterix, a sequence of numbers or a range. Return -1 on parse error */ int Time_incron(const char *cron, time_t time) { assert(cron); #undef YYCURSOR #undef YYLIMIT #undef YYMARKER #define YYCURSOR cron #define YYLIMIT end #define YYMARKER m #define YYTOKEN t const char *m; const char *t; const char *end = cron + strlen(cron); int n = 0; int found = 0; // Convert UTC time to local time struct tm tm; localtime_r(&time, &tm); int fields[] = {tm.tm_min, tm.tm_hour, tm.tm_mday, tm.tm_mon + 1, tm.tm_wday}; parse: if (YYCURSOR >= YYLIMIT) return found == 5; YYTOKEN = YYCURSOR; { unsigned char yych; yych = *YYCURSOR; switch (yych) { case '\t': case '\n': case '\r': case ' ': goto yy55; case '*': goto yy57; case ',': goto yy59; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy61; default: goto yy53; } yy53: ++YYCURSOR; { return false; } yy55: ++YYCURSOR; { goto parse; } yy57: ++YYCURSOR; { n++; found++; goto parse; } yy59: ++YYCURSOR; { n--; // backtrack on fields advance if (n < 0 || n >= 5) return -1; goto parse; } yy61: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case '-': goto yy64; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy61; default: goto yy63; } yy63: { if (fields[n] == Str_parseInt(YYTOKEN)) found++; n++; goto parse; } yy64: yych = *++YYCURSOR; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy66; default: goto yy65; } yy65: YYCURSOR = YYMARKER; goto yy63; yy66: yych = *++YYCURSOR; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy66; default: goto yy68; } yy68: { int from = Str_parseInt(YYTOKEN); int to = Str_parseInt(strchr(YYTOKEN, '-') + 1); if ((fields[n] <= to) && (fields[n] >= from)) found++; n++; goto parse; } } return found == 5; } bool Time_backoff(bool predicate(void *args), void *args) { for (int i = 0, steps = 10; i < steps; i++) { if (predicate(args)) return true; _backoff(i); } return false; } static inline long long _usleep(long long microseconds, bool complete) { struct timespec req, rem; req.tv_sec = microseconds / 1000000LL; req.tv_nsec = (microseconds % 1000000LL) * 1000LL; while (nanosleep(&req, &rem) == -1) { if (! complete) { if (errno == EINTR) return rem.tv_sec * 1000000LL + rem.tv_nsec / 1000LL; } if (errno == EINVAL) return -1; req = rem; } return 0; } long long Time_usleep(long long microseconds) { return _usleep(microseconds, false); } bool Time_usleepComplete(long long microseconds) { return _usleep(microseconds, true) == 0; } static inline long _sleep(long seconds, bool complete) { struct timespec req, rem; req.tv_sec = seconds; req.tv_nsec = 0; while (nanosleep(&req, &rem) == -1) { if (!complete) { if (errno == EINTR) return rem.tv_sec; } if (errno == EINVAL) return -1; req = rem; } return 0; } long Time_sleep(long seconds) { return _sleep(seconds, false); } bool Time_sleepComplete(long seconds) { return _sleep(seconds, true) == 0; } monit-5.35.2/libmonit/src/system/Net.h0000644000016400001720000001032415007061157014501 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef NET_INCLUDED #define NET_INCLUDED #include #include /** * Facade for system specific network and socket operation. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * Number of milli seconds before a socket write timeout */ #define NET_WRITE_TIMEOUT 3000 /** * Number of milli seconds before a socket read timeout */ #define NET_READ_TIMEOUT 3000 /** * Enable nonblocking i|o on the given socket. * @param socket A socket * @return true if success, otherwise false */ bool Net_setNonBlocking(int socket); /** * Disable nonblocking i|o on the given socket * @param socket A socket * @return true if success, otherwise false */ bool Net_setBlocking(int socket); /** * Check if data is available, if not, wait timeout milliseconds for data * to be present. * @param socket A socket * @param milliseconds How long to wait before timeout * @return true if the event occurred, otherwise false. */ bool Net_canRead(int socket, time_t milliseconds); /** * Check if data can be sent to the socket, if not, wait timeout * milliseconds for the socket to be ready. * @param socket A socket * @param milliseconds How long to wait before timeout * @return true if the event occurred, otherwise false. */ bool Net_canWrite(int socket, time_t milliseconds); /** * Read up to size bytes from the socket into the * buffer. If data is not available wait for * timeout milliseconds. * @param socket the Socket to read data from * @param buffer The buffer to write the data to * @param size Number of bytes to read from the socket * @param timeout Milliseconds to wait for data to be available * @return The number of bytes read or -1 if an error occurred. */ ssize_t Net_read(int socket, void *buffer, size_t size, time_t timeout); /** * Write size bytes from the buffer to the * socket * @param socket the Socket to write to * @param buffer The buffer to write * @param size Number of bytes to send * @param timeout Milliseconds to wait for data to be sent * @return The number of bytes sent or -1 if an error occurred. */ ssize_t Net_write(int socket, const void *buffer, size_t size, time_t timeout); /** * Aborts a TCP a connection. That is, TCP discards any data still remaining * in the socket send buffer and sends an RST to the peer, not the normal * four-packet connection termination sequence. See "UNIX Network Programming" * third edition ch 7.5. Generic Socket Options * @param socket The socket connection to abort and close * @return true if success otherwise false */ bool Net_abort(int socket); /** * Shutdown a full-duplex socket connection. * @param socket The socket connection to shutdown * @param how If how is SHUT_RD, further receives will be disallowed. If how * is SHUT_WR, further sends will be disallowed. If how is SHUT_RDWR, further * sends and receives will be disallowed * @return true if success otherwise false */ bool Net_shutdown(int socket, int how); /** * Close a socket connection * @param socket The socket connection to close * @return true if success otherwise false */ bool Net_close(int socket); #endif monit-5.35.2/libmonit/src/system/Command.c0000644000016400001720000006542615007061157015341 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_USERSEC_H #include #endif #include "Str.h" #include "Dir.h" #include "File.h" #include "List.h" #include "Array.h" #include "system/Net.h" #include "StringBuffer.h" #include "system/System.h" #include "system/Time.h" #include "system/Command.h" /** * Implementation of the Command and Process interfaces. * * @author https://tildeslash.com * @see https://mmonit.com * @file */ // MARK: - Definitions #define T Command_T struct T { uid_t uid; gid_t gid; List_T env; List_T args; mode_t umask; char *working_directory; }; struct Process_T { pid_t pid; int status; bool isdetached; int ctrl_pipe[2]; int stdin_pipe[2]; int stdout_pipe[2]; int stderr_pipe[2]; InputStream_T in; InputStream_T err; OutputStream_T out; }; struct _usergroups { int ngroups; gid_t groups[NGROUPS_MAX]; }; static Array_T processTable = NULL; // Some POSIX systems does not define environ explicit extern char **environ; // Default umask for the sub-process #define DEFAULT_UMASK 022 // MARK: - SIGCHLD handling static inline void _setstatus(Process_T P, int status) { if (WIFEXITED(status)) P->status = WEXITSTATUS(status); else if (WIFSIGNALED(status)) P->status = WTERMSIG(status); else if (WIFSTOPPED(status)) P->status = WSTOPSIG(status); } static void _childSignal(int how) { sigset_t mask; sigemptyset(&mask); sigaddset(&mask, SIGCHLD); pthread_sigmask(how, &mask, NULL); } // Signal handler for children exit. OS blocks SIGCHLD during this call static void _handleChildren(__attribute__ ((unused)) int sig) { pid_t pid; int status; int save_errno = errno; // Save errno on signal handler entry, before calling waitpid() while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { Process_T found = Array_remove(processTable, pid); if (found) { _setstatus(found, status); } } errno = save_errno; // Restore errno before signal handler return } static void __attribute__ ((constructor)) _constructor(void) { processTable = Array_new(20); struct sigaction act = { .sa_handler = _handleChildren, .sa_flags = SA_RESTART | SA_NODEFER }; // Set up mask for blocking SIGCHLD during handler execution sigemptyset(&act.sa_mask); sigaddset(&act.sa_mask, SIGCHLD); if (sigaction(SIGCHLD, &act, NULL)) { ERROR("Command: SIGCHLD handler failed: %s", System_lastError()); } } static void __attribute__ ((destructor)) _destructor(void) { _childSignal(SIG_BLOCK); // No need to free the table entries - Process members are freed explicitly, just drop the table Array_free(&processTable); } // MARK: - Private methods // Search the env list and return the pointer to the name (in the list) // if found, otherwise NULL. static inline char *_findEnv(T C, const char *name, size_t len) { assert(len > 0); for (_list_t p = C->env->head; p; p = p->next) { if ((strncmp(p->e, name, len) == 0)) if (((char*)p->e)[len] == '=') // Ensure that name is not just a sub-string return p->e; } return NULL; } // Remove env identified by name static inline void _removeEnv(T C, const char *name) { char *e = _findEnv(C, name, strlen(name)); if (e) { List_remove(C->env, e); FREE(e); } } // Free each string in a list of strings static void _freeElementsIn(List_T l) { while (List_length(l) > 0) { char *s = List_pop(l); FREE(s); } } // Build the Command args list. The list represent the array sent // to execv and the List contains the following entries: args[0] is the // path to the program, the rest are optional arguments to the program static void _buildArgs(T C, const char *path, va_list ap) { List_append(C->args, Str_dup(path)); va_list ap_copy; va_copy(ap_copy, ap); for (char *a = va_arg(ap_copy, char *); a; a = va_arg(ap_copy, char *)) List_append(C->args, Str_dup(a)); va_end(ap_copy); } // Returns an array of program args. Should only be called in the child static inline char **_args(T C) { assert(C); return (char**)List_toArray(C->args); } // Returns an array of program environment. Must only be called in the child. // If the environment list is empty, just return the global environ variable. // Otherwise don't copy, but add references to environ entries unless already set static inline char **_env(T C) { assert(C); if (List_length(C->env) == 0) return environ; for (int i = 0; environ[i]; i++) { size_t len = strchr(environ[i], '=') - environ[i]; if (_findEnv(C, environ[i], len)) continue; List_append(C->env, environ[i]); } return (char**)List_toArray(C->env); } #ifndef HAVE_GETGROUPLIST #ifdef AIX static int getgrouplist(const char *name, int basegid, int *groups, int *ngroups) { int rv = -1; // Open the user database if (setuserdb(S_READ) != 0) { DEBUG("Cannot open user database -- %s\n", System_getError(errno)); goto fail4; } // Get administrative domain for the user so we can lookup the group membership in the correct database (files, LDAP, etc). char *registry; if (getuserattr((char *)name, S_REGISTRY, ®istry, SEC_CHAR) == 0 && setauthdb(registry, NULL) != 0) { DEBUG("Administrative domain switch to %s for user %s failed -- %s\n", registry, name, System_getError(errno)); goto fail3; } // Get the list of groups for the named user char *groupList = getgrset(name); if (! groupList) { DEBUG("Cannot get groups for user %s\n", name); goto fail2; } // Add the base GID int count = 1; groups[0] = basegid; // Parse the comma separated list of groups char *lastGroup = NULL; for (char *currentGroup = strtok_r(groupList, ",", &lastGroup); currentGroup; currentGroup = strtok_r(NULL, ",", &lastGroup)) { gid_t gid = (gid_t)Str_parseInt(currentGroup); // Add the GID to the list (unless it's basegid, which we pushed to the beginning of groups list already) if (gid != basegid) { if (count == *ngroups) { // Maximum groups reached (error will be indicated by -1 return value, but we return as many groups as possible in the list) goto fail1; } groups[count++] = gid; } } // Success rv = 0; *ngroups = count; fail1: FREE(groupList); fail2: // Restore the administrative domain setauthdb(NULL, NULL); fail3: // Close the user database if (enduserdb() != 0) { DEBUG("Cannot close user database -- %s\n", System_getError(errno)); } fail4: return rv; } #else #error "getgrouplist missing" #endif #endif // Block all signals and make the current thread not cancellable static struct _block {sigset_t sigmask; int threadstate;} _block(void) { sigset_t b; sigfillset(&b); struct _block block = {}; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &block.threadstate); pthread_sigmask(SIG_BLOCK, &b, &block.sigmask); return block; } // Un-Block signals and make the current thread cancellable again static void _unblock(struct _block *block) { pthread_sigmask(SIG_SETMASK, &block->sigmask, NULL); pthread_setcancelstate(block->threadstate, 0); } // Reset all signals to default, except for SIGHUP and SIGPIPE which // are set to SIG_IGN static void _resetSignals(void) { sigset_t mask; sigemptyset(&mask); pthread_sigmask(SIG_SETMASK, &mask, 0); struct sigaction sa_default = {.sa_handler = SIG_DFL}; struct sigaction sa_ignore = {.sa_handler = SIG_IGN}; for (int i = 1; i < NSIG; ++i) { if (i == SIGKILL || i == SIGSTOP) continue; if (i == SIGHUP || i == SIGPIPE) sigaction(i, &sa_ignore, NULL); else sigaction(i, &sa_default, NULL); } } struct _usergroups *_getUserGroups(T C, struct _usergroups *ug) { // There are no threads in the child so we can use // the simpler getpwuid() instead of getpwuid_r() struct passwd *result = getpwuid(C->uid); if (!result) return NULL; Command_setEnv(C, "HOME", result->pw_dir); if (getgrouplist(result->pw_name, C->gid, #ifdef __APPLE__ (int *)ug->groups, #else ug->groups, #endif &ug->ngroups) < 0) return NULL; return ug; } // MARK: - Process_T Private methods static void Process_closeCtrlPipe(Process_T P) { // Close ctrl pipe ends if not already closed if (P->ctrl_pipe[1] >= 0) { close(P->ctrl_pipe[1]); P->ctrl_pipe[1] = -1; } if (P->ctrl_pipe[0] >= 0) { close(P->ctrl_pipe[0]); P->ctrl_pipe[0] = -1; } } // Close parent pipes in process, except ctrl_pipe which are used during // child setup before calling exec static void Process_closePipes(Process_T P) { if (P->stdin_pipe[1] >= 0) { close(P->stdin_pipe[1]); // Close write end P->stdin_pipe[1] = -1; } if (P->stdout_pipe[0] >= 0) { close(P->stdout_pipe[0]); // Close read end P->stdout_pipe[0] = -1; } if (P->stderr_pipe[0] >= 0) { close(P->stderr_pipe[0]); // Close read end P->stderr_pipe[0] = -1; } } // Setup a controller pipe to be used between parent and child to // report any errors during the setup phase or if execve fails static int Process_createCtrlPipe(Process_T P) { int status = 0; // Not all POSIX systems have pipe2(), like macOS, if (pipe(P->ctrl_pipe) < 0) { status = -errno; DEBUG("Process_createCtrlPipe: ctrl pipe(2) failed -- %s\n", System_lastError()); return status; } for (int i = 0; i < 2; i++) { if (fcntl(P->ctrl_pipe[i], F_SETFD, FD_CLOEXEC) < 0) { status = -errno; DEBUG("Process_createCtrlPipe: ctrl fcntl(2) FD_CLOEXEC failed -- %s\n", System_lastError()); return status; } } return 0; } // Create pipes for communication between parent and child process static int Process_createPipes(Process_T P) { int status = Process_createCtrlPipe(P); if (status < 0) return status; if (pipe(P->stdin_pipe) < 0 || pipe(P->stdout_pipe) < 0 || pipe(P->stderr_pipe) < 0) { status = -errno; DEBUG("Process_createPipes: pipe(2) failed -- %s\n", System_lastError()); Process_closePipes(P); return status; } return 0; } // Setup stdio pipes in subprocess. We need not close pipes as the child // process will exit if this fails static bool Process_setupChildPipes(Process_T P) { close(P->stdin_pipe[1]); // close write end if (P->stdin_pipe[0] != STDIN_FILENO) { if (dup2(P->stdin_pipe[0], STDIN_FILENO) != STDIN_FILENO) return false; } close(P->stdout_pipe[0]); // close read end if (P->stdout_pipe[1] != STDOUT_FILENO) { if (dup2(P->stdout_pipe[1], STDOUT_FILENO) != STDOUT_FILENO) return false; } close(P->stderr_pipe[0]); // close read end if (P->stderr_pipe[1] != STDERR_FILENO) { if (dup2(P->stderr_pipe[1], STDERR_FILENO) != STDERR_FILENO) return false; } return true; } // Setup stdio pipes in parent process for communication with the subprocess static void Process_setupParentPipes(Process_T P) { if (P->stdin_pipe[0] >= 0) { close(P->stdin_pipe[0]); // close read end P->stdin_pipe[0] = -1; } if (P->stdout_pipe[1] >= 0) { close(P->stdout_pipe[1]); // close write end P->stdout_pipe[1] = -1; } if (P->stderr_pipe[1] >= 0) { close(P->stderr_pipe[1]); // close write end P->stderr_pipe[1] = -1; } Net_setNonBlocking(P->stdin_pipe[1]); Net_setNonBlocking(P->stdout_pipe[0]); Net_setNonBlocking(P->stderr_pipe[0]); } // Release stdio streams static void Process_closeStreams(Process_T P) { if (P->in) InputStream_free(&P->in); if (P->err) InputStream_free(&P->err); if (P->out) OutputStream_free(&P->out); } static Process_T Process_new(void) { Process_T P; NEW(P); P->pid = -1; P->status = -1; P->ctrl_pipe[0] = P->ctrl_pipe[1] = -1; P->stdin_pipe[0] = P->stdin_pipe[1] = -1; P->stdout_pipe[0] = P->stdout_pipe[1] = -1; P->stderr_pipe[0] = P->stderr_pipe[1] = -1; return P; } // MARK: - Process_T Public methods void Process_free(Process_T *P) { assert(P && *P); _childSignal(SIG_BLOCK); if (Array_get(processTable , (*P)->pid) == (*P)) { Array_remove(processTable, (*P)->pid); } _childSignal(SIG_UNBLOCK); if (!(*P)->isdetached) { if (Process_isRunning(*P)) { Process_kill(*P); // Trust SIGCHLD handler to wait for P's process } Process_detach(*P); } FREE(*P); } // Close pipes and streams to the sub-process. Because we ignored SIGPIPE when // creating the sub-process it should not recieve SIGPIPE if it tries to write // to one of its (now broken) output pipes. A proper daemon process will also // normally redirect stdio to /dev/null and instead write to a log file after // its initial setup phase void Process_detach(Process_T P) { assert(P); if (!P->isdetached) { P->isdetached = true; Process_closeStreams(P); Process_closePipes(P); } } bool Process_isdetached(Process_T P) { assert(P); return P->isdetached; } pid_t Process_pid(Process_T P) { assert(P); return P->pid; } int Process_waitFor(Process_T P) { assert(P); _childSignal(SIG_BLOCK); if (P->status < 0) { Process_T current = Array_get(processTable, P->pid); if (current == P) { int r, status; do r = waitpid(P->pid, &status, 0); while (r == -1 && errno == EINTR); if (r == P->pid) { _setstatus(P, status); if (Array_get(processTable, P->pid) == P) { Array_remove(processTable, P->pid); } } } else if (current) { // Another Process with same PID is in the array - don't touch it DEBUG("Process_waitFor: Different Process with pid %d found in Array", P->pid); } else { // P is not in the array - could have been handled by SIGCHLD already DEBUG("Process_waitFor: Process with pid %d not found in Array", P->pid); } } _childSignal(SIG_UNBLOCK); return P->status; } int Process_exitStatus(Process_T P) { assert(P); return P->status; // Trust SIGCHLD handler to set status } bool Process_isRunning(Process_T P) { assert(P); return Process_exitStatus(P) < 0; } OutputStream_T Process_outputStream(Process_T P) { assert(P); if (P->isdetached) return NULL; if (! P->out) P->out = OutputStream_new(P->stdin_pipe[1]); return P->out; } InputStream_T Process_inputStream(Process_T P) { assert(P); if (P->isdetached) return NULL; if (! P->in) P->in = InputStream_new(P->stdout_pipe[0]); return P->in; } InputStream_T Process_errorStream(Process_T P) { assert(P); if (P->isdetached) return NULL; if (! P->err) P->err = InputStream_new(P->stderr_pipe[0]); return P->err; } bool Process_terminate(Process_T P) { assert(P); return (kill(P->pid, SIGTERM) == 0); } bool Process_kill(Process_T P) { assert(P); return (kill(P->pid, SIGKILL) == 0); } // MARK: - Public methods T _Command_new(const char *path, ...) { T C; assert(path); if (! File_exist(path)) THROW(AssertException, "File '%s' does not exist", path); NEW(C); C->env = List_new(); C->args = List_new(); C->umask = DEFAULT_UMASK; va_list ap; va_start(ap, path); _buildArgs(C, path, ap); va_end(ap); return C; } void Command_free(T *C) { assert(C && *C); _freeElementsIn((*C)->args); List_free(&(*C)->args); _freeElementsIn((*C)->env); List_free(&(*C)->env); FREE((*C)->working_directory); FREE(*C); } void Command_appendArgument(T C, const char *argument) { assert(C); if (argument) List_append(C->args, Str_dup(argument)); } void Command_setUid(T C, uid_t uid) { assert(C); if (getuid() != 0) THROW(AssertException, "Only the super user can switch uid"); C->uid = uid; } uid_t Command_uid(T C) { assert(C); return C->uid; } void Command_setGid(T C, gid_t gid) { assert(C); if (getuid() != 0) THROW(AssertException, "Only the super user can switch gid"); C->gid = gid; } gid_t Command_gid(T C) { assert(C); return C->gid; } void Command_setUmask(T C, mode_t umask) { assert(C); C->umask = umask; } mode_t Command_umask(T C) { assert(C); return C->umask; } // Set the sub-process working directory. If NULL (the default) the sub-process // will inherit the calling process's current directory void Command_setDir(T C, const char *dir) { assert(C); if (dir) { if (! File_isDirectory(dir)) THROW(AssertException, "The new working directory '%s' is not a directory", dir); if (! File_isExecutable(dir)) THROW(AssertException, "The new working directory '%s' is not accessible", dir); } FREE(C->working_directory); C->working_directory = File_removeTrailingSeparator(Str_dup(dir)); } const char *Command_dir(T C) { assert(C); return C->working_directory; } // Env variables are stored in the environment list as "name=value" strings void Command_setEnv(Command_T C, const char *name, const char *value) { assert(C); assert(name); _removeEnv(C, name); List_append(C->env, Str_cat("%s=%s", name, value ? value : "")); } // Env variables are stored in the environment list as "name=value" strings void Command_vSetEnv(T C, const char *name, const char *value, ...) { assert(C); assert(name); _removeEnv(C, name); char *t = NULL; if (STR_DEF(value)) { va_list ap; va_start(ap, value); t = Str_vcat(value, ap); va_end(ap); } List_append(C->env, Str_cat("%s=%s", name, t?t:"")); FREE(t); } // Returns the value part from a "name=value" environment string const char *Command_env(T C, const char *name) { assert(C); assert(name); size_t len = strlen(name); char *e = _findEnv(C, name, len); if (e) return e + len + 1; return NULL; } List_T Command_command(T C) { assert(C); return C->args; } // MARK: - Execute // Setup and exec the child process static void Process_exec(Process_T P, T C) { int status = 0; _resetSignals(); errno = 0; if (C->working_directory) { if (! Dir_chdir(C->working_directory)) goto fail; } if (setsid() < 0) goto fail; if (!Process_setupChildPipes(P)) goto fail; int descriptors = System_descriptors(256); for (int i = 3; i < descriptors; i++) { if (i != P->ctrl_pipe[1]) close(i); } if (C->gid) { if (setgid(C->gid) < 0) goto fail; if (getgid() != C->gid) { errno = EPERM; goto fail; } } if (C->uid) { struct _usergroups ug = {.groups = {}, .ngroups = NGROUPS_MAX}; if (!_getUserGroups(C, &ug)) goto fail; if (setgroups(ug.ngroups, ug.groups) < 0) goto fail; if (setuid(C->uid) < 0) goto fail; if (getuid() != C->uid) { errno = EPERM; goto fail; } } umask(C->umask); char **args = _args(C); execve(args[0], args, _env(C)); fail: status = errno; if (status != 0) while (write(P->ctrl_pipe[1], &status, sizeof status) < 0); _exit(127); } // If the child process succeeded in calling execve, status is 0 static void Process_ctrl(Process_T P, int *status) { close(P->ctrl_pipe[1]); P->ctrl_pipe[1] = -1; if (read(P->ctrl_pipe[0], status, sizeof *status) != sizeof *status) *status = 0; else waitpid(P->pid, &(int){0}, 0); } /* The Execute function. We do not use posix_spawn(2) because it's not well suited for creating long-running daemon processes. Although posix_spawn is more efficient, its limitations makes it problematic for our use. Specifically: - The POSIX standard does not support calling setsid(2) in the child process, which is important to have the child detach from the controlling terminal. Some implementations do support setsid() unofficially via the flag POSIX_SPAWN_SETSID, but this is not standardized. - posix_spawn does not inherently handle the transition of privileges associated with setuid/setgid programs. - Closing "all" descriptors in the child before calling exec is not directly supported. While there is limited support for closing specific descriptors, there is no straightforward way to unconditionally close all potentially open descriptors. - There is no support for changing the working directory (chdir) in the child process before exec is called. This limitation can be significant, especially in daemon processes where changing to a specific directory is often required. - Inability to Change umask: posix_spawn lacks support for changing the file mode creation mask (umask) in the child process. - Limited flexibility during child setup: On Linux, posix_spawn typically uses clone(2) internally, while other systems might use vfork(2), both of which restrict what can be safely done during the child setup phase. Operations that might allocate memory, such as looking up user/group information (getpwuid, getgrouplist) or determining system limits, become problematic or impossible. Traditional fork/exec offers a bit more control and flexibility. With modern OSs supporting Copy-On-Write (COW), the issue of unnecessary memory address space duplication in the child before calling exec becomes less significant, albeit still an annoyance. */ Process_T Command_execute(T C) { assert(C); struct _block block = _block(); Process_T P = Process_new(); int status = Process_createPipes(P); if (status < 0) { status = -status; goto fail; } if ((P->pid = fork()) < 0) { status = errno; } else if (P->pid == 0) { Process_exec(P, C); } else { Process_ctrl(P, &status); } fail: Process_closeCtrlPipe(P); if (status != 0) { DEBUG("Command: failed -- %s\n", System_getError(status)); Process_free(&P); } else { // Add Process to the hash table indexed by PID. The table is used by the SIGCHLD // handler to find the Process object and update its status Process_T previous = Array_put(processTable, P->pid, P); if (previous) ERROR("Command: process with duplicate PID %d found in internal array\n", P->pid); Process_setupParentPipes(P); } _unblock(&block); errno = status; return P; } monit-5.35.2/libmonit/src/system/System.h0000644000016400001720000000610115007061157015235 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef SYSTEM_INCLUDED #define SYSTEM_INCLUDED /** * System routines * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * Returns a String describing the last system error * @return The last error message */ const char *System_lastError(void); /** * Returns a String describing the error code * @param error error code to lookup * @return The error string for the given code */ const char *System_getError(int error); /** * Prints the given error message to stderr and * abort(3) the application. If an AbortHandler callback * function is defined for the library, this function is called instead. * @param e A formatted (printf-style) message string */ void System_abort(const char *e, ...) __attribute__((format (printf, 1, 2))); /** * Prints the given error message to stderr. If an ErrorHandler * callback function is defined for the library, this function is called instead. * @param e A formatted (printf-style) message string */ void System_error(const char *e, ...) __attribute__((format (printf, 1, 2))); /** * If a DebugHandler function is defined for the library, call this function * with the given debug message. If a DebugHandler function is not defined * this method does nothing. * @param d A formatted (printf-style) debug string */ void System_debug(const char *d, ...) __attribute__((format (printf, 1, 2))); /** * Returns the number of available file descriptors for a process. * This method uses sysconf internally. If the guard * parameter is 0, return the value from sysconf. If * the guard parameter is > 0 and available descriptors is larger * than guard, return the guard value instead. * @param guard If guard is > 0 and available descriptors is larger * than guard, return the guard value instead. Otherwise if guard * is 0, return the maximum available file descriptors for a process * as reported by the system * @return A guarded number of available file descriptors for a process */ int System_descriptors(int guard); #endif monit-5.35.2/libmonit/src/system/Net.c0000644000016400001720000001115015007061157014472 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_STROPTS_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_SYS_FILIO_H #include #endif #include "system/Net.h" #include "system/System.h" /** * Implementation of the Net Facade for Unix Systems. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ---------------------------------------------------------------- Public */ bool Net_setNonBlocking(int socket) { return (fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) | O_NONBLOCK) != -1); } bool Net_setBlocking(int socket) { return (fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) & ~O_NONBLOCK) != -1); } bool Net_canRead(int socket, time_t milliseconds) { int r = 0; struct pollfd fds[1]; fds[0].fd = socket; fds[0].events = POLLIN; do { r = poll(fds, 1, (int)milliseconds); } while (r == -1 && errno == EINTR); return (r > 0); } bool Net_canWrite(int socket, time_t milliseconds) { int r = 0; struct pollfd fds[1]; fds[0].fd = socket; fds[0].events = POLLOUT; do { r = poll(fds, 1, (int)milliseconds); } while (r == -1 && errno == EINTR); return (r > 0); } ssize_t Net_read(int socket, void *buffer, size_t size, time_t timeout) { ssize_t n = 0; if (size > 0) { do { n = read(socket, buffer, size); } while (n == -1 && errno == EINTR); if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { if ((timeout == 0) || (Net_canRead(socket, timeout) == false)) { return 0; } do { n = read(socket, buffer, size); } while (n == -1 && errno == EINTR); } } return n; } ssize_t Net_write(int socket, const void *buffer, size_t size, time_t timeout) { ssize_t n = 0; if (size > 0) { do { n = write(socket, buffer, size); } while (n == -1 && errno == EINTR); if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { if ((timeout == 0) || (Net_canWrite(socket, timeout) == false)) { return 0; } do { n = write(socket, buffer, size); } while (n == -1 && errno == EINTR); } } return n; } bool Net_shutdown(int socket, int how) { return (shutdown(socket, how) == 0); } bool Net_close(int socket) { int r = 0; do { r = close(socket); } while (r == -1 && errno == EINTR); return (r == 0); } bool Net_abort(int socket) { int r; struct linger linger = {1, 0}; if (setsockopt(socket, SOL_SOCKET, SO_LINGER, &linger, sizeof linger) < 0) { ERROR("Net: setsockopt failed -- %s\n", System_lastError()); } do { r = close(socket); } while (r == -1 && errno == EINTR); return (r == 0); } monit-5.35.2/libmonit/src/system/Mem.h0000644000016400001720000001203515007061157014472 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MEM_INCLUDED #define MEM_INCLUDED /** * General purpose memory allocation methods. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * Allocate n bytes. * @param n number of bytes to allocate * @return A pointer to the newly allocated memory * @exception MemoryException if allocation failed * @exception AssertException if n <= 0 * @see AssertException.h, MemoryException.h * @hideinitializer */ #define ALLOC(n) Mem_alloc((n), __func__, __FILE__, __LINE__) /** * Allocate c objects of size n each. * Same as calling ALLOC(c * n) except this function also clear * the memory region before it is returned. * @param c number of objects to allocate * @param n object size in bytes * @return A pointer to the newly allocated memory * @exception MemoryException if allocation failed * @exception AssertException if c or n <= 0 * @see AssertException.h, MemoryException.h * @hideinitializer */ #define CALLOC(c, n) Mem_calloc((c), (n), __func__, __FILE__, __LINE__) /** * Allocate object p and clear the memory region * before the allocated object is returned. * @param p Object to allocate * @exception MemoryException if allocation failed * @see AssertException.h, MemoryException.h * @hideinitializer */ #define NEW(p) ((p) = CALLOC(1, (long)sizeof *(p))) /** * Deallocates p * @param p Object to deallocate * @hideinitializer */ #define FREE(p) ((void)(Mem_free((p), __func__, __FILE__, __LINE__), (p) = 0)) /** * Reallocate p with size n. * @param p pointer to reallocate * @param n new object size in bytes * @exception MemoryException if allocation failed * @exception AssertException if n <= 0 * @see AssertException.h, MemoryException.h * @hideinitializer */ #define RESIZE(p, n) ((p) = Mem_resize((p), (n), __func__, __FILE__, __LINE__)) /** * Allocate and return size bytes of memory. If * allocation failed this throws a MemoryException * @param size The number of bytes to allocate * @param func the callee * @param file location of caller * @param line location of caller * @return a pointer to the allocated memory * @exception MemoryException if allocation failed * @exception AssertException if n <= 0 * @see AssertException.h, MemoryException.h */ void *Mem_alloc(long size, const char *func, const char *file, int line); /** * Allocate and return memory for count objects, each of * size bytes. The returned memory is cleared. If allocation * failed this method throws a MemoryException * @param count The number of objects to allocate * @param size The size of each object to allocate * @param func the callee * @param file location of caller * @param line location of caller * @return a pointer to the allocated memory * @exception MemoryException if allocation failed * @exception AssertException if c or n <= 0 * @see AssertException.h, MemoryException.h */ void *Mem_calloc(long count, long size, const char *func, const char *file, int line); /** * Deallocate the memory pointed to by p * @param p The memory to deallocate * @param func the callee * @param file location of caller * @param line location of caller */ void Mem_free(void *p, const char *func, const char *file, int line); /** * Resize the allocation pointed to by p by size * bytes and return the changed allocation. If allocation failed this * method throws a MemoryException * @param p A pointer to the allocation to change * @param size The new size of p * @param func the callee * @param file location of caller * @param line location of caller * @return a pointer to the changed memory * @exception MemoryException if allocation failed * @exception AssertException if n <= 0 * @see AssertException.h, MemoryException.h */ void *Mem_resize(void *p, long size, const char *func, const char *file, int line); #endif monit-5.35.2/libmonit/src/system/Command.h0000644000016400001720000002077415007061157015343 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef COMMAND_INCLUDED #define COMMAND_INCLUDED #include "system/Process.h" #include "util/List.h" /** * A Command creates operating system processes. Each Command instance * manages a collection of process attributes. The Command_execute() method * creates a new sub-process with those attributes and the method can be invoked * repeatedly from the same instance to create new sub-processes with identical * or related attributes. * * Modifying a Command's attributes will affect processes subsequently created, * but will not affect previously created processes nor the calling process * itself. * * This class is reentrant but not thread-safe * * @see Process.h * @author https://tildeslash.com * @see https://mmonit.com * @file */ #define T Command_T typedef struct T *T; /** * Create a new Command object and set the operating system program with * arguments to execute. The ... variable argument list denotes * an optional sequence of arguments to the program. The arguments list can * be thought of as arg0, arg1, ..., argn. Together they describe a list of * zero or more pointers to null-terminated strings that represent the argument * list available to the executed program specified in path. Example: *
 * Command_new("/bin/ls")
 * Command_new("/bin/ls", "-lrt")
 * Command_new("/bin/sh", "-c", "ps -aef|egrep mmonit")
 * 
* @param path The program to execute, _without_ any arguments * @param ... An optional sequence of arguments to the program given in path * @exception AssertException if the program given in path does not exist. * @return A Command object */ #define Command_new(path, ...) _Command_new((path), ##__VA_ARGS__, NULL) /** Internal function. Use Command_new() */ T _Command_new(const char *path, ...) __attribute__((sentinel)); /** * Destroy A Command object and release allocated resources. Call this * method to release a Command object allocated with Command_new() * @param C A Command object reference */ void Command_free(T *C); /** @name Properties */ //@{ /** * Append an argument to the command that should be used to launch this executable. * @param C A Command object * @param argument A string argument */ void Command_appendArgument(T C, const char *argument); /** * Set the user id the sub-process should switch to on exec. If not set, the * uid of the calling process is used. Note that this process must run with * super-user privileges for the sub-process to be able to switch uid. In fact * it is a checked runtime error to call this method if this process does not * run with super-user privileges * @param C A Command object * @param uid The user id the sub-process should switch to when executed * @exception AssertException If this process is not run by the super-user or * with super-user privileges. */ void Command_setUid(T C, uid_t uid); /** * Returns the uid the sub-process should switch to on exec. * @param C A Command object * @return The user id the sub-process should use. Returns 0 * if not set, meaning the sub-process will run with the same * uid as this process. */ uid_t Command_uid(T C); /** * Set the group id the sub-process should switch to on exec. If not set, * the gid of the calling process is used. Note that this process must run * with super-user privileges for the sub-process to be able to switch gid * @param C A Command object * @param gid The group id the sub-process should switch to when executed * @exception AssertException If this process is not run by the super-user or * with super-user privileges. */ void Command_setGid(T C, gid_t gid); /** * Returns the group id the Command should switch to on exec. * @param C A Command object * @return The group id the sub-process should use. Returns 0 * if not set, meaning the sub-process will run with the same * gid as this process. */ gid_t Command_gid(T C); /** * Set the umask value for the sub-process. The default value if not set * is 022. See also https://en.wikipedia.org/wiki/Umask and man umask(2) * @param C A Command object * @param umask The new umask value, as a 3 digit octal number, e.g. 002 */ void Command_setUmask(T C, mode_t umask); /** * Returns the umask value for the sub-process. The default value is 022 * unless changed with Command_setUmask(). * @param C A Command object * @return The umask value for the sub-process */ mode_t Command_umask(T C); /** * Set the working directory for the sub-process. If the directory cannot * be changed to, the sub-process will exit with an error * @param C A Command object * @param dir The working directory for the sub-process * @exception AssertException if the directory does not exist or is not * accessible */ void Command_setDir(T C, const char *dir); /** * Returns the working directory for the sub-process. Unless previously * set, the returned value is NULL, meaning the calling process's current * directory * @param C A Command object * @return The working directory for the sub-process or NULL meaning the * calling process's current directory */ const char *Command_dir(T C); /** * Set or replace the environment variable identified by name. * The sub-process initially inherits the environment from the calling * process. Environment variables set with this method does not affect the * parent process and only apply to the sub-process. * @param C A Command object * @param name The environment variable to set or replace * @param value The value. A NULL value is converted to the empty string "" */ void Command_setEnv(T C, const char *name, const char *value); /** * Set or replace the environment variable identified by name. * The sub-process initially inherits the environment from the calling * process. Environment variables set with this method does not affect the * parent process and only apply to the sub-process. Example: *
 * Command_vSetEnv(C, "PID", "%ld", getpid()) -> PID=1234
 * 
* @param C A Command object * @param name The environment variable to set or replace * @param value The value. A NULL value is converted to the empty string "" */ void Command_vSetEnv(T C, const char *name, const char *value, ...) __attribute__((format (printf, 3, 4))); /** * Returns the value of the environment variable identified by * name. * @param C A Command object * @param name The environment variable to get the value of * @return The value for name or NULL if name was not found */ const char *Command_env(T C, const char *name); /** * Returns the operating system program with arguments to be executed by * this Command. The first element in the list is the path to the program * and subsequent elements are arguments to the program. Elements in the * list are C-strings. * @param C A Command object * @return A list with the operating system program with arguments to * execute. The first element in the list is the program. */ List_T Command_command(T C); //@} /** * Create a new sub-process using the attributes of this Command object. * The new sub-process will execute the command and arguments given in * Command_new(). The caller is responsible for releasing the returned * Process_T object by calling Process_free(). If creating the new * sub-process failed, NULL is returned and errno is set to indicate the * error. Use e.g. System_lastError() to get a description of the error * that occurred. * @param C A Command object * @return A new Process_T object representing the sub-process or NULL * if execute failed. */ Process_T Command_execute(T C); #undef T #endif monit-5.35.2/libmonit/src/system/Time.h0000644000016400001720000003647215007061157014665 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef TIME_INCLUDED #define TIME_INCLUDED /** * Time is an abstraction of date and time. Time is stored internally * as the number of seconds and microseconds since the epoch, January 1, * 1970 00:00 UTC. * * @author https://tildeslash.com * @see https://mmonit.com * @file */ /** @name class methods */ //@{ /** * Factory method for building a specific time in UTC (GMT). * @param year the year ~ (1970..2037) for this time * @param month the month (January=1..December=12) * @param day the day of the month (1..31) * @param hour the hour (0..23) * @param min the minutes (0..59) * @param sec the seconds of the minute (0..61). Yes, seconds can range * from 0 to 61. This allows the system to inject leap seconds. * @return A time_t representing the specified time in UTC * @exception AssertException If a parameter is outside the valid range */ time_t Time_build(int year, int month, int day, int hour, int min, int sec); /** * Returns a Unix timestamp representation of an ISO-8601 or RFC 7231 date * string in the GMT timezone. If the given string contains timezone offset * the time is expected to be in local time and the offset is added to the * returned timestamp to make the time UTC. If the string does not contain * timezone information, the time is expected and assumed to be in the GTM * timezone, i.e. in UTC. Example: *
 *  Time_toTimestamp("2013-12-15 00:12:58") -> 1387066378
 *  Time_toTimestamp("2013-12-14 19:12:58-05:00") -> 1387066378
 *  Time_toTimestamp("Sun, 15 Dec 2013 00:12:58 GMT") -> 1387066378
 * 
* @param s The Date String to parse. Time is expected to be in UTC, * but local time with timezone information is also allowed. The format * of the date string should be ISO-8601 or RFC 7231 IMF-fixdate * @return A UTC time representation of s * @exception AssertException If the parameter value cannot be converted * to a valid timestamp */ time_t Time_toTimestamp(const char *s); /** * Returns a Date, Time or DateTime representation of an ISO-8601 or RFC 7231 * date string. Fields follows the convention of the tm structure where, * tm_hour = hours since midnight [0-23], tm_min = minutes after the hour * [0-59], tm_sec = seconds after the minute [0-60], tm_mday = day of the month * [1-31] and tm_mon = months since January [0-11]. tm_gmtoff is set to the * offset from UTC in seconds if the time string contains timezone information, * otherwise tm_gmtoff is set to 0. On systems without tm_gmtoff, (Solaris), * the member, tm_wday is set to gmt offset instead as this property is ignored * by mktime on input.The exception is tm_year which contains the year * literal and not years since 1900 which is the convention. All other * fields in the structure are set to zero. If the given date string * s contains both date and time all the fields mentioned above * are set, otherwise only the Date or Time fields are set. * @param s The Date String to parse. Time is expected to be in UTC, * but local time with timezone information is also allowed. The format * of the date string should be ISO-8601 or RFC 7231 IMF-fixdate * @param t A pointer to a tm structure * @return A pointer to the tm structure representing the date of s * @exception AssertException If the parameter value cannot be converted * to a valid Date, Time or DateTime */ struct tm *Time_toDateTime(const char *s, struct tm *t); /** * Returns the time since the epoch measured in seconds. * @return A time_t representing the systems notion of seconds since the * epoch (January 1, 1970, 00:00:00 GMT) in Coordinated * Universal Time (UTC). * @exception AssertException If time could not be obtained */ time_t Time_now(void); /** * Returns the time since the epoch measured in milliseconds. * @return A 64 bits long representing the systems notion of milliseconds * since the epoch (January 1, 1970, 00:00:00 GMT) in * Coordinated Universal Time (UTC). * @exception AssertException If time could not be obtained */ long long Time_milli(void); /** * Returns the time since the epoch measured in microseconds. * @return A 64 bits long representing the systems notion of microseconds * since the epoch (January 1, 1970, 00:00:00 GMT) in * Coordinated Universal Time (UTC). * @exception AssertException If time could not be obtained */ long long Time_micro(void); /** * Returns a monotonic time at some unspecified starting point as a * structure with various temporal resolution of the same time. * This time is not affected by NTP time jumps, but may change in * frequency on platforms that don't support CLOCK_MONOTONIC_RAW. * @return A time_monotonic_t structure with various resolutions of the * same time since the clock started. * @exception AssertException If time could not be obtained */ struct time_monotonic_t { time_t seconds; long long milliseconds; long long microseconds; long long nanoseconds; } Time_monotonic(void); /** * Returns the second of the minute for time. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The second of the minute (0..61) in local time */ int Time_seconds(time_t time); /** * Returns the minute of the hour for time. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The minute of the hour (0..59) in local time */ int Time_minutes(time_t time); /** * Returns the hour of the day for time. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The hour of the day (0..23) in local time */ int Time_hour(time_t time); /** * Returns the day of week expressed as number of days since Sunday. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The day of the week (Sunday=0..Saturday=6) in local time */ int Time_weekday(time_t time); /** * Returns the day of the month for time. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The day of the month (1..31) in local time */ int Time_day(time_t time); /** * Returns the month of the year. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The month of the year (January=1..December=12) in local time */ int Time_month(time_t time); /** * Returns the year of time. * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return The year of time in the range ~ (1970..2037) in local time */ int Time_year(time_t time); /** * Returns a RFC1123 formated date string minus the timezone for the given * time. The returned string is computed in the local timezone. The result * buffer must be large enough to hold at least 26 bytes. Example: *
 * Tue, 15 Sep 2009 22:01:25
 * 
* @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @param result The buffer to write the date string too * @return a pointer to the result buffer or NULL if result * was NULL */ char *Time_localStr(time_t time, char result[static 26]); /** * Returns a RFC1123 formated date string for the given GMT time. The returned * string represent the specified time in UTC. The submitted result buffer must * be large enough to hold at least 30 bytes. Result example: *
 * Tue, 15 Sep 2009 21:01:25 GMT
 * 
* @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @param result The buffer to write the date string too * @return a pointer to the result buffer or NULL if result * was NULL */ char *Time_str(time_t time, char result[static 30]); /** * Returns time as a date string in local time zone. The format * parameter determines the format of the string. The format specifiers * are the same as those used by strftime(3). For instance to * specify a RFC822 time string on the format "Wed, 05 Feb 2003 01:16:44 * +0100" the following format string is used: * "%a, %d %b %Y %H:%M:%S %z" * @param result The buffer to write the date string too * @param size Size of the result buffer * @param format A strftime format string * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return A pointer to the result buffer * @exception AssertException If format or result * is NULL */ char *Time_localFmt(char *result, int size, const char *format, time_t time); /** * Returns time as a date string in UTC. The format * parameter determines the format of the string. The format specifiers * are the same as those used by strftime(3). For instance to * specify a RFC822 time string on the format "Wed, 05 Feb 2003 01:16:44 * +0100" the following format string is used: * "%a, %d %b %Y %H:%M:%S %z" * @param result The buffer to write the date string too * @param size Size of the result buffer * @param format A strftime format string * @param time Number of seconds since the Epoch * (00:00:00 UTC, January 1, 1970) * @return A pointer to the result buffer * @exception AssertException If format or result * is NULL */ char *Time_fmt(char *result, int size, const char *format, time_t time); /** * Returns a uptime formatted string for the given seconds. That is, convert * sec to days, hours and minutes and return a string on the * form, 7d, 17h, 34m. The submitted result buffer must be * large enough to hold at least 24 bytes. * @param sec Number of seconds to split up into, days, hours, minutes and * seconds. * @param result The buffer to write the uptime string too * @return a pointer to the result buffer or NULL if result * was NULL */ char *Time_uptime(long sec, char result[static 24]); /** * Returns 1 if the given time is in the range of the specified cron * format string, otherwise 0. The cron string consists of 5 fields separated * with white-space. All fields are required: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
NameAllowed valuesSpecial characters
Minutes0-59* , -
Hours0-23* , -
Day of month1-31* , -
Month1-12 (1=jan, 12=dec)* , -
Day of week0-6 (0=sunday, 6=saturday)* , -
*

Special characters

*
    *
  • * The asterisk indicates that the expression will match * for all values of the field; e.g., using an asterisk in the 4th * field (month) would indicate every month. *
  • - (hyphen) Hyphens are used to define ranges. For example, * 8-9 in the hour field indicate between 8AM and 9AM. Note that * range is from time1 until and including time2. That is, from 8AM * and until 10AM unless minutes are set. Another example, 1-5 in the * weekday field, specify from monday to friday (including friday). *
  • , (comma) Comma are used to specify a sequence. For example, * 17,18 in the day field indicate the 17th and 18th day of the month. * A sequence can also include ranges. For example, using * 1-5,0 in the weekday field indicate monday to friday and sunday. *
*

Example

*
    *
  • "* 9-10 * * 1-5" Matches 9AM-10AM every weekday *
  • "* 0-5,23 * * 0,6" Matches between 0AM-5AM and 11PM each saturday and sunday *
* @param cron A crontab format string. e.g. "* 8-9 * * *" * @param time The time to test if in range of the cron format * @return 1 if time is in cron range, 0 if not, -1 if parsing failed. */ int Time_incron(const char *cron, time_t time); /** * Suspends the calling process or thread for the specified * duration in microseconds. If sleep is interrupted by a signal, * the function aborts sleep and returns the number of remaining * microseconds. * @param microseconds The duration of the sleep in microseconds * @return 0 if sleep was completed, -1 if microseconds is invalid * (negative or would overflow timespec on 32-bit systems), * or remaining microseconds if interrupted by a signal */ long long Time_usleep(long long microseconds); /** * Suspends the calling process or thread for the specified * duration in microseconds. Unlike Time_usleep, this function is * resilient to interruptions by signals. If a signal interrupts * sleep, the function will continue to sleep for the remainder * of the specified duration after handling of the signal. * @param microseconds The duration of the sleep in microseconds * @return true if sleep was completed, false if microseconds is invalid */ bool Time_usleepComplete(long long microseconds); /** * Suspends the calling process or thread for the specified * duration in seconds. If sleep is interrupted by a signal, * the function aborts sleep and returns the number of remaining * seconds. * @param seconds The duration of the sleep in seconds * @return 0 if sleep was completed, -1 if seconds is invalid, * or remaining seconds if interrupted by a signal */ long Time_sleep(long seconds); /** * Suspends the calling process or thread for the specified * duration in seconds. Unlike Time_sleep, this function is * resilient to interruptions by signals. If a signal interrupts * sleep, the function will continue to sleep for the remainder * of the specified duration after handling of the signal. * @param seconds The duration of the sleep in seconds * @return true if sleep was completed, false if seconds is invalid */ bool Time_sleepComplete(long seconds); /** * Executes a predicate function with exponential backoff, retrying * up to 10 times with increasing wait intervals. Initially, minimal * wait times are applied for quick retries, with subsequent wait times * growing exponentially. The total worst-case wait time is approximately * 5 seconds, optimizing between retry speed and recovery time. * @param predicate The predicate function to be executed, returning true * on success. * @param args Optional arguments for the predicate, or NULL if not needed. * @return True if the predicate succeeds within the retries, otherwise false. */ bool Time_backoff(bool predicate(void *args), void *args); //@} #endif monit-5.35.2/libmonit/src/system/Process.h0000644000016400001720000001602315007061157015373 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef PROCESS_INCLUDED #define PROCESS_INCLUDED #include #include "io/InputStream.h" #include "io/OutputStream.h" /** * A Process represent an operating system process. A new Process * object is created via Command_execute(). * * The sub-process represented by this Process does not have its own terminal * or console. All its standard I/O (i.e. stdin, stdout, stderr) operations * will be redirected to the parent process where they can be accessed using * the streams obtained using the methods Process_outputStream(), * Process_inputStream(), and Process_errorStream(). Your program can * then use these streams to feed input to and get output from the sub-process. * * If the sub-process is a daemon process, you might want to call * Process_detach() to close down stdio streams to the sub-process after you * have verified that the sub-process is up and running by first calling * Process_isRunning(). If the process is _not_ running, then reading from * Process_inputStream() or from Process_errorStream() can be useful to * debug the reason why it is not running. Daemon processes usually have an * initialization phase where it will print any errors during startup to stdout * or stderr before exiting. * * The sub-process continues executing until it stops or until it is terminated * with either Process_terminate() or Process_kill(). Unless Process_detach() * has been called, calling Process_free() will also terminate the sub-process. * *

Environment

* The Process inherits the environment from the calling process. Clients can * also call Command_setEnv() to set or reset environment variables as needed * before calling Command_execute(). Environment variables set this way * will be added to the sub-process at execution time. * * This class is reentrant but not thread-safe * * @see Command.h * @author https://tildeslash.com * @see https://mmonit.com * @file */ #define T Process_T typedef struct T *T; /** * Destroy a Process object and free allocated resources. Clients * should call this method when they are done with the Process object. * Unless Process_detach() has been called, this method will kill the * sub-process represented by this Process object if it is still running * and close down stdio to the sub-process. * @param P a Process object reference */ void Process_free(T *P); /** @name Properties */ //@{ /** * Returns true if we have detached from the sub-process. I.e. if * Process_detach() has been called. * @param P A Process object * @return True if Process_detach() has been called, otherwise false */ bool Process_isdetached(T P); /** * Returns the Process's identification number * @param P A Process object * @return The process identification number */ pid_t Process_pid(T P); /** * Causes the current thread to wait, if necessary, until the sub-process * represented by this Process object has terminated. This method returns * immediately if the sub-process has already terminated. If the sub-process * has not yet terminated, the calling thread will be blocked until the * sub-process exits. By convention, the value 0 indicates normal termination. * @param P A Process object * @return The exit status of the sub-process or -1 if an error occur. * Investigate errno for a description of the error */ int Process_waitFor(T P); /** * Returns the Process exit status. If the sub-process is still running, this * method returns -1, otherwise the sub-process exit status. By convention, * the value 0 indicates normal termination. * @param P A Process object * @return The exit status of the sub-process or -1 if the sub-process is still * running. */ int Process_exitStatus(T P); /** * Returns true if the sub-process is running otherwise false * @param P A Process object * @return True if Process is running otherwise false */ bool Process_isRunning(T P); /** * Returns the output stream connected to the normal input of the sub-process. * Output to the stream is piped into the standard input of the process * represented by this Process object. * @param P A Process object * @return The output stream connected to the normal input of the sub-process. */ OutputStream_T Process_outputStream(T P); /** * Returns the input stream connected to the normal output of the sub-process. * The stream obtains data piped from the standard output of the process * represented by this Process object. * @param P A Process object * @return The input stream connected to the normal output of the sub-process. */ InputStream_T Process_inputStream(T P); /** * Returns the input stream connected to the error output of the sub-process. * The stream obtains data piped from the error output of the process * represented by this Process object. * @param P A Process object * @return The input stream connected to the error output of the sub-process. */ InputStream_T Process_errorStream(T P); //@} /** * Close stdio streams to the sub-process represented by this Process_T * object. Call this method if the sub-process is a daemon process and * there is no more need to communicate or read output from the sub-process. * Calling this method will also ensure that the sub-process will continue * running even when this Process object is released with Process_free() * @param P A Process object */ void Process_detach(T P); /** * Terminate the sub-process. The sub-process is terminated by sending * it a termination signal (SIGTERM). Note that SIGTERM can be ignored * or blocked by a process * @param P A Process object * @return True if signaling the sub-process succeed, otherwise false * and errno is set to indicate the error */ bool Process_terminate(T P); /** * Kill the sub-process. The sub-process is destroyed by sending * it a termination signal (SIGKILL). While SIGTERM may be blocked * by a process, SIGKILL cannot be blocked and will kill the process * @param P A Process object * @return True if signaling the sub-process succeed, otherwise false * and errno is set to indicate the error */ bool Process_kill(T P); #undef T #endif monit-5.35.2/libmonit/src/system/Random.c0000644000016400001720000000541715007061157015175 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_RANDOM_H #include #endif #include "io/File.h" #include "system/Time.h" #include "system/Random.h" /** * Implementation of the Random Facade for Unix Systems. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ #if ! defined HAVE_ARC4RANDOM_BUF static pthread_once_t once_control = PTHREAD_ONCE_INIT; #endif /* --------------------------------------------------------------- Private */ #if ! defined HAVE_ARC4RANDOM_BUF static void _seed_once(void) { srandom((unsigned)(Time_now() + getpid())); } #endif /* ---------------------------------------------------------------- Public */ bool Random_bytes(void *buf, size_t nbytes) { #ifdef HAVE_ARC4RANDOM_BUF arc4random_buf(buf, nbytes); return true; // arc4random_buf doesn't fail #else pthread_once(&once_control, _seed_once); #ifdef HAVE_GETRANDOM return (getrandom(buf, nbytes, 0) == (ssize_t)nbytes); #else int fd = File_open("/dev/urandom", "r"); if (fd >= 0) { ssize_t bytes = read(fd, buf, nbytes); close(fd); return (bytes >= 0 && (size_t)bytes == nbytes); } // Fallback to random() char *_buf = buf; for (size_t i = 0; i < nbytes; i++) { _buf[i] = random() % 256; } return true; #endif #endif } unsigned long long Random_number(void) { unsigned long long random; Random_bytes(&random, sizeof(random)); return random; } monit-5.35.2/libmonit/src/system/System.c0000644000016400001720000000573315007061157015242 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_RANDOM_H #include #endif #include "Str.h" #include "system/System.h" /** * Implementation of the System Facade for Unix Systems. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ extern void(*_AbortHandler)(const char *error, va_list ap); extern void(*_ErrorHandler)(const char *error, va_list ap); extern void(*_DebugHandler)(const char *info, va_list ap); /* ---------------------------------------------------------------- Public */ const char *System_lastError(void) { return strerror(errno); } const char *System_getError(int error) { return strerror(error); } void System_abort(const char *e, ...) { va_list ap; va_start(ap, e); if (_AbortHandler) _AbortHandler(e, ap); else { vfprintf(stderr, e, ap); abort(); } va_end(ap); } void System_error(const char *e, ...) { va_list ap; va_start(ap, e); if (_ErrorHandler) _ErrorHandler(e, ap); else vfprintf(stderr, e, ap); va_end(ap); } void System_debug(const char *d, ...) { if (_DebugHandler) { va_list ap; va_start(ap, d); _DebugHandler(d, ap); va_end(ap); } } int System_descriptors(int guard) { int fileDescriptors = (int)sysconf(_SC_OPEN_MAX); if (fileDescriptors < 2) fileDescriptors = getdtablesize(); assert(fileDescriptors > 2); if (guard > 0) { if (fileDescriptors > guard) fileDescriptors = guard; } return fileDescriptors; } monit-5.35.2/libmonit/src/system/Random.h0000644000016400001720000000300715007061157015173 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef RANDOM_INCLUDED #define RANDOM_INCLUDED /** * Random routines * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * Initialize the buf of size nbytes with random data. * @param buf The target buffer * @param nbtyes The target buffer size in bytes * @return true on success, otherwise false */ bool Random_bytes(void *buf, size_t nbytes); /** * Get a random number * @return random number */ unsigned long long Random_number(void); #endif /* Random_h */ monit-5.35.2/libmonit/src/Bootstrap.h0000644000016400001720000000574015007061157014412 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef BOOTSTRAP_INCLUDED #define BOOTSTRAP_INCLUDED /** * Temporary interface for bootstrapping libmonit from Monit. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * Bootstrap libmonit. This method should be called from Monit at startup */ void Bootstrap(void); /** * Set the function to call if a fatal error occurs in the library. In * practice this means Out-Of-Memory errors or uncatched exceptions. * Clients may optionally provide this function. If not provided * the library will call abort(3) upon encountering a * fatal error. This method provide clients with means to close down * execution gracefully. It is an unchecked runtime error to continue * using the library after the abortHandler was called. * @param abortHandler The handler function to call should a fatal * error occur in the library. An explanatory error message is * passed to the handler function in the string error * @see Exception.h */ void Bootstrap_setAbortHandler(void(*abortHandler)(const char *error, va_list ap)); /** * Set the function the library should call for (logging) error messages. * If not provided, the library will write error messages to stderr. * @param errorHandler The handler function to call when the library * emits an error message. The error message is passed to the handler * function in the string error with optional variable * arguments. */ void Bootstrap_setErrorHandler(void(*errorHandler)(const char *error, va_list ap)); /** * Set the function the library should call for (logging) debug messages. * If not provided, the library will not write debug messages. * @param debugHandler The handler function to call when the library * emits a debug message. The message is passed to the handler function in * the string info with optional variable arguments. */ void Bootstrap_setDebugHandler(void(*debugHandler)(const char *info, va_list ap)); #endif monit-5.35.2/libmonit/src/Bootstrap.c0000644000016400001720000000402515007061157014400 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include "Thread.h" #include "Exception.h" #include "Bootstrap.h" /** * Implementation of the Bootstrap interface * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ void(*_AbortHandler)(const char *error, va_list ap) = NULL; void(*_ErrorHandler)(const char *error, va_list ap) = NULL; void(*_DebugHandler)(const char *info, va_list ap) = NULL; /* ---------------------------------------------------------------- Public */ void Bootstrap(void) { Exception_init(); Thread_init(); } void Bootstrap_setAbortHandler(void(*abortHandler)(const char *error, va_list ap)) { _AbortHandler = abortHandler; } void Bootstrap_setErrorHandler(void(*errorHandler)(const char *error, va_list ap)) { _ErrorHandler = errorHandler; } void Bootstrap_setDebugHandler(void(*debugHandler)(const char *info, va_list ap)) { _DebugHandler = debugHandler; } monit-5.35.2/libmonit/src/util/0000755000016400001720000000000015007061157013313 500000000000000monit-5.35.2/libmonit/src/util/StringBuffer.h0000644000016400001720000001647615007061157016022 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef STRINGBUFFER_INCLUDED #define STRINGBUFFER_INCLUDED /** * A StringBuffer implements a mutable sequence of characters. * Indexing starts at 0 and it is a checked runtime error to access * index out of the range. * * This class is reentrant but not thread-safe * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define T StringBuffer_T typedef struct T *T; /** * Constructs a string buffer so that it represents the same sequence of * characters as the string argument; in other words, the initial contents * of the string buffer is a copy of the argument string. * @param s the initial contents of the buffer * @return A new StringBuffer object * @exception MemoryException if allocation failed */ T StringBuffer_new(const char *s); /** * Factory method, create an empty string buffer * @param hint The initial capacity of the buffer in bytes (hint > 0) * @return A new StringBuffer object * @exception AssertException if hint is less than or equal to 0 * @exception MemoryException if allocation failed */ T StringBuffer_create(int hint); /** * Destroy a StringBuffer object and free allocated resources * @param S a StringBuffer object reference */ void StringBuffer_free(T *S); /** * The characters of the String argument are appended, in order, to the * contents of this string buffer, increasing the length of this string * buffer by the length of the argument. * @param S StringBuffer object * @param s A string with optional var args * @return a reference to this StringBuffer * @exception MemoryException if allocation was used and failed */ T StringBuffer_append(T S, const char *s, ...) __attribute__((format (printf, 2, 3))); /** * The characters of the String argument are appended, in order, to the * contents of this string buffer, increasing the length of this string * buffer by the length of the arguments. * @param S StringBuffer object * @param s A string with optional var args * @param ap A variable argument list * @return a reference to this StringBuffer * @exception MemoryException if allocation was used and failed */ T StringBuffer_vappend(T S, const char *s, va_list ap) __attribute__((format (printf, 2, 0))); /** * Replace all occurrences of a with b. Example: *
 * StringBuffer_T b = StringBuffer_new("foo bar baz foo foo bar baz");
 * StringBuffer_replace(b, "baz", "bar") -> "foo bar bar foo foo bar bar"
 * StringBuffer_replace(b, "foo bar ", "") -> "bar foo bar"
 * 
* @param S StringBuffer object * @param a The sub-string to be replaced with b * @param b The string to replace a * @return The number of replacements that took place * @exception MemoryException if allocation was used and failed */ int StringBuffer_replace(T S, const char *a, const char *b); /** * Remove (any) leading and trailing white space [ \\t\\r\\n]. Example *
 * StringBuffer_T b = StringBuffer_new("\t 'foo bar' \n");
 * StringBuffer_trim(b) -> "'foo bar'"
 * 
* @param S StringBuffer object * @return a reference to this StringBuffer */ T StringBuffer_trim(T S); /** * Remove all characters from the given index position and * to the end of the StringBuffer. The index parameter must be greater * than or equal to 0 and less than the length of the StringBuffer. * @param S StringBuffer object * @param index The position of the buffer to start truncating * @exception AssertException if the index parameter is negative * or greater than or equal to the StringBuffer length. * @return a reference to this StringBuffer */ T StringBuffer_delete(T S, int index); /** * Locate the first occurrence of the string s * in the StringBuffer. Example: *
 * StringBuffer_T b = StringBuffer_new("foo bar");
 * StringBuffer_indexOf(b, "foo") ->  0
 * StringBuffer_indexOf(b, "bar") ->  4
 * StringBuffer_indexOf(b, "a")   ->  5
 * StringBuffer_indexOf(b, "xy")  -> -1
 * 
* @param S StringBuffer object * @param s The string to search for in the buffer * @return The index of the first occurrence of s in the * buffer or -1 if not found. */ int StringBuffer_indexOf(T S, const char *s); /** * Locate the last occurrence of the string s * in the StringBuffer. * @param S StringBuffer object * @param s The string to search for in the buffer * @return The index of the last occurrence of s in the * buffer or -1 if not found. */ int StringBuffer_lastIndexOf(T S, const char *s); /** * Returns a substring of characters currently contained in this character * sequence. The substring begins at the specified index and extends to the * end of this sequence * @param S StringBuffer object * @param index The start index of the substring * @return A substring of StringBuffer * @exception AssertException if the index parameter is negative * or greater than or equal to the StringBuffer length. */ const char *StringBuffer_substring(T S, int index); /** * Returns the length (character count) of this string buffer not * including the last '\\0' char used to terminate a C-string. * @param S StringBuffer object * @return the length of the sequence of characters currently represented * by this string buffer not including the last NUL character. */ int StringBuffer_length(T S); /** * Clears the contents of the string buffer and set buffer length to 0. * @param S StringBuffer object * @return a reference to this StringBuffer */ T StringBuffer_clear(T S); /** * Returns a string representing the data in this string buffer. * @param S StringBuffer object * @return a string representation of the string buffer */ const char *StringBuffer_toString(T S); /** * Returns the content of this string buffer as gzip compressed data (binary data). * @param S StringBuffer object * @param level compression level. A number between 0 and 9 where 1 gives * best speed, 9 gives best compression, 0 gives no compression. 6 is a good value. * @param length The number of bytes in the returned data is stored in length * @return The compressed data representing this string buffer. If the buffer is * empty, NULL is returned and length set to 0. * @exception AssertException if level is not in [0..9] or if compression failed */ const void *StringBuffer_toCompressed(T S, int level, size_t *length); #undef T #endif monit-5.35.2/libmonit/src/util/Array.h0000644000016400001720000001277115007061157014472 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef ARRAY_INCLUDED #define ARRAY_INCLUDED /** * A simple Sparse Array keyed on int with values of any type. * The array supports integer keys in the full range (including negative * values) and stores values of any pointer type. Note that iterating * from i = 0 to Array_length does not guarantee a continuous set of * values. Use Array_map to visit all values or Array_get to look up * a specific value by key. The 'hint' parameter in Array_new is used * to estimate the initial array size for efficient storage based on * the expected number of elements. * * Performance: Average time complexity for insertion, lookup, and * deletion is generally O(1), assuming a well-distributed key space * and a reasonable load factor. * * This class is reentrant but not thread-safe * * @author https://tildeslash.com * @see https://mmonit.com * @file */ #define T Array_T typedef struct T *T; /** * Create a new Sparse Array object * @param hint An estimate of the number of entries the Array is expected to * contain; accurate values of hint may improve performance, but * any nonnegative value is acceptable. * @return A new Sparse Array object * @exception MemoryException if allocation failed */ T Array_new(int hint); /** * Destroy a Sparse Array object and release allocated resources. * @param S A Sparse Array object reference */ void Array_free(T *S); /** * Adds the key-value pair given by key and value * to Array. If the Array already holds key, value * overwrites the previous value, and returns the previous value. * Otherwise key and value are added to the * Array, which grows by one entry, and Array_put() returns NULL. * @param S A Sparse Array object * @param key An int value * @param value A value reference. It's the callers responsibility * to maintain memory management of the value. * @return The previous value for key or NULL if key is new * @exception MemoryException if allocation failed */ void *Array_put(T S, int key, void *value); /** * Returns the value associated with key * @param S A Sparse Array object * @param key The key to lookup * @return The value associated with key or NULL if Array does * not hold key. */ void *Array_get(T S, int key); /** * Removes the key-value pair from Array if key was found in Array. * The removed value is returned. If Array does not hold key, this * method has no effect and returns NULL. * @param S A Sparse Array object * @param key The key to lookup * @return The value associated with key or NULL if Array does * not hold key. */ void *Array_remove(T S, int key); /** * Returns the number of key-value pairs in Array * @param S A Sparse Array object * @return The number of entries in the Array */ int Array_length(T S); /** * Apply the visitor function, apply for each key-value pair in * Array. Clients can pass an application specific pointer, ap, * to Array_map() and this pointer is passed along to the apply * function on each call. It is a checked runtime error for apply * to change the Array. * @param S A Sparse Array object * @param apply The function to apply. Note that value is the address to the * value object * @param ap An application-specific pointer. If such a pointer is * not needed, just use NULL * @exception AssertException if apply changes the Array */ void Array_map(T S, void apply(int key, void **value, void *ap), void *ap); /** * Search the Array for a particular value using a predicate * function and a needle. If the predicate function returns true for a * value, that value is returned. If no matching value is found, the * function returns NULL. The average time complexity is O(n), assuming * uniform key distribution. * @param S A Sparse Array object * @param predicate The predicate function used for comparison. It should * return true if a value in the array matches the needle, otherwise false. * @param needle A pointer to a search term used by the predicate function * to compare with a value in the array. * @return A pointer to the value in the Sparse Array that satisfies the * predicate, or NULL if no such value is found. * @exception AssertException if predicate changes the Array */ void *Array_find(T S, bool predicate(void *value, void *needle), void *needle); #undef T #endif monit-5.35.2/libmonit/src/util/Str.c0000644000016400001720000002732015007061157014153 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "NumberFormatException.h" #include "system/System.h" #include "Str.h" /** * Implementation of the Str interface * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* -------------------------------------------------------- Public Methods */ char *Str_chomp(char *s) { if (STR_DEF(s)) { for (char *p = s; *p; p++) if (*p == '\r' || *p == '\n') { *p = 0; break; } } return s; } char *Str_trim(char *s) { return (Str_ltrim(Str_rtrim(s))); } char *Str_ltrim(char *s) { if (STR_DEF(s) && isspace(*s)) { int i, j; for (j = 0; s[j]; j++) ; for (i = 0; isspace(s[i]); i++) ; memmove(s, s + i, j - i); s[j - i] = 0; } return s; } char *Str_rtrim(char *s) { if (STR_DEF(s)) for (ssize_t j = strlen(s) - 1; j >= 0 && isspace(s[j]); j--) s[j] = 0; return s; } char *Str_unquote(char *s) { if (STR_DEF(s)) { char *t = s; // Left unquote while (*t == 34 || *t == 39 || isspace(*t)) t++; if (t != s) { char *u = s; for (; *t; t++, u++) *u = *t; t = u; } else while (*t) t++; // Right unquote do *(t--) = 0; while (t > s && (*t == 34 || *t == 39 || isspace(*t))); } return s; } char *Str_toLower(char *s) { if (s) for (int i = 0; s[i]; i++) s[i] = tolower(s[i]); return s; } char *Str_toUpper(char *s) { if (s) for (int i = 0; s[i]; i++) s[i] = toupper(s[i]); return s; } bool Str_isInt(const char *s) { char *e; if (STR_UNDEF(s)) return false; errno = 0; strtol(s, &e, 10); if (errno || (e == s)) return false; return true; } int Str_parseInt(const char *s) { int i; char *e; if (STR_UNDEF(s)) THROW(NumberFormatException, "For input string null"); errno = 0; i = (int)strtol(s, &e, 10); if (errno || (e == s)) THROW(NumberFormatException, "For input string %s -- %s", s, System_getError(errno)); return i; } long long Str_parseLLong(const char *s) { char *e; long long l; if (STR_UNDEF(s)) THROW(NumberFormatException, "For input string null"); errno = 0; l = strtoll(s, &e, 10); if (errno || (e == s)) THROW(NumberFormatException, "For input string %s -- %s", s, System_getError(errno)); return l; } double Str_parseDouble(const char *s) { char *e; double d; if (STR_UNDEF(s)) THROW(NumberFormatException, "For input string null"); errno = 0; d = strtod(s, &e); if (errno || (e == s)) THROW(NumberFormatException, "For input string %s -- %s", s, System_getError(errno)); return d; } char *Str_replaceChar(char *s, char o, char n) { if (s) { for (char *t = s; *t; t++) if (*t == o) *t = n; } return s; } bool Str_startsWith(const char *a, const char *b) { if (a && b) { do { if (toupper(*a) != toupper(*b)) return false; if (*a++ == 0 || *b++ == 0) break; } while (*b); return true; } return false; } bool Str_endsWith(const char *a, const char *b) { if (a && b) { size_t i = 0, j = 0; for (i = strlen(a), j = strlen(b); (i && j); i--, j--) if (toupper(a[i]) != toupper(b[j])) return false; return (i >= j); } return false; } char *Str_sub(const char *a, const char *b) { if (a && STR_DEF(b)) { const char *p, *q; while (*a) { if (toupper(*a) == toupper(*b)) { p = a; q = b; do if (! *q) return (char*)a; while (toupper(*p++) == toupper(*q++)); } a++; } } return NULL; } bool Str_has(const char *charset, const char *s) { if (charset && s) { for (int x = 0; s[x]; x++) { for (int y = 0; charset[y]; y++) { if (s[x] == charset[y]) return true; } } } return false; } char *Str_unescape(const char *charset, char *s) { if (charset && STR_DEF(s)) { int x, y; for (x = 0, y = 0; s[y]; x++, y++) { if ((s[x] = s[y]) == '\\') for (int i = 0; charset[i]; i++) { if (charset[i] == s[y + 1]) { s[x] = charset[i]; y++; break; } } } s[x] = 0; } return s; } bool Str_isEqual(const char *a, const char *b) { if (a && b) { while (*a && *b) if (toupper(*a++) != toupper(*b++)) return false; return (*a == *b); } return false; } bool Str_isByteEqual(const char *a, const char *b) { if (a && b) { while (*a && *b) if (*a++ != *b++) return false; return (*a == *b); } return false; } char *Str_copy(char *dest, const char *src, int n) { if (src && dest && (n > 0)) { char *t = dest; while (*src && n--) *t++ = *src++; *t = 0; } else if (dest) *dest = 0; return dest; } // We don't use strdup so we can report MemoryException on OOM char *Str_dup(const char *s) { char *t = NULL; if (s) { size_t n = strlen(s) + 1; t = CALLOC(1, n); memcpy(t, s, n); } return t; } char *Str_ndup(const char *s, long n) { char *t = NULL; assert(n >= 0); if (s) { long l = (long)strlen(s); n = l < n ? l : n; // Use the actual length of s if shorter than n t = CALLOC(1, n + 1); memcpy(t, s, n); t[n] = 0; } return t; } char *_Str_join(char *dest, int n, ...) { char *p, *q; va_list ap; assert(dest); va_start(ap, n); for (q = dest, p = va_arg(ap, char *); (p && (n > 0)); p = va_arg(ap, char *)) while (*p && n--) *q++ = *p++; va_end(ap); *q = 0; return dest; } char *Str_cat(const char *s, ...) { char *t = NULL; if (s) { va_list ap; va_start(ap, s); t = Str_vcat(s, ap); va_end(ap); } return t; } char *Str_vcat(const char *s, va_list ap) { char *t = NULL; if (s) { va_list ap_copy; va_copy(ap_copy, ap); int size = vsnprintf(t, 0, s, ap_copy) + 1; va_end(ap_copy); t = CALLOC(1, size); va_copy(ap_copy, ap); vsnprintf(t, size, s, ap_copy); va_end(ap_copy); } return t; } char *Str_trunc(char *s, int n) { assert(n >= 0); if (s) { size_t sl = strlen(s); if (sl > (size_t)n) { if (n - 3 >= 0) for (int e = n - 3; e < n; e++) s[e] = '.'; s[n] = 0; } } return s; } char *Str_curtail(char *s, const char *t) { if (s) { char *x = Str_sub(s, t); if (x) *x = 0; } return s; } bool Str_lim(const char *s, int limit) { assert(limit>=0); if (s) for (; (*s && limit--); s++) ; return (limit < 0); } bool Str_match(const char *pattern, const char *subject) { assert(pattern); if (STR_DEF(subject)) { regex_t regex = {0}; int error = regcomp(®ex, pattern, REG_NOSUB|REG_EXTENDED); if (error) { char e[STRLEN]; regerror(error, ®ex, e, STRLEN); regfree(®ex); THROW(AssertException, "regular expression error -- %s", e); } else { error = regexec(®ex, subject, 0, NULL, 0); regfree(®ex); return (error == 0); } } return false; } int Str_hash(const void *x) { const char *s = x; unsigned long long h = 0, g; assert(x); while (*s) { h = (h << 4) + *s++; if ((g = h & 0xF0000000)) h ^= g >> 24; h &= ~g; } return (int)h; } int Str_cmp(const void *x, const void *y) { return strcmp((const char *)x, (const char *)y); } bool Str_authcmp(const char *a, const char *b) { if (!a || !b) return false; size_t al = strlen(a); size_t bl = strlen(b); size_t length = (al > bl) ? al : bl; volatile int rv = 0; for (size_t i = 0; i < length; i++) { char _a = (i < al) ? a[i] : 0; char _b = (i < bl) ? b[i] : 0; rv |= _a ^ _b; } return rv == 0; } monit-5.35.2/libmonit/src/util/Fmt.c0000644000016400001720000001056215007061157014131 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include "Fmt.h" /* ----------------------------------------------------------- Definitions */ static double epsilon = 1e-5; static bool _isInt(double x) { return fabs(x - round(x)) < epsilon; } // Maximum number of time units (ms -> year) #define FMT_TIME_UNITS 6 // Maximum value that can be represented (-99.569 y) #define FMT_TIME_MAX 3.14e+12 static const struct time_unit { double base; const char* suffix; } time_units[FMT_TIME_UNITS] = { {1000, "ms"}, {60, "s"}, {60, "m"}, {24, "h"}, {365, "d"}, {100, "y"} // current max ~99.569 years }; // Maximum number of bytes units (B -> ZB) #define FMT_BYTES_UNITS 8 // Maximum value that can be represented (ZB - 1) #define FMT_BYTES_MAX 1e+24 static const struct byte_unit { const char* suffix; const double factor; // For validation } byte_units[FMT_BYTES_UNITS] = { {"B", 1}, {"kB", 1e3}, {"MB", 1e6}, {"GB", 1e9}, {"TB", 1e12}, {"PB", 1e15}, {"EB", 1e18}, {"ZB", 1e21} }; /* -------------------------------------------------------- Public Methods */ char* Fmt_bytes2str(double bytes, char s[static FMT_BYTES_BUFSIZE]) { assert(s); *s = 0; if (isnan(bytes)) { snprintf(s, FMT_BYTES_BUFSIZE, "NaN"); return s; } if (isinf(bytes)) { snprintf(s, FMT_BYTES_BUFSIZE, bytes > 0 ? "Inf" : "-Inf"); return s; } const char* sign = (bytes < 0) ? "-" : ""; bytes = fabs(bytes); assert(bytes < FMT_BYTES_MAX); if (fabs(bytes) < epsilon) { snprintf(s, FMT_BYTES_BUFSIZE, "0 B"); return s; } // Find and set appropriate unit size_t unit; for (unit = 0; unit < FMT_BYTES_UNITS; unit++) { if (bytes >= 1024) { bytes /= 1024; } else { break; } } snprintf(s, FMT_BYTES_BUFSIZE, _isInt(bytes) ? "%s%.0lf %s" : "%s%.1lf %s", sign, bytes, byte_units[unit].suffix); return s; } char* Fmt_time2str(double milli, char s[static FMT_TIME_BUFSIZE]) { assert(s); *s = 0; // Handle special cases if (isnan(milli)) { snprintf(s, FMT_TIME_BUFSIZE, "NaN"); return s; } if (isinf(milli)) { snprintf(s, FMT_TIME_BUFSIZE, milli > 0 ? "Inf" : "-Inf"); return s; } const char* sign = (milli < 0) ? "-" : ""; milli = fabs(milli); assert(milli < FMT_TIME_MAX); if (fabs(milli) < epsilon) { snprintf(s, FMT_TIME_BUFSIZE, "0 ms"); return s; } // Find and set appropriate unit size_t unit; for (unit = 0; unit < FMT_TIME_UNITS; unit++) { if (milli >= time_units[unit].base) { milli /= time_units[unit].base; } else { break; } } snprintf(s, FMT_TIME_BUFSIZE, _isInt(milli) ? "%s%.0lf %s" : "%s%.3lf %s", sign, milli, time_units[unit].suffix); return s; } monit-5.35.2/libmonit/src/util/StringBuffer.c0000644000016400001720000002175015007061157016004 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include #ifdef HAVE_ZLIB_H #include #endif #include "Str.h" #include "StringBuffer.h" /** * Implementation of the StringBuffer interface. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ------------------------------------------------------------ Definitions */ #define T StringBuffer_T struct T { int used; int length; unsigned char *buffer; void *compressedBuffer; }; /* ---------------------------------------------------------------- Private */ __attribute__((format (printf, 2, 0))) static inline void _append(T S, const char *s, va_list ap) { va_list ap_copy; while (true) { va_copy(ap_copy, ap); int n = vsnprintf((char *)(S->buffer + S->used), S->length - S->used, s, ap_copy); va_end(ap_copy); if ((S->used + n) < S->length) { S->used += n; break; } S->length += STRLEN + n; RESIZE(S->buffer, S->length); } } static inline T _ctor(int hint) { T S; NEW(S); S->used = 0; S->length = hint; S->buffer = CALLOC(1, hint); *S->buffer = 0; return S; } /* ----------------------------------------------------------------- Public */ T StringBuffer_new(const char *s) { return StringBuffer_append(_ctor(STRLEN), "%s", s); } T StringBuffer_create(int hint) { if (hint <= 0) THROW(AssertException, "Illegal hint value"); return _ctor(hint); } void StringBuffer_free(T *S) { assert(S && *S); FREE((*S)->buffer); FREE((*S)->compressedBuffer); FREE(*S); } T StringBuffer_append(T S, const char *s, ...) { assert(S); if (STR_DEF(s)) { va_list ap; va_start(ap, s); _append(S, s, ap); va_end(ap); } return S; } T StringBuffer_vappend(T S, const char *s, va_list ap) { assert(S); if (STR_DEF(s)) { va_list ap_copy; va_copy(ap_copy, ap); _append(S, s, ap_copy); va_end(ap_copy); } return S; } int StringBuffer_replace(T S, const char *a, const char *b) { int n = 0; assert(S); if (a && b && *a) { int i, j; for (i = 0; S->buffer[i]; i++) { if (S->buffer[i] == *a) { j = 0; do if (! a[++j]) {n++; break;} while (S->buffer[i + j] == a[j]); } } if (n) { int m = n; size_t bl = strlen(b); size_t diff = bl - strlen(a); if (diff > 0) { size_t required = (diff * n) + S->used + 1; if (required >= (size_t)S->length) { S->length = (int)required; RESIZE(S->buffer, S->length); } } for (i = 0; m; i++) { if (S->buffer[i] == *a) { j = 0; do if (! a[++j]) { memmove(S->buffer + i + bl, S->buffer + i + j, (S->used - (i + j))); memcpy(S->buffer + i, b, bl); S->used += diff; i += bl - 1; m--; break; } while (S->buffer[i + j] == a[j]); } } S->buffer[S->used] = 0; } } return n; } T StringBuffer_trim(T S) { assert(S); // Right trim while (S->used && isspace(S->buffer[S->used - 1])) S->buffer[--S->used] = 0; // Left trim if (isspace(*S->buffer)) { int i; for (i = 0; isspace(S->buffer[i]); i++) ; memmove(S->buffer, S->buffer + i, S->used - i); S->used -= i; S->buffer[S->used] = 0; } return S; } T StringBuffer_delete(T S, int index) { assert(S); if (index < 0 || index > S->used) THROW(AssertException, "Index out of bounds"); S->used = index; S->buffer[S->used] = 0; return S; } int StringBuffer_indexOf(T S, const char *s) { assert(S); if (STR_DEF(s)) { int i, j; for (i = 0; i < S->used; i++) { if (S->buffer[i] == *s) { j = 0; do if (! s[++j]) return i; while (S->buffer[i + j] == s[j]); } } } return -1; } int StringBuffer_lastIndexOf(T S, const char *s) { assert(S); if (STR_DEF(s)) { int i, j; for (i = S->used - 1; i >= 0; i--) { if (S->buffer[i] == *s) { j = 0; do if (! s[++j]) return i; while (S->buffer[i + j] == s[j]); } } } return -1; } const char *StringBuffer_substring(T S, int index) { assert(S); if (index < 0 || index > S->used) THROW(AssertException, "Index out of bounds"); return (const char *)(S->buffer + index); } int StringBuffer_length(T S) { assert(S); return S->used; } T StringBuffer_clear(T S) { assert(S); S->used = 0; *S->buffer = 0; FREE(S->compressedBuffer); return S; } const char *StringBuffer_toString(T S) { assert(S); return (const char *)S->buffer; } const void *StringBuffer_toCompressed(T S, int level, size_t *length) { assert(S); assert(length); assert(level >= 0 && level <= 9); #ifdef HAVE_LIBZ *length = 0; if (S->used > 0) { z_stream zstream = {}; zstream.next_in = S->buffer; zstream.avail_in = S->used; int status = deflateInit2(&zstream, level, Z_DEFLATED, 15 | 16, 8, Z_DEFAULT_STRATEGY); if (status == Z_OK) { int need = (int)deflateBound(&zstream, S->used); RESIZE(S->compressedBuffer, need); zstream.next_out = S->compressedBuffer; zstream.avail_out = need; status = deflate(&zstream, Z_FINISH); deflateEnd(&zstream); if (status == Z_STREAM_END) { *length = need - zstream.avail_out; return (const void *)S->compressedBuffer; } } FREE(S->compressedBuffer); THROW(AssertException, "compression failed: %s", zError(status)); } #else THROW(AssertException, "compression not supported"); #endif return NULL; } monit-5.35.2/libmonit/src/util/Array.c0000644000016400001720000001304315007061157014456 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (c) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include "Array.h" /** * Implementation of the Sparse Array interface. Based on the "Table" * implementation from David Hanson's excellent CII library. Hanson's * implementation is a general Hash Table, while this implementation * is a Sparse Array based on a hash table core. * * @author https://tildeslash.com * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ #define T Array_T struct T { int size; int length; unsigned int timestamp; struct binding *freelist; struct binding { int key; void *value; struct binding *link; } **buckets; }; /* ---------------------------------------------------------------- Public */ T Array_new(int hint) { assert(hint >=0); static int primes[] = { 127, 127, 251, 509, 1021, 2053, 4093, 8191, 16381, 32771, 65521, INT_MAX }; int i; for (i = 1; primes[i] < hint; i++) ; T S = CALLOC(1, sizeof (*S) + primes[i - 1] * sizeof (S->buckets[0])); S->size = primes[i-1]; S->buckets = (struct binding **)(S + 1); for (i = 0; i < S->size; i++) S->buckets[i] = NULL; S->length = 0; S->timestamp = 0; return S; } void Array_free(T *S) { assert(S && *S); struct binding *p, *q; if ((*S)->length > 0) { for (int i = 0; i < (*S)->size; i++) { for (p = (*S)->buckets[i]; p; p = q) { q = p->link; FREE(p); } } } for (p = (*S)->freelist; p; p = q) { q = p->link; FREE(p); } FREE(*S); } void *Array_put(T S, int key, void *value) { assert(S); void *prev = NULL; struct binding *p; int i = abs(key)%S->size; for (p = S->buckets[i]; p; p = p->link) if (p->key == key) break; if (p == NULL) { if (S->freelist) { p = S->freelist; S->freelist = p->link; } else { NEW(p); } p->key = key; p->link = S->buckets[i]; S->buckets[i] = p; S->length++; } else prev = p->value; p->value = value; S->timestamp++; return prev; } void *Array_get(T S, int key) { assert(S); int i = abs(key)%S->size; for (struct binding *p = S->buckets[i]; p; p = p->link) { if (p->key == key) { return p->value; } } return NULL; } void *Array_remove(T S, int key) { assert(S); int i = abs(key)%S->size; for (struct binding **pp = &S->buckets[i]; *pp; pp = &(*pp)->link) { if ((*pp)->key == key) { struct binding *p = *pp; void *value = p->value; *pp = p->link; // Retain binding for reuse p->link = S->freelist; S->freelist = p; S->length--; S->timestamp++; return value; } } return NULL; } int Array_length(T S) { assert(S); return S->length; } void Array_map(T S, void apply(int key, void **value, void *ap), void *ap) { assert(S); assert(apply); unsigned int stamp = S->timestamp; for (int i = 0; i < S->size; i++) for (struct binding *p = S->buckets[i]; p; p = p->link) { apply(p->key, &p->value, ap); assert(S->timestamp == stamp); } } void *Array_find(T S, bool predicate(void *value, void *needle), void *needle) { assert(S); assert(predicate); assert(needle); unsigned int stamp = S->timestamp; for (int i = 0; i < S->size; i++) for (struct binding *p = S->buckets[i]; p; p = p->link) { if (predicate(p->value, needle)) return p->value; assert(S->timestamp == stamp); } return NULL; } monit-5.35.2/libmonit/src/util/Str.h0000644000016400001720000003453215007061157014163 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef STR_INCLUDED #define STR_INCLUDED #include /** * General purpose String utility class methods. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /** * Test if the given string is defined. That is; not NULL nor the empty ("") string * @param s The string to test * @return true if s is defined, otherwise false * @hideinitializer */ #define STR_DEF(s) ((s) && *(s)) /** * Test if the given string is NULL or the empty ("") string * @param s The string to test * @return true if s is NULL or the empty string, otherwise false * @hideinitializer */ #define STR_UNDEF(s) (! STR_DEF(s)) /** * Set a to b if and only if a != b. * Deallocate the previous value of a and copy b as the new value * of a. If a == b, this function leaves a as it was. The string * a must be of a heap allocated char * * type, while b can be any string type. * @param a The (char *) string to replace with b if b != a * @param b The string to copy as the new value of a if a != b * @hideinitializer */ #define STR_SET(a, b) do { if (!Str_isByteEqual((a), (b))) \ { FREE((a)); (a) = Str_dup((b));} } while(0) /** * Removes everything from the first newline (CR|LF) * @param s A string to be chomped * @return The chomped string */ char *Str_chomp(char *s); /** * Remove leading and trailing white space [ \\t\\r\\n] * from the string. * @param s A string * @return s with leading and trailing spaces removed */ char *Str_trim(char *s); /** * Remove leading white space [ \\t\\r\\n] from the string. * @param s A string * @return s with leading spaces removed */ char *Str_ltrim(char *s); /** * Remove trailing white space [ \\t\\r\\n] from the string * @param s A string * @return s with trailing spaces removed */ char *Str_rtrim(char *s); /** * Remove any enclosing quotes ["'] and white-space from the string * @param s A string * @return s with any enclosed quotes and white-space removed */ char *Str_unquote(char *s); /** * Converts the given string to lower case * @param s A string * @return s converted to lower case letters */ char *Str_toLower(char *s); /** * Converts the given string to upper case * @param s A string * @return s converted to upper case letters */ char *Str_toUpper(char *s); /** * Returns true if the string argument is a decimal integer. * @param s A string * @return True if s is a number otherwise false */ bool Str_isInt(const char *s); /** * Parses the string argument as a signed decimal integer. * @param s A string * @return The integer represented by the string argument * @exception NumberFormatException If the String does not contain a * parsable int */ int Str_parseInt(const char *s); /** * Parses the string argument as a signed long long in base 10. * @param s A string * @return The long long represented by the string argument. * @exception NumberFormatException If the String does not contain a * parsable long long */ long long Str_parseLLong(const char *s); /** * Parses the string argument as a double. * @param s A string * @return The double represented by the string argument. * @exception NumberFormatException If the String does not contain a * parsable double */ double Str_parseDouble(const char *s); /** * Replace all occurrences of the old char in * s with the new char. * @param s A string * @param o The old char * @param n The new char * @return s where all occurrence of old are replaced with new */ char *Str_replaceChar(char *s, char o, char n); /** * Returns true if a starts with b. The test is * case-insensitive but depends on that all characters * in the two strings can be translated in the current locale. * b is assumed to be the substring of a. * This means that if a is shorter than b, * this method returns false * @param a The string to search for b in * @param b The sub-string to test a against * @return true if a starts with b, otherwise false */ bool Str_startsWith(const char *a, const char *b); /** * Returns true if a ends with b. The test is * case-insensitive but depends on that all characters * in the two strings can be translated in the current locale. * @param a The string to search for b in * @param b The sub-string to test a against * @return true if a ends with b, otherwise false */ bool Str_endsWith(const char *a, const char *b); /** * Returns the first substring of a that match the string b. * If any of the parameters are NULL or b is an empty string, * NULL is returned. The test is case-insensitive. * Example: *
 * Str_sub("Haystack with Needle", "needle") -> "Needle"
 * Str_sub("foo bar baz", "bar") -> "bar baz"
 * Str_sub("foo", "foo bar") -> NULL
 * Str_sub("foo", "") -> NULL
 * 
* @param a The string to search for b in * @param b The sub-string to search for in a * @return A pointer to the start of the substring in a that contains b, * otherwise NULL */ char *Str_sub(const char *a, const char *b); /** * Returns true if s contains any characters in the * charset. Example: *
 * char *foo = "'bar' (baz)";
 * Str_has("(')", foo) -> true
 * Str_has(",;", foo) -> false
 * Str_has(",;", NULL) -> false
 * 
* @param charset The characters to test s against * @param s The string to test * @return true if s contains chars in charset, otherwise false */ bool Str_has(const char *charset, const char *s); /** * Unescape all characters in s which are in the * charset and return s modified. * Example: *
 * char s[] = "foo\'ba\"r\}baz";
 * Str_unescape("\"'", s) -> foo'ba"r\}baz
 * 
* @param charset The characters to test s against. * A character is unescaped in s if it is in the * charset and is preceded with '\'. * @param s The string to unescape * @return A pointer to s */ char *Str_unescape(const char *charset, char *s); /** * Returns true if a equals b. The test is * case-insensitive but depends on that all characters * in the two strings can be translated in the current locale. * @param a The string to test for equality with b * @param b The string to test for equality with a * @return true if a equals b, otherwise false */ bool Str_isEqual(const char *a, const char *b); /** * Returns true if a equals b. The * test is case-sensitive and compares byte by byte * @param a The string to test for equality with b * @param b The string to test for equality with a * @return true if a equals b, otherwise false */ bool Str_isByteEqual(const char *a, const char *b); /** * Strcpy that copy only n char from the given * string. The destination string, dest, is NUL * terminated at length n or if src is * shorter than n at the length of src * @param dest The destination buffer * @param src The string to copy to dest * @param n The number of bytes to copy * @return A pointer to dest */ char *Str_copy(char *dest, const char *src, int n); /** * Returns a copy of s. The caller must free the returned String. * @param s A String to duplicate * @return A pointer to the duplicated string, NULL if s is NULL * @exception MemoryException if allocation failed */ char *Str_dup(const char *s); /** * Strdup that duplicates only n char from the given string The caller * must free the returned String. If s is shorter than n characters long, * all characters of s are copied. I.e. the same as calling Str_dup(s). * @param s A string to duplicate * @param n The number of bytes to copy from s * @return A pointer to the duplicated string, NULL if s is NULL * @exception MemoryException if allocation failed * @exception AssertException if n is less than 0 */ char *Str_ndup(const char *s, long n); /** * Copy n bytes from a variable number of strings. The * destination string, dest, is 0 terminated at length * n or if number of bytes to copy is shorter than * n at the combined length of the given strings. * Example: *
 * char dest[10 + 1];
 *
 * Str_join(dest, 10, "012", "3456789", "foo") -> "0123456789"
 * Str_join(dest, 4, "a", "b", "cd", "ghi", "jklmnopq") -> "abcd"
 * Str_join(dest, 10) -> ""
 * 
* It is an unchecked runtime error not to provide at least one * parameter in a variable argument list. This macro for the _Str_join() * function ensures that at least one parameter exist in the argument list * and its last parameter is NULL. * @param dest The destination buffer * @param n The number of bytes to copy * @return A pointer to dest * @exception AssertException if dest is null * @hideinitializer */ #define Str_join(dest, n, ...) _Str_join((dest), (n), ##__VA_ARGS__, NULL) /** Internal function. Use the Str_join() macro */ char *_Str_join(char *dest, int n, ...) __attribute__((sentinel)); /** * Creates a new String by merging a formatted string and a variable * argument list. The caller must free the returned String. * @param s A format string * @return The new String or NULL if the string could not be created * @exception MemoryException if memory allocation fails */ char *Str_cat(const char *s, ...) __attribute__((format (printf, 1, 2))); /** * Creates a new String by merging a formatted string and a variable * argument list. The caller must free the returned String. * @param s A format string * @param ap A variable argument lists * @return a new String concatenating s and va_list or NULL on error * @exception MemoryException if memory allocation fails */ char *Str_vcat(const char *s, va_list ap) __attribute__((format (printf, 1, 0))); /** * Truncate s at n and add a trailing ellipsis * to the end of s. If s is shorter than * n, s is left untouched otherwise this * function modifies s. *
 * Example:
 *  char s[] = "Hello World!";
 *  Str_trunc(s, strlen(s)); -> "Hello World!"
 *  Str_trunc(s, 8); -> "Hello..."
 *  Str_trunc(s, 3); -> "..."
 * 
* @param s String to truncate at n * @param n maximum number of bytes left after truncation * @return A pointer to s * @exception AssertException if n is less than 0 */ char *Str_trunc(char *s, int n); /** * Cut string s short at t. That is, * remove all bytes in s from and including * t to the end of the string. If t * is not found in s, s is not modified. *
 * Example:
 *  char s[] = "Hello World";
 *  Str_curtail(s, ""); -> "Hello World"
 *  Str_curtail(s, ">"); -> " "
 * @param s String to curtail
 * @param t The sub-string to shorten the string s from
 * @return A pointer to s
 */
char *Str_curtail(char *s, const char *t);


/**
 * Returns true if the string s has length greater than
 * limit, otherwise false.
 * @param s String to test
 * @param limit The limit in bytes to test s against
 * @return true if s.length > limit otherwise false
 * @exception AssertException if limit is less than 0
 */
bool Str_lim(const char *s, int limit);


/**
 * Returns true if the regular expression pattern match
 * the subject string, otherwise false. This function
 * supports POSIX regular expression for pattern. See
 * re_format(7) for details. For example, to test for a valid email
 * address,
 * 
 * Str_match("^[^@ ]+@([-a-zA-Z0-9]+\\.)+[a-zA-Z]{2,}$", "foo@bar.baz") -> true
 * 
* @param pattern the regular expression * @param subject the string to match against pattern * @return true if subject match pattern, otherwise false * @exception AssertException if pattern is invalid or cannot be * compiled. */ bool Str_match(const char *pattern, const char *subject); /** * UNIX ELF hash algorithm. May be used as the hash * function in a Table or a Set. * @param x A String * @return A hash value for the String * @see Table.h and Set.h */ int Str_hash(const void *x); /** * Compare case sensitive two strings. Facade function for strcmp(3) * that can be used as the comparison function in a Table or a Set * @param x A String * @param y A String * @return 0 if x and y are equal otherwise a non-zero integer * @see Table.h and Set.h */ int Str_cmp(const void *x, const void *y); /** * Compare two strings in constant time. This function is designed to * mitigate side-channel attacks, such as those that might occur when * comparing sensitive data like credentials. * * Note: For best security, use this function to compare strings of * identical length, such as fixed size hashes. Otherwise a timing * differences may be introduced based on string length. * * @param a A string to compare for equality with 'b' * @param b A string to compare for equality with 'a' * @return true if 'a' and 'b' are equal in both content and length; * otherwise, false */ bool Str_authcmp(const char *a, const char *b); #endif monit-5.35.2/libmonit/src/util/List.c0000644000016400001720000001142415007061157014314 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include "Str.h" #include "List.h" /** * Implementation of the List interface. A freelist is used to retain * deleted nodes for reuse. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ #define T List_T /* --------------------------------------------------------------- Private */ static inline _list_t new_node(T L, void *e, _list_t next) { _list_t p; if (L->freelist) { p = L->freelist; L->freelist = p->next; } else p = CALLOC(1, sizeof *(p)); p->e = e; p->next = next; return p; } /* ---------------------------------------------------------------- Public */ T List_new(void) { T L; NEW(L); return L; } void List_free(T *L) { _list_t p, q; assert(L && *L); for (p = (*L)->head; p; p = q) { q = p->next; FREE(p); } for (p = (*L)->freelist; p; p = q) { q = p->next; FREE(p); } FREE(*L); } void List_push(T L, void *e) { assert(L); _list_t p = new_node(L, e, L->head); if (L->head == NULL) L->tail = p; L->head = p; L->length++; } void *List_pop(T L) { assert(L); if (L->head) { _list_t p = L->head; L->head = L->head->next; L->length--; p->next = L->freelist; L->freelist = p; return p->e; } return NULL; } void List_append(T L, void *e) { _list_t p; assert(L); p = new_node(L, e, NULL); if (L->head == NULL) L->head = p; else L->tail->next = p; L->tail = p; L->length++; } void *List_remove(T L, void *e) { assert(L); if (e && L->head) { _list_t p, q; if (L->head->e == e) return List_pop(L); for (p = L->head; p; p = q) { q = p->next; if (q && (q->e == e)) { p->next = q->next; if (q == L->tail) L->tail = p; p = q; L->length--; p->next = L->freelist; L->freelist = p; return p->e; } } } return NULL; } void List_cat(T L, T list) { assert(L); assert(list); if (L != list) for (_list_t p = list->head; p; p = p->next) List_append(L, p->e); } void List_reverse(T L) { _list_t head, next, list; assert(L); head = NULL; list = L->head; L->tail = L->head; for (; list; list = next) { next = list->next; list->next = head; head = list; } L->head = head; } int List_length(T L) { assert(L); return L->length; } void List_clear(T L) { assert(L); if (L->tail) { L->tail->next = L->freelist; L->freelist = L->head; } L->tail = L->head = NULL; L->length = 0; } void **List_toArray(T L) { assert(L); int i = 0; void **array = CALLOC(L->length + 1, sizeof *(array)); for (_list_t p = L->head; p; p = p->next, i++) array[i] = p->e; array[i] = NULL; return array; } monit-5.35.2/libmonit/src/util/Fmt.h0000644000016400001720000000401015007061157014125 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef FMT_INCLUDED #define FMT_INCLUDED /** * General purpose value units string Format class methods. * * @author https://tildeslash.com * @see https://mmonit.com * @file */ /// Buffer size for bytes string representation #define FMT_BYTES_BUFSIZE 10 /// Buffer size for time string representation #define FMT_TIME_BUFSIZE 11 /** * Format the numeric bytes value to a string representation scaled to * human friendly storage unit [B, kB, MB, etc.]. * @param bytes Byte value to convert * @param s A result buffer, must be large enough to hold FMT_BYTES_BUFSIZE chars * @return A pointer to s */ char* Fmt_bytes2str(double bytes, char s[static FMT_BYTES_BUFSIZE]); /** * Format the time in milliseconds to human friendlier unit (ms/s/m/h/d/y). * @param milli The time value in milliseconds to present * @param s A result buffer, must be large enough to hold FMT_TIME_BUFSIZE chars * @return A pointer to s */ char* Fmt_time2str(double milli, char s[static FMT_TIME_BUFSIZE]); #endif monit-5.35.2/libmonit/src/util/List.h0000644000016400001720000001061715007061157014324 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef LIST_INCLUDED #define LIST_INCLUDED /** * A List is a sequence of zero or more elements. A List can be used * as a LIFO (last in, first out) stack by using List_push() and List_pop() * or as a FIFO (first in, first out) queue by using List_append() and * List_pop(). These operations takes constant time. * * The List ADT representation is revealed in this interface for easy access * by clients. The representation is trivial; a structure with two fields. * The first field, e, is a pointer to an element added to the * list and next points to the next node in the List or to NULL * if there are no more nodes. In addition, the two variables head * and tail are pointers to respectively the first and last node * in the List. The variable freelist is used to retain popped * _list_t nodes for reuse. * * This class is reentrant but not thread-safe * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define T List_T typedef struct T *T; /** @cond hide */ typedef struct _list_t { void *e; struct _list_t *next; } *_list_t; struct T { int length; _list_t head, tail, freelist; }; /** @endcond */ /** * Create a new List object. * @return A List object * @exception MemoryException if allocation failed */ T List_new(void); /** * Destroy a List object and release allocated resources. Call this * method to release a List object allocated with List_new() * @param L A List object reference */ void List_free(T *L); /** * Add e to the beginning of the List * @param L A List object * @param e An element to add to the beginning of the List * @exception MemoryException if allocation failed */ void List_push(T L, void *e); /** * Remove the first element from the List * @param L A List object * @return The element removed from the beginning of the List */ void *List_pop(T L); /** * Append e to the end of the List * @param L A List object * @param e An element to append to the end of the List */ void List_append(T L, void *e); /** * Remove the first occurrence of the element e from the List * @param L A List object * @param e The element to remove from the list * @return The element removed from the List or NULL if e * was not found in the List */ void *List_remove(T L, void *e); /** * Concatenate list with this List. All nodes in * list are appended to L. list * is not changed * @param L A List object * @param list A List to append to the end of this List */ void List_cat(T L, T list); /** * Reverse the order of the elements in the List * @param L A List object */ void List_reverse(T L); /** * Returns the number of elements in the List. * @param L A List object * @return Number of elements in the List */ int List_length(T L); /** * Clear this List so it contains no elements. The List will be empty after * this call. * @param L A List object */ void List_clear(T L); /** * Creates a N + 1 length array containing all the elements * in this List. The last element in the array is NULL. The * caller is responsible for deallocating the array. * @param L A List object * @return A pointer to the first element in the array * @exception MemoryException if allocation failed */ void **List_toArray(T L); #undef T #endif monit-5.35.2/libmonit/src/exceptions/0000755000016400001720000000000015007061157014517 500000000000000monit-5.35.2/libmonit/src/exceptions/assert.c0000644000016400001720000000217015007061157016104 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "assert.h" void (assert)(int e) { assert(e); } monit-5.35.2/libmonit/src/exceptions/MemoryException.h0000644000016400001720000000265415007061157017746 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MEMORYEXCEPTION_INCLUDED #define MEMORYEXCEPTION_INCLUDED #include "Exception.h" /** * Thrown to indicate that a memory allocation failed. Every class that * expose methods for object allocation may throw a MemoryException if * the underlying allocator failed. * @see Exception.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ extern Exception_T MemoryException; #endif monit-5.35.2/libmonit/src/exceptions/ProtocolException.h0000644000016400001720000000255615007061157020300 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef PROTOCOLEXCEPTION_INCLUDED #define PROTOCOLEXCEPTION_INCLUDED #include "Exception.h" /** * Thrown to indicate that a protocol error occurred. * @see Exception.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ extern Exception_T ProtocolException; #endif monit-5.35.2/libmonit/src/exceptions/NumberFormatException.h0000644000016400001720000000265015007061157021073 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef NUMBERFORMATEXCEPTION_INCLUDED #define NUMBERFORMATEXCEPTION_INCLUDED #include "Exception.h" /** * Thrown to indicate that an attempt to convert a string to one of the * numeric types failed, because the string does not have the appropriate * format. * @see Exception.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ extern Exception_T NumberFormatException; #endif monit-5.35.2/libmonit/src/exceptions/Exception.h0000644000016400001720000002265715007061157016562 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef EXCEPTION_INCLUDED #define EXCEPTION_INCLUDED #include /** * An Exception indicate an error condition from which recovery may * be possible. The Library raise exceptions, which can be handled by * recovery code, if recovery is possible. When an exception is raised, it is * handled by the handler that was most recently instantiated. If no handlers * are defined an exception will cause the library to call its abort handler * to abort with an error message. * *

* Handlers are instantiated by the TRY-CATCH and TRY-FINALLY statements, * which are implemented as macros in this interface. These statements handle * nested exceptions and manage exception-state data. The syntax of the * TRY-CATCH statement is, * *

 * TRY
 *      S
 * CATCH(e1)
 *      S1
 * CATCH(e2)
 *      S2
 * [...]
 * CATCH(en)
 *      Sn
 * END_TRY;
 * 
* * The TRY-CATCH statement establish handlers for the exceptions named * e1, e2,.., en and execute the statements S. * If no exceptions are raised by S, the handlers are dismantled and * execution continues at the statement after the END_TRY. If S raises * an exception e which is one of e1..en the execution * of S is interrupted and control transfers immediately to the * statements following the relevant CATCH clause. If S raises an * exception that is not one of e1..en, the exception will raise * up the call-stack and unless a previous installed handler catch the * exception, it will cause the application to abort. * *

* Here's a concrete example calling a method in the zild API which may throw * an exception. If the method Connection_execute() fails it will throw an * SQLException. The CATCH statement will catch this exception, if thrown, * and log an error message *

 * TRY
 *      [...]
 *      Connection_execute(c, sql);
 * CATCH(SQLException)
 *      log("SQL error: %s\n", Connection_getLastError(c));
 * END_TRY;
 * 
* * The TRY-FINALLY statement is similar to TRY-CATCH but in addition * adds a FINALLY clausal which is always executed, regardless if an exception * was raised or not. The syntax of the TRY-FINALLY statement is, *
 * TRY
 *      S
 * CATCH(e1)
 *      S1
 * CATCH(e2)
 *      S2
 *      [...]
 * CATCH(en)
 *      Sn
 * FINALLY
 *      Sf
 * END_TRY;
 * 
*

* Note that Sf is executed whether S raise an exception * or not. One purpose of the TRY-FINALLY statement is to give clients an * opportunity to "clean up" when an exception occurs. For example, *

 * TRY
 *      [...]
 *      Connection_execute(c, sql);
 * CATCH(SQLException)
 *      <exception handler code>
 * FINALLY
 *      Connection_close(c);
 * END_TRY;
 * 
* closes the database Connection regardless if an exception * was thrown or not by the code in the TRY-block. * * Finally, the RETURN statement, defined in this interface, must be used * instead of C return statements inside a try-block. If any of the * statements in a try-block must do a return, they must * do so with this macro instead of the usual C return statement. * *

Exception details

* Inside an exception handler, details about an exception is * available in the variable Exception_frame. The * following demonstrate how to use this variable to provide detailed * logging of an exception. * *
 * TRY
 * {
 *      code that can throw an exception
 * }
 * ELSE
 * {
 *      fprintf(stderr, "%s: %s raised in %s at %s:%d\n",
 *              Exception_frame.exception->name,
 *              Exception_frame.message,
 *              Exception_frame.func,
 *              Exception_frame.file,
 *              Exception_frame.line);
 *      ....
 * }
 * END_TRY;
 * 
* *

The Exception stack is stored in a thread-specific variable so Exceptions * are made thread-safe. This means that Exceptions are thread local and an * Exception thrown in one thread cannot be caught in another thread. * This also means that clients must handle Exceptions per thread and cannot * use one TRY-ELSE block in the main program to catch all Exceptions. This is * only possible if no threads were started. *

This implementation of Exception is a minor modification of code * found in David R. Hanson's excellent * book C Interfaces and * Implementations. * @see SQLException.h IOException.h AssertException.h NumberFormatException.h * MemoryException.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #ifndef CLANG_ANALYZER_NORETURN #if defined(__clang__) #define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) #else #define CLANG_ANALYZER_NORETURN #endif #endif #define T Exception_T /** @cond hide */ #include typedef struct T { const char *name; } T; #define EXCEPTION_MESSAGE_LENGTH 511 typedef struct Exception_Frame Exception_Frame; struct Exception_Frame { int line; sigjmp_buf env; const char *func; const char *file; const T *exception; Exception_Frame *prev; char message[EXCEPTION_MESSAGE_LENGTH + 1]; }; enum { Exception_entered = 0, Exception_thrown, Exception_handled, Exception_finalized }; extern pthread_key_t Exception_Stack; void Exception_init(void); void Exception_vthrow(const T *e, const char *func, const char *file, int line, const char *cause, ...) CLANG_ANALYZER_NORETURN; void Exception_throw(const T *e, const char *func, const char *file, int line, const char *message) CLANG_ANALYZER_NORETURN; #define pop_exception_stack pthread_setspecific(Exception_Stack, ((Exception_Frame*)pthread_getspecific(Exception_Stack))->prev) /** @endcond */ /** * Throws an exception. * @param e The Exception to throw * @param cause The cause. A NULL value is permitted, and * indicates that the cause is unknown. * @hideinitializer */ #define THROW(e, cause, ...) \ Exception_vthrow(&(e), __func__, __FILE__, __LINE__, cause, ##__VA_ARGS__, NULL) /** * Re-throws an exception. In a CATCH or ELSE block clients can use RETHROW * to re-throw the Exception * @hideinitializer */ #define RETHROW Exception_throw(Exception_frame.exception, \ Exception_frame.func, Exception_frame.file, Exception_frame.line, Exception_frame.message) /** * Clients must use this macro instead of C return statements * inside a try-block * @hideinitializer */ #define RETURN switch((pop_exception_stack,0)) default:return /** * Defines a block of code that can potentially throw an exception * @hideinitializer */ #define TRY do { \ volatile int Exception_flag; \ Exception_Frame Exception_frame; \ Exception_frame.message[0] = 0; \ Exception_frame.prev = pthread_getspecific(Exception_Stack); \ pthread_setspecific(Exception_Stack, &Exception_frame); \ Exception_flag = sigsetjmp(Exception_frame.env, 0); \ if (Exception_flag == Exception_entered) { /** * Defines a block containing code for handling an exception thrown in * the TRY block. * @param e The Exception to handle * @hideinitializer */ #define CATCH(e) \ if (Exception_flag == Exception_entered) pop_exception_stack; \ } else if (Exception_frame.exception == &(e)) { \ Exception_flag = Exception_handled; /** * Defines a block containing code for handling any exception thrown in * the TRY block. An ELSE block catches any exception type not already * caught in a previous CATCH block. * @hideinitializer */ #define ELSE \ if (Exception_flag == Exception_entered) pop_exception_stack; \ } else { \ Exception_flag = Exception_handled; /** * Defines a block of code that is subsequently executed whether an * exception is thrown or not * @hideinitializer */ #define FINALLY \ if (Exception_flag == Exception_entered) pop_exception_stack; \ } { \ if (Exception_flag == Exception_entered) \ Exception_flag = Exception_finalized; /** * Ends a TRY-CATCH block * @hideinitializer */ #define END_TRY \ if (Exception_flag == Exception_entered) pop_exception_stack; \ } if (Exception_flag == Exception_thrown) RETHROW; \ } while (0) #undef T #endif monit-5.35.2/libmonit/src/exceptions/IOException.h0000644000016400001720000000257515007061157017007 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef IOEXCEPTION_INCLUDED #define IOEXCEPTION_INCLUDED #include "Exception.h" /** * Signals that an I/O exception of some sort has occurred. This class * is the general class of exceptions produced by failed I/O operations. * @see Exception.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ extern Exception_T IOException; #endif monit-5.35.2/libmonit/src/exceptions/assert.h0000644000016400001720000000351715007061157016117 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef ASSERTION_INCLUDED #define ASSERTION_INCLUDED /** * The assert() macro tests the given expression and if it is false, raise * an AssertException. Unless a previous installed exception handler catch * the exception, it will cause the application to abort. If expression is * true, the assert() macro does nothing. The assert macro can be removed * at compile time by defining NDEBUG which is the case for optimised build * @see AssertException.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #undef assert #ifdef NDEBUG #define assert(e) ((void)0) #else #include "AssertException.h" extern void assert(int e); #define assert(e) ((void)((e)||(Exception_throw(&(AssertException), __func__, __FILE__, __LINE__, #e),0))) #endif #endif monit-5.35.2/libmonit/src/exceptions/Exception.c0000644000016400001720000000743215007061157016547 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "Config.h" #include #include #include #include #include "Str.h" #include "Thread.h" #include "system/System.h" #include "Exception.h" /** * Implementation of the Exception interface. This implementation * defines the Thread local Exception stack and all Exceptions used * in the system. New Exceptions should also be defined in this class. * * This implementation is a minor modification of the Except code found * in David R. Hanson's excellent book "C Interfaces and Implementations". * See http://www.cs.princeton.edu/software/cii/ * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ #define T Exception_T /* Thread specific Exception stack */ ThreadData_T Exception_Stack; /* System exceptions */ T IOException = {"IOException"}; T AssertException = {"AssertException"}; T MemoryException = {"MemoryException"}; T NumberFormatException = {"NumberFormatException"}; T ProtocolException = {"ProtocolException"}; static pthread_once_t once_control = PTHREAD_ONCE_INIT; /* --------------------------------------------------------------- Private */ static void init_once(void) { ThreadData_create(Exception_Stack); } /* ---------------------------------------------------------------- Public */ void Exception_init(void) { pthread_once(&once_control, init_once); } void Exception_throw(const T *e, const char *func, const char *file, int line, const char *message) { Exception_Frame *p = ThreadData_get(Exception_Stack); assert(e); if (p) { p->exception = e; p->func = func; p->file = file; p->line = line; if (message) Str_copy(p->message, message, EXCEPTION_MESSAGE_LENGTH); pop_exception_stack; siglongjmp(p->env, Exception_thrown); } else if (message) { ABORT("%s: %s\n raised in %s at %s:%d\n", e->name, message, func ? func : "?", file ? file : "?", line); } else { ABORT("%s: 0x%p\n raised in %s at %s:%d\n", e->name, e, func ? func : "?", file ? file : "?", line); } } void Exception_vthrow(const T *e, const char *func, const char *file, int line, const char *cause, ...) { char message[EXCEPTION_MESSAGE_LENGTH + 1]; if (cause) { va_list ap; va_start(ap, cause); vsnprintf(message, EXCEPTION_MESSAGE_LENGTH, cause, ap); va_end(ap); Exception_throw(e, func, file, line, message); } else { Exception_throw(e, func, file, line, NULL); } } monit-5.35.2/libmonit/src/exceptions/AssertException.h0000644000016400001720000000254615007061157017737 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 1994,1995,1996,1997 by David R. Hanson. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef ASSERTEXCEPTION_INCLUDED #define ASSERTEXCEPTION_INCLUDED #include "Exception.h" /** * Thrown to indicate that an assertion has failed. * @see Exception.h * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ extern Exception_T AssertException; #endif monit-5.35.2/libmonit/src/Config.h0000644000016400001720000000424015007061157013634 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef CONFIG_INCLUDED #define CONFIG_INCLUDED /** * Global defines, macros and types * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #include "xconfig.h" #include #include #include #include #include #include #include "assert.h" #include "system/Mem.h" /* ----------------------------------- Error, Exceptions and report macros */ /** * The standard abort routine */ #define ABORT System_abort /** * The standard error routine */ #define ERROR System_error /** * The standard debug routine */ #ifdef DEBUG #undef DEBUG #endif #define DEBUG System_debug /* ------------------------------------------------------------ Exceptions */ #include "AssertException.h" #include "IOException.h" #include "NumberFormatException.h" /* ------------------------------------------------------- Constant macros */ /** * Standard String length */ #define STRLEN 256 /* ------------------------------------------------------ Type definitions */ /** * The internal 8-bit char type */ #ifndef HAVE_UCHAR_T typedef unsigned char uchar_t; #endif #endif monit-5.35.2/libmonit/bootstrap0000755000016400001720000000066615007061157013442 00000000000000#!/bin/sh # Use this script to re-create configure. Requires the following auto-tools, # autoconf >= 2.59 # automake >= 1.10 # libtool >= 1.4 if (glibtoolize -f -c 2>/dev/null || libtoolize -f -c) && aclocal -I config && autoheader && automake --foreign --add-missing --copy && autoconf then echo "Success bootstrapping libmonit" else echo "Failed bootstrapping libmonit" exit 1; fi exit 0; monit-5.35.2/libmonit/test/0000755000016400001720000000000015007061176012527 500000000000000monit-5.35.2/libmonit/test/CommandTest.c0000644000016400001720000004044315007061157015035 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "List.h" #include "File.h" #include "system/System.h" #include "system/Command.h" #include "system/Time.h" /** * Command.c unit tests. */ static void onExec(Process_T P) { assert(P); char buf[STRLEN]; // Child process info printf("\tSubprocess ((pid=%d)\n", Process_pid(P)); InputStream_T in = Process_inputStream(P); OutputStream_T out = Process_outputStream(P); InputStream_T err = Process_errorStream(P); printf("\tSub-Process is %s\n", Process_isRunning(P) ? "running" : "not running"); printf("\tCommunication with child:\n"); if (! InputStream_readLine(in, buf, STRLEN)) { InputStream_readLine(err, buf, STRLEN); printf("\tError in script: %s\n", Str_chomp(buf)); } else { printf("\t%s", buf); OutputStream_print(out, "Elessar Telcontar\n"); assert(OutputStream_flush(out) > 0); char *line = InputStream_readLine(in, buf, STRLEN); assert(line); printf("\t%s", line); } printf("\tProcess exited with status: %d\n", Process_waitFor(P)); Process_free(&P); } static void onTerminate(Process_T P) { assert(P); printf("\tTest terminate subprocess ((pid=%d)\n", Process_pid(P)); assert(Process_isRunning(P)); #ifdef NETBSD // NetBSD: If we call the Process_terminate() immediately, the child process sometimes misses the signal (despite kill() in Process_terminate returned no error) and // exits normally, after the child finished execution. When we wait a bit before sending signal to the child, everything works properly. It seems that the child // is maybe not ready to run yet when we send the signal and NetBSD somehow loses it. Observed only on *NetBSD* Time_usleep(500000LL); // Sleep for 500 ms (500,000 µs) #endif assert(Process_terminate(P)); printf("\tProcess exited with status: %d\n", Process_waitFor(P)); assert(Process_exitStatus(P) == SIGTERM); Process_free(&P); } static void onKill(Process_T P) { assert(P); printf("\tTest kill subprocess ((pid=%d)\n", Process_pid(P)); assert(Process_isRunning(P)); #ifdef NETBSD // NetBSD: If we call the Process_kill() immediately, the child process sometimes misses the signal (despite kill() in Process_kill returned no error) and // exits normally, after the child finished execution. When we wait a bit before sending signal to the child, everything works properly. It seems that the child // is maybe not ready to run yet when we send the signal and NetBSD somehow loses it. Observed only on *NetBSD* Time_usleep(500000LL); // Sleep for 500 ms (500,000 µs) #endif assert(Process_kill(P)); printf("\tProcess exited with status: %d\n", Process_waitFor(P)); assert(Process_exitStatus(P) == SIGKILL); Process_free(&P); } static void onEnv(Process_T P) { assert(P); char buf[STRLEN]; InputStream_T in = Process_inputStream(P); assert(InputStream_readLine(in, buf, STRLEN)); assert(Str_isEqual(Str_chomp(buf), "Ylajali")); // Assert that sub-process environment is not set in main process assert(! getenv("SULT")); printf("\tEnvironment Variable in sub-process only: $SULT = %s\n", buf); Process_free(&P); assert(! P); } static void onDetach(Process_T P) { assert(P); File_delete("/tmp/ondetach"); // Assert the process is running, blocking on read assert(Process_isRunning(P)); // Close pipes and streams, this will cause read in the script to return with eof Process_detach(P); assert(Process_isdetached(P)); // Streams should be closed and not available after a detach assert(Process_inputStream(P) == NULL); // Assert that the script exited cleanly assert(Process_waitFor(P) == 0); Process_free(&P); // Finally assert that the script did continue and wrote this file assert(File_delete("/tmp/ondetach")); } static void onChild(Process_T P) { assert(P); printf("\tStarted process (pid=%d)\n", Process_pid(P)); // Verify process is running assert(Process_isRunning(P)); printf("\tProcess is running\n"); // Wait longer than sleep duration for SIGCHLD delivery printf("\tWaiting for SIGCHLD delivery...\n"); Time_sleep(2); // 2 seconds // Status should have been set by SIGCHLD handler assert(!Process_isRunning(P)); printf("\tProcess is no longer running\n"); // Check exit status is set by SIGCHLD handler int status = Process_exitStatus(P); printf("\tProcess exit status: %d\n", status); assert(status == 0); Process_free(&P); assert(! P); } int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Command Tests\n\n"); printf("=> Test1: create/destroy\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit"); assert(c); Command_free(&c); assert(!c); } printf("=> Test1: OK\n\n"); printf("=> Test2: set and get uid/gid\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit"); // Check that default is 0 assert(Command_uid(c) == 0); assert(Command_gid(c) == 0); if (getuid() == 0) { Command_setUid(c,42); assert(Command_uid(c) == 42); Command_setGid(c,148); assert(Command_gid(c) == 148); Command_free(&c); } else { TRY { printf("\tNot running as root. Checking exception instead: "); Command_setUid(c,42); printf("AssertException not thrown\n"); exit(1); } CATCH (AssertException) { printf("ok\n"); } FINALLY { Command_free(&c); } END_TRY; } } printf("=> Test2: OK\n\n"); printf("=> Test4: set and get env\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit"); // Set and get env string Command_setEnv(c, "PATH", "/usr/bin"); Command_setEnv(c, "SHELL", "/bin/bash"); Command_setEnv(c, "PAT", "Carroll"); assert(Str_isEqual(Command_env(c, "PATH"), "/usr/bin")); assert(Str_isEqual(Command_env(c, "SHELL"), "/bin/bash")); assert(Str_isEqual(Command_env(c, "PAT"), "Carroll")); // Empty and NULL value Command_setEnv(c, "PATH", ""); Command_setEnv(c, "SHELL", NULL); assert(Str_isEqual(Command_env(c, "PATH"), "")); assert(Str_isEqual(Command_env(c, "SHELL"), "")); // Unknown variable should result in NULL assert(Command_env(c, "UKNOWNVARIABLE") == NULL); // vSetEnv Command_vSetEnv(c, "PID", "%ld", (long)getpid()); assert(Str_parseLLong(Command_env(c, "PID")) > 1); Command_vSetEnv(c, "ZERO", NULL); assert(Str_isEqual(Command_env(c, "ZERO"), "")); Command_free(&c); } printf("=> Test4: OK\n\n"); printf("=> Test5: set and get Command\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit"); List_T l = Command_command(c); assert(Str_isEqual(l->head->e, "/bin/sh")); assert(Str_isEqual(l->head->next->e, "-c")); assert(Str_isEqual(l->head->next->next->e, "ps -aef|grep monit")); Command_free(&c); } printf("=> Test5: OK\n\n"); printf("=> Test6: Append arguments\n"); { Command_T c = Command_new("/bin/ls"); Command_appendArgument(c, "-l"); Command_appendArgument(c, "-t"); Command_appendArgument(c, "-r"); List_T l = Command_command(c); assert(Str_isEqual(l->head->e, "/bin/ls")); assert(Str_isEqual(l->head->next->e, "-l")); assert(Str_isEqual(l->head->next->next->e, "-t")); assert(Str_isEqual(l->head->next->next->next->e, "-r")); assert(l->head->next->next->next->next == NULL); Command_free(&c); } printf("=> Test6: OK\n\n"); printf("=> Test7: execute invalid program\n"); { // Program producing error Command_T c = Command_new("/bin/sh", "-c", "not_a_program;"); Command_setDir(c, "/"); printf("\tThis should produce an error:\n"); onExec(Command_execute(c)); Command_free(&c); // Nonexistent program TRY { Command_new("/bla/bla/123"); exit(1); } CATCH (AssertException) END_TRY; } printf("=> Test7: OK\n\n"); printf("=> Test8: execute valid program\n"); { Command_T c = Command_new("/bin/sh", "-c", "echo \"Please enter your name:\";read name;echo \"Hello $name\";"); onExec(Command_execute(c)); Command_free(&c); } printf("=> Test8: OK\n\n"); printf("=> Test9: terminate sub-process\n"); { Command_T c = Command_new("/bin/sh", "-c", "exec sleep 30;"); onTerminate(Command_execute(c)); Command_free(&c); } printf("=> Test9: OK\n\n"); printf("=> Test10: kill sub-process\n"); { Command_T c = Command_new("/bin/sh", "-c", "trap 1 2 15; sleep 30; "); onKill(Command_execute(c)); Command_free(&c); } printf("=> Test10: OK\n\n"); printf("=> Test11: environment in sub-process\n"); { Command_T c = Command_new("/bin/sh", "-c", "echo $SULT"); // Set environment in sub-process only Command_setEnv(c, "SULT", "Ylajali"); onEnv(Command_execute(c)); Command_free(&c); } printf("=> Test11: OK\n\n"); printf("=> Test12: on execve(2) error\n"); { // Executing a directory should produce an execve error Command_T c = Command_new("/tmp"); Process_T p = Command_execute(c); assert(! p); Command_free(&c); printf("\tOK, got execve error -- %s\n", System_lastError()); } printf("=> Test12: OK\n\n"); printf("=> Test13: chdir\n"); { Command_T c = Command_new("/bin/sh", "-c", "echo $$ > chdirtest;"); Command_setDir(c, "/tmp/"); Process_T p = Command_execute(c); assert(Process_waitFor(p) == 0); Process_free(&p); assert(File_delete("/tmp/chdirtest")); TRY { Command_setDir(c, "/tmp/somenonexistingdir"); exit(1); } CATCH (AssertException) END_TRY; Command_free(&c); } printf("=> Test13: OK\n\n"); printf("=> Test14: detach\n"); { Command_T c = Command_new("/bin/sh", "-c", "read msg; echo \"this write will fail but should not exit the script\"; echo \"$$ still alive\" > /tmp/ondetach; exit 0;"); onDetach(Command_execute(c)); Command_free(&c); } printf("=> Test14: OK\n\n"); printf("=> Test15: setuid and setgid in sub-process\n"); { if (getuid() != 0) { printf("\tCannot run test: not running as root\n"); goto skip; } struct passwd *pwd = getpwnam("daemon"); assert(pwd && "daemon user not found"); char *script = Str_cat("if test $(id -u) -eq %d -a $(id -g) -eq %d; then exit 0; fi; exit 1;", pwd->pw_uid, pwd->pw_gid); Command_T c = Command_new("/bin/sh", "-c", script); Command_setDir(c, "/tmp"); Command_setUid(c, pwd->pw_uid); Command_setGid(c, pwd->pw_gid); Process_T p = Command_execute(c); assert(p); assert(Process_waitFor(p) == 0); Process_free(&p); Command_free(&c); FREE(script); } skip: printf("=> Test15: OK\n\n"); printf("=> Test16: set umask\n"); { char *script = "tmp=\"/tmp/$$.tst\";touch $tmp;permissions=" #if defined(LINUX) || defined(SOLARIS) "$(stat -c '%a' $tmp);" #elif DARWIN "$(stat -f '%A' $tmp);" #else /* BSD systems */ "$(stat -f '%Lp' $tmp);" #endif "rm -f $tmp; if test $permissions -eq 642; then exit 0; fi; exit 1;"; Command_T c = Command_new("/bin/sh", "-c", script); Command_setUmask(c, 025); Process_T p = Command_execute(c); assert(p); assert(Process_waitFor(p) == 0); Process_free(&p); Command_free(&c); } printf("=> Test16: OK\n\n"); printf("=> Test17: SIGCHLD handling\n"); { Command_T c = Command_new("/bin/sh", "-c", "sleep 1; exit 0"); onChild(Command_execute(c)); Command_free(&c); } printf("=> Test17: OK\n\n"); printf("=> Test18: sequential process handling\n"); { // Start both processes first Command_T c1 = Command_new("/bin/sh", "-c", "exec 1>&2; echo hello from process1"); Command_T c2 = Command_new("/bin/sh", "-c", "echo hello from process2"); Process_T p1 = Command_execute(c1); Process_T p2 = Command_execute(c2); assert(p1 && p2); char buf1[STRLEN] = {}; char buf2[STRLEN] = {}; // Handle first process completely InputStream_T err1 = Process_errorStream(p1); // Assert output went to stderr assert(InputStream_readBytes(err1, buf1, sizeof(buf1) - 1) > 0); // Free and recreate p1 before handling p2 Process_free(&p1); assert(p1 == NULL); p1 = Command_execute(c1); assert(p1); // Now handle second process InputStream_T err2 = Process_errorStream(p2); if (!InputStream_readLine(err2, buf2, sizeof(buf2) - 1)) { InputStream_T in2 = Process_inputStream(p2); InputStream_readLine(in2, buf2, sizeof(buf2) - 1); } // Verify content assert(Str_startsWith(buf1, "hello from process1")); assert(Str_startsWith(buf2, "hello from process2")); // Cleanup Process_free(&p1); Process_free(&p2); Command_free(&c1); Command_free(&c2); } printf("=> Test18: OK\n\n"); printf("============> Command Tests: OK\n\n"); } monit-5.35.2/libmonit/test/ListTest.c0000644000016400001720000002072315007061157014371 00000000000000#include "Config.h" #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "List.h" /** * List.c unity tests. */ int main(void) { List_T L = NULL; Bootstrap(); // Need to initialize library printf("============> Start List Tests\n\n"); printf("=> Test0: create\n"); { L = List_new(); assert(L); List_free(&L); } printf("=> Test0: OK\n\n"); printf("=> Test1: List_push() & List_length()\n"); { L = List_new(); List_push(L, "1"); List_push(L, "2"); List_push(L, "3"); List_push(L, "4"); List_push(L, "5"); List_push(L, "6"); List_push(L, "7"); List_push(L, "8"); List_push(L, "9"); List_push(L, "10"); List_push(L, "11"); List_push(L, "12"); List_push(L, "13"); List_push(L, "14"); List_push(L, "15"); assert(Str_isEqual(L->tail->e, "1")); assert(Str_isEqual(L->head->e, "15")); assert(List_length(L) == 15); } printf("=> Test1: OK\n\n"); printf("=> Test2: List_pop()\n"); { int i = 0; _list_t p; while (List_pop(L)) ; assert(List_length(L) == 0); // Ensure that nodes are retained in the freelist for (p = L->freelist; p; p = p->next) i++; assert(i == 15); List_free(&L); } printf("=> Test2: OK\n\n"); printf("=> Test3: List_append()\n"); { L = List_new(); List_append(L, "1"); List_append(L, "2"); List_append(L, "3"); List_append(L, "4"); List_append(L, "5"); List_append(L, "6"); List_append(L, "7"); List_append(L, "8"); List_append(L, "9"); List_append(L, "10"); List_append(L, "11"); List_append(L, "12"); List_append(L, "13"); List_append(L, "14"); List_append(L, "15"); assert(Str_isEqual(L->tail->e, "15")); assert(Str_isEqual(L->head->e, "1")); assert(List_length(L) == 15); } printf("=> Test3: OK\n\n"); printf("=> Test4: List_cat()\n"); { List_T t = List_new(); List_append(t, "a"); List_append(t, "b"); List_append(t, "c"); List_append(t, "d"); List_cat(L, t); assert(Str_isEqual(L->tail->e, "d")); assert(Str_isEqual(L->head->e, "1")); assert(List_length(L) == 19); List_free(&t); } printf("=> Test4: OK\n\n"); printf("=> Test5: List_reverse()\n"); { _list_t p; List_T l = List_new(); List_append(l, "a"); List_append(l, "b"); List_append(l, "c"); List_append(l, "d"); printf("\tList before reverse: "); for (p = l->head; p; p = p->next) printf("%s%s", (char*)p->e, p->next ? "->" : "\n"); assert(Str_isEqual(l->head->e, "a")); assert(Str_isEqual(l->tail->e, "d")); List_reverse(l); printf("\tList after reverse: "); for (p = l->head; p; p = p->next) printf("%s%s", (char*)p->e, p->next ? "->" : "\n"); assert(Str_isEqual(l->head->e, "d")); assert(Str_isEqual(l->tail->e, "a")); List_free(&l); } printf("=> Test5: OK\n\n"); printf("=> Test6: List_clear()\n"); { List_clear(L); assert(List_length(L) == 0); assert(L->freelist); } printf("=> Test6: OK\n\n"); List_free(&L); printf("=> Test7: List malloc\n"); { L = List_new(); List_push(L, "1"); List_push(L, "2"); List_push(L, "3"); List_push(L, "4"); List_push(L, "5"); List_push(L, "6"); List_push(L, "7"); List_push(L, "8"); List_push(L, "9"); List_push(L, "10"); List_push(L, "11"); List_push(L, "12"); List_push(L, "13"); List_push(L, "14"); List_push(L, "15"); assert(Str_isEqual(L->tail->e, "1")); assert(Str_isEqual(L->head->e, "15")); assert(List_length(L) == 15); List_clear(L); List_append(L, "1"); List_append(L, "2"); List_append(L, "3"); List_append(L, "4"); List_append(L, "5"); List_append(L, "6"); List_append(L, "7"); List_append(L, "8"); List_append(L, "9"); List_append(L, "10"); List_append(L, "11"); List_append(L, "12"); List_append(L, "13"); List_append(L, "14"); List_append(L, "15"); assert(Str_isEqual(L->tail->e, "15")); assert(Str_isEqual(L->head->e, "1")); assert(List_length(L) == 15); List_free(&L); } printf("=> Test7: OK\n\n"); printf("=> Test8: List remove\n"); { char *one = "1"; char *two = "2"; L = List_new(); printf("\tRemove from empty list.. "); assert(List_remove(L, "1") == NULL); printf("OK\n"); List_push(L, one); printf("\tRemove from 1 element list.. "); assert(List_remove(L, one) == one); assert(List_length(L) == 0); printf("OK\n"); List_push(L, one); List_push(L, two); printf("\tRemove last from list.. "); assert(List_remove(L, two) == two); assert(List_length(L) == 1); printf("OK\n"); List_append(L, two); List_append(L, two); List_append(L, two); List_append(L, "5"); printf("\tRemove first occurrence.. "); assert(List_remove(L, two) == two); assert(List_length(L) == 4); printf("OK\n"); List_free(&L); } printf("=> Test8: OK\n\n"); printf("=> Test9: check pointers\n"); { L = List_new(); printf("\tCheck pop.. "); List_push(L, "1"); List_push(L, "2"); List_pop(L); List_pop(L); List_push(L, "1"); assert(L->head == L->tail); List_pop(L); List_append(L, "1"); assert(L->head == L->tail); printf("OK\n"); printf("\tCheck remove.. "); List_push(L, "1"); List_append(L, "2"); List_remove(L, "2"); List_remove(L, "1"); assert(L->head == L->tail); printf("OK\n"); List_free(&L); } printf("=> Test9: OK\n\n"); printf("=> Test10: List_toArray()\n"); { List_T l = List_new(); List_append(l, "a"); List_append(l, "b"); List_append(l, "c"); List_append(l, "d"); char **array = (char**)List_toArray(l); assert(Str_isEqual(array[0], "a")); assert(Str_isEqual(array[1], "b")); assert(Str_isEqual(array[2], "c")); assert(Str_isEqual(array[3], "d")); assert(array[4] == NULL); FREE(array); List_free(&l); } printf("=> Test10: OK\n\n"); printf("============> List Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/Makefile.in0000644000016400001720000005520415007061163014516 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = StrTest$(EXEEXT) FmtTest$(EXEEXT) \ SystemTest$(EXEEXT) RandomTest$(EXEEXT) ArrayTest$(EXEEXT) \ ListTest$(EXEEXT) DirTest$(EXEEXT) StringBufferTest$(EXEEXT) \ InputStreamTest$(EXEEXT) OutputStreamTest$(EXEEXT) \ FileTest$(EXEEXT) ExceptionTest$(EXEEXT) NetTest$(EXEEXT) \ TimeTest$(EXEEXT) CommandTest$(EXEEXT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/config/ax_check_compile_flag.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/xconfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_ArrayTest_OBJECTS = ArrayTest.$(OBJEXT) ArrayTest_OBJECTS = $(am_ArrayTest_OBJECTS) ArrayTest_LDADD = $(LDADD) ArrayTest_DEPENDENCIES = ../libmonit.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_CommandTest_OBJECTS = CommandTest.$(OBJEXT) CommandTest_OBJECTS = $(am_CommandTest_OBJECTS) CommandTest_LDADD = $(LDADD) CommandTest_DEPENDENCIES = ../libmonit.la am_DirTest_OBJECTS = DirTest.$(OBJEXT) DirTest_OBJECTS = $(am_DirTest_OBJECTS) DirTest_LDADD = $(LDADD) DirTest_DEPENDENCIES = ../libmonit.la am_ExceptionTest_OBJECTS = ExceptionTest.$(OBJEXT) ExceptionTest_OBJECTS = $(am_ExceptionTest_OBJECTS) ExceptionTest_LDADD = $(LDADD) ExceptionTest_DEPENDENCIES = ../libmonit.la am_FileTest_OBJECTS = FileTest.$(OBJEXT) FileTest_OBJECTS = $(am_FileTest_OBJECTS) FileTest_LDADD = $(LDADD) FileTest_DEPENDENCIES = ../libmonit.la am_FmtTest_OBJECTS = FmtTest.$(OBJEXT) FmtTest_OBJECTS = $(am_FmtTest_OBJECTS) FmtTest_LDADD = $(LDADD) FmtTest_DEPENDENCIES = ../libmonit.la am_InputStreamTest_OBJECTS = InputStreamTest.$(OBJEXT) InputStreamTest_OBJECTS = $(am_InputStreamTest_OBJECTS) InputStreamTest_LDADD = $(LDADD) InputStreamTest_DEPENDENCIES = ../libmonit.la am_ListTest_OBJECTS = ListTest.$(OBJEXT) ListTest_OBJECTS = $(am_ListTest_OBJECTS) ListTest_LDADD = $(LDADD) ListTest_DEPENDENCIES = ../libmonit.la am_NetTest_OBJECTS = NetTest.$(OBJEXT) NetTest_OBJECTS = $(am_NetTest_OBJECTS) NetTest_LDADD = $(LDADD) NetTest_DEPENDENCIES = ../libmonit.la am_OutputStreamTest_OBJECTS = OutputStreamTest.$(OBJEXT) OutputStreamTest_OBJECTS = $(am_OutputStreamTest_OBJECTS) OutputStreamTest_LDADD = $(LDADD) OutputStreamTest_DEPENDENCIES = ../libmonit.la am_RandomTest_OBJECTS = RandomTest.$(OBJEXT) RandomTest_OBJECTS = $(am_RandomTest_OBJECTS) RandomTest_LDADD = $(LDADD) RandomTest_DEPENDENCIES = ../libmonit.la am_StrTest_OBJECTS = StrTest.$(OBJEXT) StrTest_OBJECTS = $(am_StrTest_OBJECTS) StrTest_LDADD = $(LDADD) StrTest_DEPENDENCIES = ../libmonit.la am_StringBufferTest_OBJECTS = StringBufferTest.$(OBJEXT) StringBufferTest_OBJECTS = $(am_StringBufferTest_OBJECTS) StringBufferTest_LDADD = $(LDADD) StringBufferTest_DEPENDENCIES = ../libmonit.la am_SystemTest_OBJECTS = SystemTest.$(OBJEXT) SystemTest_OBJECTS = $(am_SystemTest_OBJECTS) SystemTest_LDADD = $(LDADD) SystemTest_DEPENDENCIES = ../libmonit.la am_TimeTest_OBJECTS = TimeTest.$(OBJEXT) TimeTest_OBJECTS = $(am_TimeTest_OBJECTS) TimeTest_LDADD = $(LDADD) TimeTest_DEPENDENCIES = ../libmonit.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(ArrayTest_SOURCES) $(CommandTest_SOURCES) \ $(DirTest_SOURCES) $(ExceptionTest_SOURCES) \ $(FileTest_SOURCES) $(FmtTest_SOURCES) \ $(InputStreamTest_SOURCES) $(ListTest_SOURCES) \ $(NetTest_SOURCES) $(OutputStreamTest_SOURCES) \ $(RandomTest_SOURCES) $(StrTest_SOURCES) \ $(StringBufferTest_SOURCES) $(SystemTest_SOURCES) \ $(TimeTest_SOURCES) DIST_SOURCES = $(ArrayTest_SOURCES) $(CommandTest_SOURCES) \ $(DirTest_SOURCES) $(ExceptionTest_SOURCES) \ $(FileTest_SOURCES) $(FmtTest_SOURCES) \ $(InputStreamTest_SOURCES) $(ListTest_SOURCES) \ $(NetTest_SOURCES) $(OutputStreamTest_SOURCES) \ $(RandomTest_SOURCES) $(StrTest_SOURCES) \ $(StringBufferTest_SOURCES) $(SystemTest_SOURCES) \ $(TimeTest_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 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@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNIT_TEST = @UNIT_TEST@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign no-dependencies LDADD = ../libmonit.la AM_CPPFLAGS = -I../src/ -I../src/util -I../src/net -I../src/io -I../src/exceptions -I../src/thread StrTest_SOURCES = StrTest.c FmtTest_SOURCES = FmtTest.c CommandTest_SOURCES = CommandTest.c SystemTest_SOURCES = SystemTest.c RandomTest_SOURCES = RandomTest.c ListTest_SOURCES = ListTest.c ArrayTest_SOURCES = ArrayTest.c DirTest_SOURCES = DirTest.c StringBufferTest_SOURCES = StringBufferTest.c InputStreamTest_SOURCES = InputStreamTest.c OutputStreamTest_SOURCES = OutputStreamTest.c FileTest_SOURCES = FileTest.c ExceptionTest_SOURCES = ExceptionTest.c NetTest_SOURCES = NetTest.c TimeTest_SOURCES = TimeTest.c DISTCLEANFILES = *~ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list ArrayTest$(EXEEXT): $(ArrayTest_OBJECTS) $(ArrayTest_DEPENDENCIES) $(EXTRA_ArrayTest_DEPENDENCIES) @rm -f ArrayTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ArrayTest_OBJECTS) $(ArrayTest_LDADD) $(LIBS) CommandTest$(EXEEXT): $(CommandTest_OBJECTS) $(CommandTest_DEPENDENCIES) $(EXTRA_CommandTest_DEPENDENCIES) @rm -f CommandTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(CommandTest_OBJECTS) $(CommandTest_LDADD) $(LIBS) DirTest$(EXEEXT): $(DirTest_OBJECTS) $(DirTest_DEPENDENCIES) $(EXTRA_DirTest_DEPENDENCIES) @rm -f DirTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(DirTest_OBJECTS) $(DirTest_LDADD) $(LIBS) ExceptionTest$(EXEEXT): $(ExceptionTest_OBJECTS) $(ExceptionTest_DEPENDENCIES) $(EXTRA_ExceptionTest_DEPENDENCIES) @rm -f ExceptionTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ExceptionTest_OBJECTS) $(ExceptionTest_LDADD) $(LIBS) FileTest$(EXEEXT): $(FileTest_OBJECTS) $(FileTest_DEPENDENCIES) $(EXTRA_FileTest_DEPENDENCIES) @rm -f FileTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(FileTest_OBJECTS) $(FileTest_LDADD) $(LIBS) FmtTest$(EXEEXT): $(FmtTest_OBJECTS) $(FmtTest_DEPENDENCIES) $(EXTRA_FmtTest_DEPENDENCIES) @rm -f FmtTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(FmtTest_OBJECTS) $(FmtTest_LDADD) $(LIBS) InputStreamTest$(EXEEXT): $(InputStreamTest_OBJECTS) $(InputStreamTest_DEPENDENCIES) $(EXTRA_InputStreamTest_DEPENDENCIES) @rm -f InputStreamTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(InputStreamTest_OBJECTS) $(InputStreamTest_LDADD) $(LIBS) ListTest$(EXEEXT): $(ListTest_OBJECTS) $(ListTest_DEPENDENCIES) $(EXTRA_ListTest_DEPENDENCIES) @rm -f ListTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ListTest_OBJECTS) $(ListTest_LDADD) $(LIBS) NetTest$(EXEEXT): $(NetTest_OBJECTS) $(NetTest_DEPENDENCIES) $(EXTRA_NetTest_DEPENDENCIES) @rm -f NetTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(NetTest_OBJECTS) $(NetTest_LDADD) $(LIBS) OutputStreamTest$(EXEEXT): $(OutputStreamTest_OBJECTS) $(OutputStreamTest_DEPENDENCIES) $(EXTRA_OutputStreamTest_DEPENDENCIES) @rm -f OutputStreamTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(OutputStreamTest_OBJECTS) $(OutputStreamTest_LDADD) $(LIBS) RandomTest$(EXEEXT): $(RandomTest_OBJECTS) $(RandomTest_DEPENDENCIES) $(EXTRA_RandomTest_DEPENDENCIES) @rm -f RandomTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(RandomTest_OBJECTS) $(RandomTest_LDADD) $(LIBS) StrTest$(EXEEXT): $(StrTest_OBJECTS) $(StrTest_DEPENDENCIES) $(EXTRA_StrTest_DEPENDENCIES) @rm -f StrTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(StrTest_OBJECTS) $(StrTest_LDADD) $(LIBS) StringBufferTest$(EXEEXT): $(StringBufferTest_OBJECTS) $(StringBufferTest_DEPENDENCIES) $(EXTRA_StringBufferTest_DEPENDENCIES) @rm -f StringBufferTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(StringBufferTest_OBJECTS) $(StringBufferTest_LDADD) $(LIBS) SystemTest$(EXEEXT): $(SystemTest_OBJECTS) $(SystemTest_DEPENDENCIES) $(EXTRA_SystemTest_DEPENDENCIES) @rm -f SystemTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(SystemTest_OBJECTS) $(SystemTest_LDADD) $(LIBS) TimeTest$(EXEEXT): $(TimeTest_OBJECTS) $(TimeTest_DEPENDENCIES) $(EXTRA_TimeTest_DEPENDENCIES) @rm -f TimeTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TimeTest_OBJECTS) $(TimeTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(AM_V_CC)$(COMPILE) -c -o $@ $< .c.obj: $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile verify: @/bin/sh ./test.sh # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: monit-5.35.2/libmonit/test/FileTest.c0000644000016400001720000001645515007061157014344 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "File.h" /** * File.c unity tests. */ int main(void) { char path[STRLEN]; Bootstrap(); // Need to initialize library printf("============> Start File Tests\n\n"); snprintf(path, STRLEN, "/tmp/.FileTest.%d", getpid()); printf("=> Test1: open/close\n"); { int fd; assert((fd = File_open(path, "w")) != -1); assert(File_close(fd) == true); assert((fd = File_open(path, "w+")) != -1); assert(File_close(fd) == true); assert((fd = File_open("/a/b/c/d", "r")) == -1); assert((fd = File_open(path, "r")) != -1); assert(File_close(fd) == true); assert((fd = File_open(path, "r+")) != -1); assert(File_close(fd) == true); assert((fd = File_open(path, "a")) != -1); assert(File_close(fd) == true); assert((fd = File_open(path, "a+")) != -1); assert(write(fd, "something", sizeof("something") - 1) > 0); assert(File_close(fd) == true); assert((fd = File_open(NULL, NULL)) == -1); } printf("=> Test1: OK\n\n"); printf("=> Test2: check properties (class)\n"); { char c; int i; long j; long long k; struct stat s; assert(stat(path, &s) == 0); assert((j = File_mtime(path)) > 0); printf("\tmodification time: %ld\n", j); assert(j == s.st_mtime); assert((j = File_mtime(NULL)) == -1); assert((j = File_ctime(path)) > 0); printf("\tchange time: %ld\n", j); assert(j == s.st_ctime); assert((j = File_ctime(NULL)) == -1); assert((j = File_atime(path)) > 0); printf("\taccess time: %ld\n", j); assert(j == s.st_atime); assert((j = File_atime(NULL)) == -1); assert((k = File_size(path)) >= 0); printf("\tsize: %lld B\n", k); assert(k == s.st_size); assert(File_size(NULL) == -1); assert(File_size("blabla123") == -1); assert((c = File_isFile(path)) == true); assert((c = File_isFile(NULL)) == false); assert((c = File_type(path)) == 'r'); assert(File_type(NULL) == '?'); printf("\ttype: regular file\n"); assert((File_exist(path)) == true); assert((File_exist(NULL)) == false); printf("\texist: yes\n"); assert((i = File_mod(path)) > 0); printf("\tpermission mode: %o\n", i & 07777); assert(i == (int)s.st_mode); assert(File_chmod(path, 00640) == true); assert((File_mod(path) & 07777) == 00640); assert(File_isReadable(path) == true); assert(File_isReadable(NULL) == false); assert(File_isWritable(path) == true); assert(File_isWritable(NULL) == false); assert(File_chmod(NULL, 00640) == false); assert(File_delete(NULL) == false); assert(File_rename(NULL, NULL) == false); assert(File_basename(NULL) == NULL); assert(File_extension(NULL) == NULL); assert(File_extension("") == NULL); #if defined(SOLARIS) || defined (AIX) || defined(DRAGONFLY) /* Some systems return X_OK if the process has appropriate privilege even if none of the execute file permission bits are set. */ if (getuid() == 0) assert(File_isExecutable(path) == true); else #endif assert(File_isExecutable(path) == false); assert(File_isExecutable(NULL) == false); } printf("=> Test2: OK\n\n"); printf("=> Test3: check directory\n"); { assert(File_isDirectory("/") == true); assert(File_isDirectory(NULL) == false); assert(File_type("/") == 'd'); assert(File_isDirectory(path) == false); } printf("=> Test3: OK\n\n"); printf("=> Test4: check umask\n"); { int i; assert((i = File_umask()) >= 0); printf("\tumask: %o\n", i & 07777); assert((int)File_setUmask(0002) == i); assert(File_setUmask(i) == 0002); } printf("=> Test4: OK\n\n"); printf("=> Test5: rename\n"); { File_rename(path, "/tmp/.FileTest.abcde"); snprintf(path, STRLEN, "/tmp/.FileTest.abcde"); // the file is kept for later tests } printf("=> Test5: OK\n\n"); printf("=> Test6: path parsing\n"); { char s[STRLEN]; assert(Str_isEqual(File_basename(path), ".FileTest.abcde")); snprintf(s, STRLEN, "%s", path); assert(Str_isEqual(File_dirname(s), "/tmp/")); assert(Str_isEqual(File_extension(path), "abcde")); snprintf(s, STRLEN, "tmp"); assert(Str_isEqual(File_dirname(s), ".")); assert(File_extension(NULL) == NULL); char dir_path[] = "/tmp/"; assert(Str_isEqual(File_removeTrailingSeparator(dir_path), "/tmp")); } printf("=> Test6: OK\n\n"); printf("=> Test7: normalize path\n"); { char s[PATH_MAX]; assert(File_realPath(NULL, s) == NULL); assert(File_realPath(s, NULL) == NULL); assert(File_realPath(NULL, NULL) == NULL); assert(File_realPath("/././tmp/../tmp", s) != NULL); #ifdef DARWIN /* On Darwin /tmp is a link to /private/tmp */ assert(Str_isEqual(s, "/private/tmp")); #else assert(Str_isEqual(s, "/tmp")); #endif } printf("=> Test7: OK\n\n"); printf("=> Test8: delete\n"); { assert(File_delete(path) == true); assert(File_exist(path) == false); } printf("=> Test8: OK\n\n"); printf("=> Test9: removeTrailingSeparator\n"); { char a[] = "/abc/def/"; char b[] = "/abc/def"; assert(Str_isEqual(File_removeTrailingSeparator(a), "/abc/def")); assert(Str_isEqual(File_removeTrailingSeparator(b), "/abc/def")); assert(Str_isEqual(File_removeTrailingSeparator(""), "")); assert(File_removeTrailingSeparator(NULL) == NULL); } printf("=> Test9: OK\n\n"); printf("=> Test10: check socket\n"); { assert(File_isSocket("/") == false); assert(File_isSocket(NULL) == false); //FIXME: add socket test that'll return true } printf("=> Test10: OK\n\n"); printf("============> File Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/OutputStreamTest.c0000644000016400001720000002002315007061157016123 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include "Bootstrap.h" #include "OutputStream.h" #include "File.h" #include "Str.h" /** * OutputStream.c unit tests. */ #define STDOUT 1 #define TIMEOUT 50 int main(void) { OutputStream_T out = NULL; Bootstrap(); // Need to initialize library printf("============> Start OutputStream Tests\n\n"); printf("=> Test0: create/destroy the stream\n"); { out = OutputStream_new(STDOUT); assert(OutputStream_getDescriptor(out) == STDOUT); assert(!OutputStream_isClosed(out)); OutputStream_free(&out); assert(out == NULL); } printf("=> Test0: OK\n\n"); printf("=> Test1: get/set timeout\n"); { out = OutputStream_new(STDOUT); printf("\tCurrent timeout: %lldms\n", (long long)OutputStream_getTimeout(out)); OutputStream_setTimeout(out, TIMEOUT); assert(OutputStream_getTimeout(out) == TIMEOUT); printf("\tTimeout set to: %dms\n", TIMEOUT); OutputStream_free(&out); } printf("=> Test1: OK\n\n"); printf("=> Test2: write buffer bytes, test flush and status\n"); { int bytes = strlen("line1\nline2\nline3\n"); char data[] = "line1\nline2\nline3\n"; out = OutputStream_new(STDOUT); assert(0 == OutputStream_buffered(out)); assert(bytes == OutputStream_write(out, data, (int)strlen(data))); assert(bytes == OutputStream_buffered(out)); assert(0 == OutputStream_getBytesWritten(out)); OutputStream_flush(out); assert(bytes == OutputStream_getBytesWritten(out)); // Test writing lower bytes OutputStream_clear(out); char b[] = {0,0,0,0}; assert(OutputStream_write(out, b, 4) == 4); OutputStream_free(&out); } printf("=> Test2: OK\n\n"); printf("=> Test3: printf format\n"); { out = OutputStream_new(STDOUT); // Test supported format specifiers assert(OutputStream_print(out, "%s", "hello") == 5); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%c", 'h') == 1); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%d", 12345) == 5); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%i", -12345) == 6); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%u", 12345) == 5); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%o", 8) == 2); //10 assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%x", 255) == 2); //ff assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%e", 12.34) == 12); //1.234000e+01 assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%f", -12.34) == 10); //-12.340000 assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%g", 12.34) == 6); //012.34 assert(OutputStream_print(out, "\n") == 1); OutputStream_print(out, "%p", out); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%%hello%%") == 7); assert(OutputStream_print(out, "\n") == 1); // Length modifier assert(OutputStream_print(out, "%ld", 32767L) == 5); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%li", -32767L) == 6); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%lu", 32767L) == 5); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%lo", 32767L) == 5); //77777 assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%lx", 32767L) == 4); //7fff assert(OutputStream_print(out, "\n") == 1); // Test width and precision assert(OutputStream_print(out, "%16.16s\n%16.16s\n", "hello", "world") == 34); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%-16.16s\n%-16.16s\n", "hello", "world") == 34); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%.2f", 12.3456789) == 5); //12.35 assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%02d", 3) == 2); // 03 assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%*d", 2, 3) == 2); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%*d", -1, 3) == 1); assert(OutputStream_print(out, "\n") == 1); assert(OutputStream_print(out, "%.*d", 2, 3) == 2); assert(OutputStream_print(out, "\n") == 1); OutputStream_flush(out); OutputStream_clear(out); OutputStream_free(&out); } printf("=> Test3: OK\n\n"); printf("=> Test4: write two concatenated lines\n"); { int i = 0; out = OutputStream_new(STDOUT); while (i++ < 2) { OutputStream_print(out, "line%d", i); } OutputStream_print(out, "\n"); OutputStream_flush(out); OutputStream_free(&out); } printf("=> Test4: OK\n\n"); printf("=> Test5: output reset - just the line[5-9] should show\n"); { int i = 0; out = OutputStream_new(STDOUT); while (i++ < 9) { OutputStream_print(out, "line%d\n", i); if (i == 4) { OutputStream_clear(out); } } OutputStream_flush(out); OutputStream_free(&out); } printf("=> Test5: OK\n\n"); printf("=> Test6: wrong descriptor - expecting write fail\n"); { out = OutputStream_new(999); TRY OutputStream_print(out, "Should not show"); assert(OutputStream_flush(out) != -1); printf("Test6: Failed"); exit(1); // Should not come here CATCH(AssertException) // Passed END_TRY; OutputStream_free(&out); } printf("=> Test6: OK\n\n"); printf("=> Test7: printf large buffer\n"); { // Note, test assume OutputStream buffer is 1500 char a[1024]; memset(a, 'x', 1024); a[1023] = 0; out = OutputStream_new(STDOUT); // Test fit into buffer assert(OutputStream_print(out, "data: %s\n", a) == 1030); assert(OutputStream_flush(out) == 1030); // Test when data is larger than OutputStream buffer char b[2048]; memset(b, 'y', 2048); b[2047] = 0; assert(OutputStream_print(out, "data: %s\n", b) == 2054); OutputStream_free(&out); } printf("=> Test7: OK\n\n"); printf("============> OutputStream Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/TimeTest.c0000644000016400001720000003420515007061157014354 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/Time.h" /** * Time.c unity tests. */ int main(void) { // Note: When the below setenv() is present on Alpine linux with MUSL, the test Time_localStr test fails and returns UTC time. The tzset() is called automatically // by localtime_r(). The test may fail though, if it is executed on machine, which is not in CET timezone. //setenv("TZ", "CET", 1); //tzset(); Bootstrap(); // Need to initialize library printf("============> Start Time Tests\n\n"); printf("=> Test1: check string output\n"); { char result[STRLEN]; Time_localStr(1267441200, result); /* 01 Mar 2010 12:00:00 */ printf("\tResult: unix time 1267441200 to localtime:\n\t %s\n", result); assert(Str_isEqual(result, "Mon, 01 Mar 2010 12:00:00")); Time_str(1267441200, result); /* 01 Mar 2010 11:00:00 GMT */ printf("\tResult: unix time 1267441200 to UTC:\n\t %s\n", result); assert(Str_isEqual("Mon, 01 Mar 2010 11:00:00 GMT", result)); Time_fmt(result, STRLEN, "%D %T", 1267441200); printf("\tResult: 1267441200 -> %s\n", result); assert(Str_isEqual(result, "03/01/10 11:00:00")); Time_fmt(result, STRLEN, "%D %z", 1267441200); printf("\tResult: 1267441200 -> %s\n", result); #ifdef AIX assert(Str_startsWith(result, "03/01/10 CET")); #else assert(Str_startsWith(result, "03/01/10 +")); #endif // Short buffer Time_fmt(result, 1, "%D %T", 1267441200); assert(Str_isEqual(result, "")); } printf("=> Test1: OK\n\n"); printf("=> Test2: check current time\n"); { struct timeval tv; assert(!gettimeofday(&tv, NULL)); assert(Time_now() == tv.tv_sec); } printf("=> Test2: OK\n\n"); printf("=> Test3: sleep 0.1s\n"); { long long startMs = Time_monotonic().milliseconds; Time_usleep(100000LL); // Sleep for 100 ms (100,000 µs) long long elapsedMs = Time_monotonic().milliseconds - startMs; printf("\tElapsed ms: %lld\n", elapsedMs); long long toleranceMs = 10LL; // Tolerate 10 ms drift assert(elapsedMs >= 100 && elapsedMs <= 100 + toleranceMs); } printf("=> Test3: OK\n\n"); printf("=> Test4: uptime\n"); { time_t days = 668040; time_t hours = 63240; time_t min = 2040; char result[24]; printf("\tResult: uptime days: %s\n", Time_uptime(days, result)); assert(Str_isEqual(result, "7d, 17h, 34m")); printf("\tResult: uptime hours: %s\n", Time_uptime(hours, result)); assert(Str_isEqual(result, "17h, 34m")); printf("\tResult: uptime min: %s\n", Time_uptime(min, result)); assert(Str_isEqual(result, "34m")); printf("\tResult: uptime 0: %s\n", Time_uptime(0, result)); assert(Str_isEqual(result, "")); } printf("=> Test4: OK\n\n"); printf("=> Test5: Time attributes\n"); { char b[STRLEN]; time_t time = 730337459; // Sun, 21 Feb 1993 23:30:59 GMT printf("\tResult: %s (winter time)\n", Time_str(time, b)); assert(Str_isEqual(b, "Sun, 21 Feb 1993 23:30:59 GMT")); time = 1253045894; // Tue, 15 Sep 2009n 20:18:14 printf("\tResult: %s (DTS/summer time)\n", Time_str(time, b)); assert(Str_startsWith(b, "Tue, 15 Sep 2009 20:18:14")); } printf("=> Test5: OK\n\n"); printf("=> Test6: Time_build\n"); { time_t time = Time_build(2001, 1, 29, 12, 0, 0); struct tm tm; gmtime_r(&time, &tm); assert(tm.tm_sec == 0); assert(tm.tm_min == 0); assert(tm.tm_hour == 12); assert(tm.tm_mday == 29); assert(tm.tm_mon + 1 == 1); assert(tm.tm_year + 1900 == 2001); // Verify assert on out of range TRY { Time_build(1969, 1, 29, 12, 0, 0); printf("Test failed\n"); exit(1); } CATCH (AssertException) END_TRY; TRY { Time_build(1970, 0, 29, 12, 0, 0); printf("Test failed\n"); exit(1); } CATCH (AssertException) END_TRY; } printf("=> Test6: OK\n\n"); printf("=> Test7: Time_incron\n"); { // Cannot test match on time as the TZ this test // runs in is unknown. Time_incron converts time // to local time. // const char *exactmatch = "27 11 5 7 2"; const char *matchall = "* * * * *"; const char *invalid1 = "a bc d"; const char *invalid2 = "* * * * "; // Too few fields const char *invalid3 = "* * * * * * "; // Too many fields // const char *range1 = "* 10-11 1-5 * 1-5"; // const char *rangeoutside = "1-10 9-10 1-5 * 1-5"; // const char *sequence = "* 10,11 1-3,5,6 * *"; // const char *sequenceoutside = "* 10,11,12 4,5,6 * 0,6"; time_t time = Time_build(2011, 7, 5, 11, 27, 5); // assert(Time_incron(exactmatch, time)); assert(Time_incron(matchall, time)); assert(! Time_incron(invalid1, time)); assert(! Time_incron(invalid2, time)); assert(! Time_incron(invalid3, time)); // assert(Time_incron(range1, time)); // assert(! Time_incron(rangeoutside, time)); // assert(Time_incron(sequence, time)); //assert(! Time_incron(sequenceoutside, time)); } printf("=> Test7: OK\n\n"); printf("=> Test8: Time_toDateTime\n"); { #if HAVE_STRUCT_TM_TM_GMTOFF #define TM_GMTOFF tm_gmtoff #else #define TM_GMTOFF tm_wday #endif struct tm t; // DateTime ISO-8601 format assert(Time_toDateTime("2013-12-14T09:38:08Z", &t)); assert(t.tm_year == 2013); assert(t.tm_mon == 11); assert(t.tm_mday == 14); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); // Date assert(Time_toDateTime("2013-12-14", &t)); assert(t.tm_year == 2013); assert(t.tm_mon == 11); assert(t.tm_mday == 14); // Date dd/mm/yyyy assert(Time_toDateTime("14/12/2013", &t)); assert(t.tm_year == 2013); assert(t.tm_mon == 11); assert(t.tm_mday == 14); // Time assert(Time_toDateTime("09:38:08", &t)); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); // Compressed DateTime assert(Time_toDateTime(" 20131214093808", &t)); assert(t.tm_year == 2013); assert(t.tm_mon == 11); assert(t.tm_mday == 14); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); // Compressed Date assert(Time_toDateTime(" 20131214 ", &t)); assert(t.tm_year == 2013); assert(t.tm_mon == 11); assert(t.tm_mday == 14); // Compressed Time assert(Time_toDateTime("093808", &t)); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); // Time: HH:MM assert(Time_toDateTime("09:38", &t)); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 0); // Reverse DateTime assert(Time_toDateTime(" 09:38:08 2013-12-14", &t)); assert(t.tm_year == 2013); assert(t.tm_mon == 11); assert(t.tm_mday == 14); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); // DateTime with timezone Zulu (UTC) assert(Time_toDateTime("The Battle of Stamford Bridge 1066-09-25 12:15:33+00:00", &t)); assert(t.tm_year == 1066); assert(t.tm_mon == 8); assert(t.tm_mday == 25); assert(t.tm_hour == 12); assert(t.tm_min == 15); assert(t.tm_sec == 33); assert(t.TM_GMTOFF == 0); // offset from UTC in seconds // Time with timezone assert(Time_toDateTime(" 09:38:08+01:45", &t)); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); assert(t.TM_GMTOFF == 6300); // Time with timezone PST compressed assert(Time_toDateTime("Pacific Time Zone 09:38:08 -0800 ", &t)); assert(t.tm_hour == 9); assert(t.tm_min == 38); assert(t.tm_sec == 8); assert(t.TM_GMTOFF == -28800); // Date without time, tz should not be set assert(Time_toDateTime("2013-12-15-0800 ", &t)); assert(t.TM_GMTOFF == 0); // RFC 7231 IMF-fixdate (HTTP date) assert(Time_toDateTime("Sun, 06 Nov 1994 08:49:37 GMT", &t)); assert(t.tm_year == 1994); assert(t.tm_mon == 10); assert(t.tm_mday == 6); assert(t.tm_hour == 8); assert(t.tm_min == 49); assert(t.tm_sec == 37); // Invalid date TRY { Time_toDateTime("1901-13-25", &t); printf("\t Test Failed\n"); exit(1); } CATCH (AssertException) { // OK } ELSE { printf("\t Test Failed with wrong exception\n"); exit(1); } END_TRY; TRY { Time_toDateTime("19", &t); printf("\t Test Failed\n"); exit(1); } CATCH (AssertException) { // OK } ELSE { printf("\t Test Failed with wrong exception\n"); exit(1); } END_TRY; TRY { Time_toDateTime("", &t); printf("\t Test Failed\n"); exit(1); } CATCH (AssertException) { // OK } ELSE { printf("\t Test Failed with wrong exception\n"); exit(1); } END_TRY; } printf("=> Test8: OK\n\n"); printf("=> Test9: Time_toTimestamp\n"); { // Time, fraction of second is ignored. No timezone in string means UTC time_t t = Time_toTimestamp("2013-12-15 00:12:58.123456"); assert(t == 1387066378); // TimeZone east t = Time_toTimestamp("Tokyo timezone: 2013-12-15 09:12:58+09:00"); assert(t == 1387066378); // TimeZone west t = Time_toTimestamp("New York timezone: 2013-12-14 19:12:58-05:00"); assert(t == 1387066378); // TimeZone east with hour and minute offset t = Time_toTimestamp("Nepal timezone: 2013-12-15 05:57:58+05:45"); assert(t == 1387066378); // TimeZone Zulu t = Time_toTimestamp("Grenwich timezone: 2013-12-15 00:12:58Z"); assert(t == 1387066378); // Compressed t = Time_toTimestamp("20131214191258-0500"); assert(t == 1387066378); // RFC 7231 IMF-fixdate (HTTP date) t = Time_toTimestamp("Sun, 15 Dec 2013 00:12:58 GMT"); assert(t == 1387066378); // Invalid timestamp string TRY { Time_toTimestamp("2013-13-15 25:12:58"); // Should not come here printf("\t Test Failed\n"); exit(1); } CATCH (AssertException) { // OK } ELSE { printf("\t Test Failed with wrong exception\n"); exit(1); } END_TRY; // NULL assert(Time_toTimestamp("") == 0); assert(Time_toTimestamp(NULL) == 0); } printf("=> Test9: OK\n\n"); printf("=> Test10: Time_milli\n"); { long long t1 = Time_milli(); usleep(500000); long long t2 = Time_milli(); assert(t2 - t1 >= 500LL); } printf("=> Test10: OK\n\n"); printf("=> Test11: Time_micro\n"); { long long t1 = Time_micro(); usleep(500); long long t2 = Time_micro(); assert(t2 - t1 >= 500LL); } printf("=> Test11: OK\n\n"); printf("============> Time Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/Makefile.am0000644000016400001720000000226015007061157014502 00000000000000AUTOMAKE_OPTIONS = foreign no-dependencies LDADD = ../libmonit.la AM_CPPFLAGS = -I../src/ -I../src/util -I../src/net -I../src/io -I../src/exceptions -I../src/thread noinst_PROGRAMS = StrTest \ FmtTest \ SystemTest \ RandomTest \ ArrayTest \ ListTest \ DirTest \ StringBufferTest \ InputStreamTest \ OutputStreamTest \ FileTest \ ExceptionTest \ NetTest \ TimeTest \ CommandTest StrTest_SOURCES = StrTest.c FmtTest_SOURCES = FmtTest.c CommandTest_SOURCES = CommandTest.c SystemTest_SOURCES = SystemTest.c RandomTest_SOURCES = RandomTest.c ListTest_SOURCES = ListTest.c ArrayTest_SOURCES = ArrayTest.c DirTest_SOURCES = DirTest.c StringBufferTest_SOURCES = StringBufferTest.c InputStreamTest_SOURCES = InputStreamTest.c OutputStreamTest_SOURCES = OutputStreamTest.c FileTest_SOURCES = FileTest.c ExceptionTest_SOURCES = ExceptionTest.c NetTest_SOURCES = NetTest.c TimeTest_SOURCES = TimeTest.c DISTCLEANFILES = *~ verify: @/bin/sh ./test.sh monit-5.35.2/libmonit/test/Makefile0000644000016400001720000005715615007061176014125 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # test/Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/libmonit pkgincludedir = $(includedir)/libmonit pkglibdir = $(libdir)/libmonit pkglibexecdir = $(libexecdir)/libmonit am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = x86_64-pc-linux-gnu host_triplet = x86_64-pc-linux-gnu noinst_PROGRAMS = StrTest$(EXEEXT) FmtTest$(EXEEXT) \ SystemTest$(EXEEXT) RandomTest$(EXEEXT) ArrayTest$(EXEEXT) \ ListTest$(EXEEXT) DirTest$(EXEEXT) StringBufferTest$(EXEEXT) \ InputStreamTest$(EXEEXT) OutputStreamTest$(EXEEXT) \ FileTest$(EXEEXT) ExceptionTest$(EXEEXT) NetTest$(EXEEXT) \ TimeTest$(EXEEXT) CommandTest$(EXEEXT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/config/ax_check_compile_flag.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/xconfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_ArrayTest_OBJECTS = ArrayTest.$(OBJEXT) ArrayTest_OBJECTS = $(am_ArrayTest_OBJECTS) ArrayTest_LDADD = $(LDADD) ArrayTest_DEPENDENCIES = ../libmonit.la AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent am__v_lt_1 = am_CommandTest_OBJECTS = CommandTest.$(OBJEXT) CommandTest_OBJECTS = $(am_CommandTest_OBJECTS) CommandTest_LDADD = $(LDADD) CommandTest_DEPENDENCIES = ../libmonit.la am_DirTest_OBJECTS = DirTest.$(OBJEXT) DirTest_OBJECTS = $(am_DirTest_OBJECTS) DirTest_LDADD = $(LDADD) DirTest_DEPENDENCIES = ../libmonit.la am_ExceptionTest_OBJECTS = ExceptionTest.$(OBJEXT) ExceptionTest_OBJECTS = $(am_ExceptionTest_OBJECTS) ExceptionTest_LDADD = $(LDADD) ExceptionTest_DEPENDENCIES = ../libmonit.la am_FileTest_OBJECTS = FileTest.$(OBJEXT) FileTest_OBJECTS = $(am_FileTest_OBJECTS) FileTest_LDADD = $(LDADD) FileTest_DEPENDENCIES = ../libmonit.la am_FmtTest_OBJECTS = FmtTest.$(OBJEXT) FmtTest_OBJECTS = $(am_FmtTest_OBJECTS) FmtTest_LDADD = $(LDADD) FmtTest_DEPENDENCIES = ../libmonit.la am_InputStreamTest_OBJECTS = InputStreamTest.$(OBJEXT) InputStreamTest_OBJECTS = $(am_InputStreamTest_OBJECTS) InputStreamTest_LDADD = $(LDADD) InputStreamTest_DEPENDENCIES = ../libmonit.la am_ListTest_OBJECTS = ListTest.$(OBJEXT) ListTest_OBJECTS = $(am_ListTest_OBJECTS) ListTest_LDADD = $(LDADD) ListTest_DEPENDENCIES = ../libmonit.la am_NetTest_OBJECTS = NetTest.$(OBJEXT) NetTest_OBJECTS = $(am_NetTest_OBJECTS) NetTest_LDADD = $(LDADD) NetTest_DEPENDENCIES = ../libmonit.la am_OutputStreamTest_OBJECTS = OutputStreamTest.$(OBJEXT) OutputStreamTest_OBJECTS = $(am_OutputStreamTest_OBJECTS) OutputStreamTest_LDADD = $(LDADD) OutputStreamTest_DEPENDENCIES = ../libmonit.la am_RandomTest_OBJECTS = RandomTest.$(OBJEXT) RandomTest_OBJECTS = $(am_RandomTest_OBJECTS) RandomTest_LDADD = $(LDADD) RandomTest_DEPENDENCIES = ../libmonit.la am_StrTest_OBJECTS = StrTest.$(OBJEXT) StrTest_OBJECTS = $(am_StrTest_OBJECTS) StrTest_LDADD = $(LDADD) StrTest_DEPENDENCIES = ../libmonit.la am_StringBufferTest_OBJECTS = StringBufferTest.$(OBJEXT) StringBufferTest_OBJECTS = $(am_StringBufferTest_OBJECTS) StringBufferTest_LDADD = $(LDADD) StringBufferTest_DEPENDENCIES = ../libmonit.la am_SystemTest_OBJECTS = SystemTest.$(OBJEXT) SystemTest_OBJECTS = $(am_SystemTest_OBJECTS) SystemTest_LDADD = $(LDADD) SystemTest_DEPENDENCIES = ../libmonit.la am_TimeTest_OBJECTS = TimeTest.$(OBJEXT) TimeTest_OBJECTS = $(am_TimeTest_OBJECTS) TimeTest_LDADD = $(LDADD) TimeTest_DEPENDENCIES = ../libmonit.la AM_V_P = $(am__v_P_$(V)) am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I. -I$(top_builddir)/src depcomp = am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(ArrayTest_SOURCES) $(CommandTest_SOURCES) \ $(DirTest_SOURCES) $(ExceptionTest_SOURCES) \ $(FileTest_SOURCES) $(FmtTest_SOURCES) \ $(InputStreamTest_SOURCES) $(ListTest_SOURCES) \ $(NetTest_SOURCES) $(OutputStreamTest_SOURCES) \ $(RandomTest_SOURCES) $(StrTest_SOURCES) \ $(StringBufferTest_SOURCES) $(SystemTest_SOURCES) \ $(TimeTest_SOURCES) DIST_SOURCES = $(ArrayTest_SOURCES) $(CommandTest_SOURCES) \ $(DirTest_SOURCES) $(ExceptionTest_SOURCES) \ $(FileTest_SOURCES) $(FmtTest_SOURCES) \ $(InputStreamTest_SOURCES) $(ListTest_SOURCES) \ $(NetTest_SOURCES) $(OutputStreamTest_SOURCES) \ $(RandomTest_SOURCES) $(StrTest_SOURCES) \ $(StringBufferTest_SOURCES) $(SystemTest_SOURCES) \ $(TimeTest_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = ${SHELL} '/var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/config/missing' aclocal-1.16 AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 1 AR = ar AUTOCONF = ${SHELL} '/var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/config/missing' autoconf AUTOHEADER = ${SHELL} '/var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/config/missing' autoheader AUTOMAKE = ${SHELL} '/var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/config/missing' automake-1.16 AWK = gawk CC = gcc CCDEPMODE = depmode=none CFLAGS = -g -O2 -Wextra -fstack-protector-all -D _REENTRANT -D_GNU_SOURCE -Wall -Wunused -std=c11 CPPFLAGS = CSCOPE = cscope CTAGS = ctags CXX = g++ CXXCPP = g++ -E CXXDEPMODE = depmode=none CXXFLAGS = -g -O2 CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DLLTOOL = false DSYMUTIL = DUMPBIN = ECHO_C = ECHO_N = -n ECHO_T = EGREP = /usr/bin/grep -E ETAGS = etags EXEEXT = FGREP = /usr/bin/grep -F GREP = /usr/bin/grep INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = $(install_sh) -c -s LD = /usr/bin/ld -m elf_x86_64 LDFLAGS = -lrt LIBOBJS = LIBS = -lm -lpthread -lz LIBTOOL = $(SHELL) $(top_builddir)/libtool LIPO = LN_S = ln -s LTLIBOBJS = LT_SYS_LIBRARY_PATH = MAKEINFO = ${SHELL} '/var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/config/missing' makeinfo MANIFEST_TOOL = : MKDIR_P = /usr/bin/mkdir -p NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump OBJEXT = o OTOOL = OTOOL64 = PACKAGE = libmonit PACKAGE_BUGREPORT = monit-dev@tildeslash.com PACKAGE_NAME = libmonit PACKAGE_STRING = libmonit 1.0 PACKAGE_TARNAME = libmonit PACKAGE_URL = PACKAGE_VERSION = 1.0 PATH_SEPARATOR = : RANLIB = ranlib SED = /usr/bin/sed SET_MAKE = SHELL = /bin/bash STRIP = strip UNIT_TEST = test VERSION = 1.0 abs_builddir = /var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/test abs_srcdir = /var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/test abs_top_builddir = /var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit abs_top_srcdir = /var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit ac_ct_AR = ar ac_ct_CC = gcc ac_ct_CXX = g++ ac_ct_DUMPBIN = am__include = include am__leading_dot = . am__quote = am__tar = $${TAR-tar} chof - "$$tardir" am__untar = $${TAR-tar} xf - bindir = ${exec_prefix}/bin build = x86_64-pc-linux-gnu build_alias = build_cpu = x86_64 build_os = linux-gnu build_vendor = pc builddir = . datadir = ${datarootdir} datarootdir = ${prefix}/share docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} dvidir = ${docdir} exec_prefix = ${prefix} host = x86_64-pc-linux-gnu host_alias = host_cpu = x86_64 host_os = linux-gnu host_vendor = pc htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info install_sh = ${SHELL} '/var/lib/jenkins/workspace/A2. Monit source tar.gz release (master branch)/label/built-in/libmonit/config/install-sh' libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale localstatedir = ${prefix}/var mandir = ${datarootdir}/man mkdir_p = $(MKDIR_P) oldincludedir = /usr/include pdfdir = ${docdir} prefix = /usr/local program_transform_name = s,x,x, psdir = ${docdir} runstatedir = ${localstatedir}/run sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com srcdir = . sysconfdir = ${prefix}/etc target_alias = top_build_prefix = ../ top_builddir = .. top_srcdir = .. AUTOMAKE_OPTIONS = foreign no-dependencies LDADD = ../libmonit.la AM_CPPFLAGS = -I../src/ -I../src/util -I../src/net -I../src/io -I../src/exceptions -I../src/thread StrTest_SOURCES = StrTest.c FmtTest_SOURCES = FmtTest.c CommandTest_SOURCES = CommandTest.c SystemTest_SOURCES = SystemTest.c RandomTest_SOURCES = RandomTest.c ListTest_SOURCES = ListTest.c ArrayTest_SOURCES = ArrayTest.c DirTest_SOURCES = DirTest.c StringBufferTest_SOURCES = StringBufferTest.c InputStreamTest_SOURCES = InputStreamTest.c OutputStreamTest_SOURCES = OutputStreamTest.c FileTest_SOURCES = FileTest.c ExceptionTest_SOURCES = ExceptionTest.c NetTest_SOURCES = NetTest.c TimeTest_SOURCES = TimeTest.c DISTCLEANFILES = *~ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list ArrayTest$(EXEEXT): $(ArrayTest_OBJECTS) $(ArrayTest_DEPENDENCIES) $(EXTRA_ArrayTest_DEPENDENCIES) @rm -f ArrayTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ArrayTest_OBJECTS) $(ArrayTest_LDADD) $(LIBS) CommandTest$(EXEEXT): $(CommandTest_OBJECTS) $(CommandTest_DEPENDENCIES) $(EXTRA_CommandTest_DEPENDENCIES) @rm -f CommandTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(CommandTest_OBJECTS) $(CommandTest_LDADD) $(LIBS) DirTest$(EXEEXT): $(DirTest_OBJECTS) $(DirTest_DEPENDENCIES) $(EXTRA_DirTest_DEPENDENCIES) @rm -f DirTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(DirTest_OBJECTS) $(DirTest_LDADD) $(LIBS) ExceptionTest$(EXEEXT): $(ExceptionTest_OBJECTS) $(ExceptionTest_DEPENDENCIES) $(EXTRA_ExceptionTest_DEPENDENCIES) @rm -f ExceptionTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ExceptionTest_OBJECTS) $(ExceptionTest_LDADD) $(LIBS) FileTest$(EXEEXT): $(FileTest_OBJECTS) $(FileTest_DEPENDENCIES) $(EXTRA_FileTest_DEPENDENCIES) @rm -f FileTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(FileTest_OBJECTS) $(FileTest_LDADD) $(LIBS) FmtTest$(EXEEXT): $(FmtTest_OBJECTS) $(FmtTest_DEPENDENCIES) $(EXTRA_FmtTest_DEPENDENCIES) @rm -f FmtTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(FmtTest_OBJECTS) $(FmtTest_LDADD) $(LIBS) InputStreamTest$(EXEEXT): $(InputStreamTest_OBJECTS) $(InputStreamTest_DEPENDENCIES) $(EXTRA_InputStreamTest_DEPENDENCIES) @rm -f InputStreamTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(InputStreamTest_OBJECTS) $(InputStreamTest_LDADD) $(LIBS) ListTest$(EXEEXT): $(ListTest_OBJECTS) $(ListTest_DEPENDENCIES) $(EXTRA_ListTest_DEPENDENCIES) @rm -f ListTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ListTest_OBJECTS) $(ListTest_LDADD) $(LIBS) NetTest$(EXEEXT): $(NetTest_OBJECTS) $(NetTest_DEPENDENCIES) $(EXTRA_NetTest_DEPENDENCIES) @rm -f NetTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(NetTest_OBJECTS) $(NetTest_LDADD) $(LIBS) OutputStreamTest$(EXEEXT): $(OutputStreamTest_OBJECTS) $(OutputStreamTest_DEPENDENCIES) $(EXTRA_OutputStreamTest_DEPENDENCIES) @rm -f OutputStreamTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(OutputStreamTest_OBJECTS) $(OutputStreamTest_LDADD) $(LIBS) RandomTest$(EXEEXT): $(RandomTest_OBJECTS) $(RandomTest_DEPENDENCIES) $(EXTRA_RandomTest_DEPENDENCIES) @rm -f RandomTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(RandomTest_OBJECTS) $(RandomTest_LDADD) $(LIBS) StrTest$(EXEEXT): $(StrTest_OBJECTS) $(StrTest_DEPENDENCIES) $(EXTRA_StrTest_DEPENDENCIES) @rm -f StrTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(StrTest_OBJECTS) $(StrTest_LDADD) $(LIBS) StringBufferTest$(EXEEXT): $(StringBufferTest_OBJECTS) $(StringBufferTest_DEPENDENCIES) $(EXTRA_StringBufferTest_DEPENDENCIES) @rm -f StringBufferTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(StringBufferTest_OBJECTS) $(StringBufferTest_LDADD) $(LIBS) SystemTest$(EXEEXT): $(SystemTest_OBJECTS) $(SystemTest_DEPENDENCIES) $(EXTRA_SystemTest_DEPENDENCIES) @rm -f SystemTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(SystemTest_OBJECTS) $(SystemTest_LDADD) $(LIBS) TimeTest$(EXEEXT): $(TimeTest_OBJECTS) $(TimeTest_DEPENDENCIES) $(EXTRA_TimeTest_DEPENDENCIES) @rm -f TimeTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TimeTest_OBJECTS) $(TimeTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(AM_V_CC)$(COMPILE) -c -o $@ $< .c.obj: $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile verify: @/bin/sh ./test.sh # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: monit-5.35.2/libmonit/test/StringBufferTest.c0000644000016400001720000005103515007061157016056 00000000000000#include "Config.h" #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "StringBuffer.h" /** * StringBuffer.c unity tests. */ __attribute__((format (printf, 2, 3))) static void append(StringBuffer_T B, const char *s, ...) { va_list ap; va_start(ap, s); StringBuffer_vappend(B, s, ap); va_end(ap); } int main(void) { StringBuffer_T sb; Bootstrap(); // Need to initialize library printf("============> Start StringBuffer Tests\n\n"); printf("=> Test1: create/destroy\n"); { sb = StringBuffer_new(""); assert(sb); assert(StringBuffer_length(sb)==0); StringBuffer_free(&sb); assert(sb==NULL); sb = StringBuffer_create(1024); assert(sb); StringBuffer_free(&sb); assert(sb==NULL); TRY { StringBuffer_create(-1); assert(false); } CATCH(AssertException) { printf("\tok\n"); } END_TRY; } printf("=> Test1: OK\n\n"); printf("=> Test2: Append NULL value\n"); { sb = StringBuffer_new(""); assert(sb); StringBuffer_append(sb, NULL); assert(StringBuffer_length(sb)==0); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test2: OK\n\n"); printf("=> Test3: Create with string\n"); { sb = StringBuffer_new("abc"); assert(sb); assert(StringBuffer_length(sb)==3); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test3: OK\n\n"); printf("=> Test4: Append string value\n"); { sb = StringBuffer_new("abc"); assert(sb); printf("\tTesting StringBuffer_append:.."); StringBuffer_append(sb, "def"); assert(StringBuffer_length(sb)==6); printf("ok\n"); printf("\tTesting StringBuffer_vappend:.."); append(sb, "%c%s", 'g', "hi"); assert(StringBuffer_length(sb)==9); assert(Str_isEqual(StringBuffer_toString(sb), "abcdefghi")); printf("ok\n"); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test4: OK\n\n"); printf("=> Test5: trim\n"); { sb = StringBuffer_new("\t 'foo bar' \n "); assert(Str_isEqual(StringBuffer_toString(StringBuffer_trim(sb)), "'foo bar'")); StringBuffer_clear(sb); StringBuffer_append(sb, "'foo bar'"); StringBuffer_trim(sb); assert(Str_isEqual(StringBuffer_toString(sb), "'foo bar'")); StringBuffer_clear(sb); StringBuffer_append(sb, "\t \r \n "); assert(Str_isEqual(StringBuffer_toString(StringBuffer_trim(sb)), "")); StringBuffer_free(&sb); sb = StringBuffer_create(10); StringBuffer_trim(sb); assert(StringBuffer_toString(sb)[0] == 0); StringBuffer_free(&sb); } printf("=> Test5: OK\n\n"); printf("=> Test6: deleteFrom\n"); { sb = StringBuffer_new("abcdefgh"); assert(sb); TRY { StringBuffer_delete(sb, -1); assert(false); } CATCH(AssertException) { printf("\tok\n"); } END_TRY; TRY { StringBuffer_delete(sb, 9); assert(false); } CATCH(AssertException) { printf("\tok\n"); } END_TRY; StringBuffer_delete(sb,3); assert(StringBuffer_length(sb)==3); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test6: OK\n\n"); printf("=> Test7: indexOf and lastIndexOf\n"); { sb = StringBuffer_new("jan-henrik haukeland"); assert(sb); assert(StringBuffer_indexOf(sb, "henrik")==4); assert(StringBuffer_indexOf(sb, "an")==1); assert(StringBuffer_indexOf(sb, "-")==3); assert(StringBuffer_lastIndexOf(sb, "an")==17); assert(StringBuffer_indexOf(sb, "")==-1); assert(StringBuffer_indexOf(sb, 0)==-1); assert(StringBuffer_indexOf(sb, "d")==19); assert(StringBuffer_indexOf(sb, "j")==0); assert(StringBuffer_lastIndexOf(sb, "d")==19); assert(StringBuffer_lastIndexOf(sb, "j")==0); assert(StringBuffer_lastIndexOf(sb, "x")==-1); assert(StringBuffer_indexOf(sb, "jane")==-1); assert(StringBuffer_indexOf(sb, "jan-henrik haukeland")==0); assert(StringBuffer_indexOf(sb, "haukeland")==11); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test7: OK\n\n"); printf("=> Test8: length and clear\n"); { sb = StringBuffer_new("jan-henrik haukeland"); assert(sb); assert(StringBuffer_length(sb)==20); StringBuffer_clear(sb); assert(StringBuffer_length(sb)==0); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test8: OK\n\n"); printf("=> Test9: toString value\n"); { sb = StringBuffer_new("abc"); assert(sb); StringBuffer_append(sb, "def"); assert(Str_isEqual(StringBuffer_toString(sb), "abcdef")); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test9: OK\n\n"); printf("=> Test10: internal resize\n"); { int i; sb = StringBuffer_new(""); assert(sb); for (i = 0; i<1024; i++) StringBuffer_append(sb, "a"); assert(StringBuffer_length(sb)==1024); assert(StringBuffer_toString(sb)[1023]=='a'); assert(StringBuffer_toString(sb)[1024]==0); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test10: OK\n\n"); printf("=> Test11: substring\n"); { sb = StringBuffer_new("jan-henrik haukeland"); assert(sb); assert(Str_isEqual(StringBuffer_substring(sb, StringBuffer_indexOf(sb, "-")), "-henrik haukeland")); TRY { StringBuffer_substring(sb, -1); assert(false); } CATCH(AssertException) { printf("\tok\n"); } END_TRY; TRY { StringBuffer_substring(sb, 1000); assert(false); } CATCH(AssertException) { printf("\tok\n"); } END_TRY; StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test11: OK\n\n"); printf("=> Test12: replace\n"); { printf("\tNothing to replace\n"); sb = StringBuffer_new("abc?def?"); assert(sb); StringBuffer_replace(sb, "x", "$x"); assert(Str_isEqual(StringBuffer_toString(sb), "abc?def?")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tReplace and expand\n"); sb = StringBuffer_new("abc?def?"); assert(sb); StringBuffer_replace(sb, "?", "$x"); assert(Str_isEqual(StringBuffer_toString(sb), "abc$xdef$x")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tReplace and shrink\n"); sb = StringBuffer_new("abc$xdef$x"); assert(sb); StringBuffer_replace(sb, "$x", "?"); assert(Str_isEqual(StringBuffer_toString(sb), "abc?def?")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tReplace with empty string\n"); sb = StringBuffer_new("abc$xdef$x"); assert(sb); StringBuffer_replace(sb, "$x", ""); assert(Str_isEqual(StringBuffer_toString(sb), "abcdef")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tReplace with same length\n"); sb = StringBuffer_new("foo bar baz foo bar baz"); assert(sb); StringBuffer_replace(sb, "baz", "bar"); assert(Str_isEqual(StringBuffer_toString(sb), "foo bar bar foo bar bar")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tRemove words and test traceback\n"); sb = StringBuffer_new("foo bar baz foo foo bar baz"); assert(sb); StringBuffer_replace(sb, "baz", "bar"); assert(Str_isEqual(StringBuffer_toString(sb), "foo bar bar foo foo bar bar")); StringBuffer_replace(sb, "foo bar ", ""); assert(Str_isEqual(StringBuffer_toString(sb), "bar foo bar")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tReplace all elements\n"); sb = StringBuffer_new("aaaaaaaaaaaaaaaaaaaaaaaa"); assert(sb); StringBuffer_replace(sb, "a", "b"); assert(Str_isEqual(StringBuffer_toString(sb), "bbbbbbbbbbbbbbbbbbbbbbbb")); StringBuffer_free(&sb); assert(sb==NULL); printf("\tReplace and expand with resize of StringBuffer\n"); sb = StringBuffer_new("insert into(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) values (1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,01,2,3);"); assert(sb); StringBuffer_replace(sb, "?", "$x"); assert(Str_isEqual(StringBuffer_toString(sb), "insert into($x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x) values (1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,01,2,3);")); StringBuffer_free(&sb); assert(sb==NULL); } printf("=> Test12: OK\n\n"); #ifdef HAVE_LIBZ printf("=> Test13: compression\n"); { const char *input = "" "" "" "" "" "" "" "" "" "" ""; const unsigned char compressedInput[] = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // Header 0xb3, 0x49, 0x84, 0x03, 0x3b, 0x9b, 0x24, 0x38, 0xb0, 0xb3, 0x49, 0x86, 0x03, 0x3b, 0x1b, 0x7d, 0x64, 0xce, 0xe0, 0x94, 0xd0, 0x47, 0x76, 0xbb, 0x3e, 0x92, 0xa7, 0x00, // Compressed blocks 0xdd, 0x84, 0x33, 0xe7, // CRC 0xe1, 0x00, 0x00, 0x00 // Input size }; sb = StringBuffer_new(input); assert(StringBuffer_length(sb) == 225); size_t compressedLength; const unsigned char *compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed); assert(compressedLength == 46); for (size_t i = 0; i < compressedLength; i++) { // Skip header OS type as it is platform dependent (see 2.3.1 in https://www.ietf.org/rfc/rfc1952.txt) if (i != 9) { assert(compressedInput[i] == *(compressed + i)); } } StringBuffer_free(&sb); assert(sb == NULL); } printf("=> Test13: OK\n\n"); printf("=> Test14: empty string compression\n"); { const char *input = ""; sb = StringBuffer_new(input); assert(StringBuffer_length(sb) == 0); size_t compressedLength; const unsigned char *compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed == NULL); assert(compressedLength == 0); StringBuffer_free(&sb); assert(sb == NULL); } printf("=> Test14: OK\n\n"); printf("=> Test15: StringBuffer set-compress -> clear-compress -> append-compress\n"); { printf("\tStage 1: set content + compress\n"); const char *input1 = "" "" "" "" "" "" "" "" "" "" ""; const unsigned char output1[] = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // Header 0xb3, 0x49, 0x84, 0x03, 0x3b, 0x9b, 0x24, 0x38, 0xb0, 0xb3, 0x49, 0x86, 0x03, 0x3b, 0x1b, 0x7d, 0x64, 0xce, 0xe0, 0x94, 0xd0, 0x47, 0x76, 0xbb, 0x3e, 0x92, 0xa7, 0x00, // Compressed blocks 0xdd, 0x84, 0x33, 0xe7, // CRC 0xe1, 0x00, 0x00, 0x00 // Input size }; sb = StringBuffer_new(input1); assert(StringBuffer_length(sb) == 225); size_t compressedLength; const unsigned char *compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed); assert(compressedLength == 46); for (size_t i = 0; i < compressedLength; i++) { // Skip header OS type as it is platform dependent (see 2.3.1 in https://www.ietf.org/rfc/rfc1952.txt) if (i != 9) { assert(output1[i] == *(compressed + i)); } } ////////////////////////////////////////////////////////////////////////////// printf("\tStage 2: clear content + compress\n"); const char *input2 = "" "" "" "" ""; const unsigned char output2[] = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // Header 0xb3, 0x49, 0x81, 0x03, 0x3b, 0x9b, 0x54, 0x38, 0xb0, 0xb3, 0x49, 0x83, 0x03, 0x3b, 0x1b, 0x7d, 0x14, 0x0e, 0xb2, 0x2a, 0x7d, 0x24, 0xed, 0x00, // Compressed blocks 0xa9, 0x23, 0x54, 0xf5, // CRC 0x4b, 0x00, 0x00, 0x00 // Input size }; StringBuffer_clear(sb); StringBuffer_append(sb, "%s", input2); assert(StringBuffer_length(sb) == 75); compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed); assert(compressedLength == 42); for (size_t i = 0; i < compressedLength; i++) { // Skip header OS type as it is platform dependent (see 2.3.1 in https://www.ietf.org/rfc/rfc1952.txt) if (i != 9) { assert(output2[i] == *(compressed + i)); } } ////////////////////////////////////////////////////////////////////////////// printf("\tStage 3: append content + compress\n"); const char *input3 = ""; const unsigned char output3[] = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // Header 0xb3, 0x49, 0x81, 0x03, 0x3b, 0x9b, 0x54, 0x38, 0xb0, 0xb3, 0x49, 0x83, 0x03, 0x3b, 0x1b, 0x7d, 0x14, 0x0e, 0xb2, 0x2a, 0x7d, 0x64, 0xed, 0xe9, 0x70, 0x00, 0x94, 0x40, 0xe2, 0x00, 0x00, // Compressed blocks 0x4c, 0x64, 0x9a, 0x52, // CRC 0x64, 0x00, 0x00, 0x00 // Input size }; StringBuffer_append(sb, "%s", input3); assert(StringBuffer_length(sb) == 100); // length of input2 + input3 compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed); assert(compressedLength == 49); for (size_t i = 0; i < compressedLength; i++) { // Skip header OS type as it is platform dependent (see 2.3.1 in https://www.ietf.org/rfc/rfc1952.txt) if (i != 9) { assert(output3[i] == *(compressed + i)); } } ////////////////////////////////////////////////////////////////////////////// StringBuffer_free(&sb); assert(sb == NULL); } printf("=> Test15: OK\n\n"); #endif printf("============> StringBuffer Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/SystemTest.c0000644000016400001720000000404315007061157014737 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/System.h" #include "system/Time.h" #include "Thread.h" /** * System.c unity tests. */ static void _handler(const char *s, va_list ap) { assert(s); char buf[STRLEN]; va_list ap_copy; va_copy(ap_copy, ap); vsnprintf(buf, sizeof(buf), s, ap); va_end(ap_copy); printf("handler: %s", buf); assert(Str_isEqual(buf, "\tyellow submarine (5)(6)\n")); } int main(void) { Bootstrap(); // Need to initialize library printf("============> Start System Tests\n\n"); printf("=> Test0: check error description\n"); { const char *error = System_getError(EINVAL); assert(error != NULL); printf("\tEINVAL description: %s\n", error); errno = EINVAL; assert(Str_isEqual(System_lastError(), error)); } printf("=> Test0: OK\n\n"); printf("=> Test1: \n"); { assert(System_descriptors(65) == 65); assert(System_descriptors(0) > 65); printf("\tMaximum file descriptors for process: %d\n", System_descriptors(0)); } printf("=> Test1: OK\n\n"); printf("=> Test2: check System_error\n"); { System_error("\thello %s (%d)(%ld)\n", "world", 1, 2L); Bootstrap_setErrorHandler(_handler); System_error("\tyellow %s (%d)(%ld)\n", "submarine", 5, 6L); } printf("=> Test2: OK\n\n"); printf("=> Test3: check System_error\n"); { Bootstrap_setAbortHandler(_handler); System_abort("\tyellow %s (%d)(%ld)\n", "submarine", 5, 6L); } printf("=> Test3: OK\n\n"); printf("============> System Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/NetTest.c0000644000016400001720000000106615007061157014203 00000000000000#include "Config.h" #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/Time.h" #include "Thread.h" #include "system/Net.h" #include "File.h" /** * Net.c unity tests. */ int main(__attribute__ ((unused)) int argc, __attribute__ ((unused)) char **argv) { Bootstrap(); // Need to initialize library printf("============> Start Net Tests\n\n"); printf("============> Net Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/ExceptionTest.c0000644000016400001720000003270615007061157015420 00000000000000#include "Config.h" #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "Thread.h" #include "Exception.h" #include "AssertException.h" /** * Exception unity tests */ #define THREADS 200 Exception_T A = {"AException"}; Exception_T B = {"BException"}; Exception_T C = {"CException"}; Exception_T D = {"DException"}; static void throwA(void) { THROW(A, NULL); } static void throwB(void) { THROW(B, NULL); } static void throwC(void) { THROW(C, "A cause"); } static void throwD(void) { THROW(D, "A cause"); } static void indirectA(void) { throwA(); } /* Throw and catch exceptions and check that we got the expected exception. * If the exception stack is corrupt somehow this should be detected */ static void *thread(__attribute__ ((unused)) void *args) { TRY THROW(A, "A cause"); assert(false); // Should not be reached CATCH(A) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(B, "A cause"); assert(false); // Should not be reached CATCH(B) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(D, NULL); assert(false); // Should not be reached CATCH(D) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(C, NULL); assert(false); // Should not be reached CATCH(C) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(A, NULL); assert(false); // Should not be reached CATCH(A) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY throwA(); throwB(); throwC(); throwD(); CATCH(A) // Ok CATCH(B) assert(false); // Should not be reached CATCH(C) assert(false); // Should not be reached CATCH(D) assert(false); // Should not be reached END_TRY; TRY indirectA(); CATCH(A) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(B, NULL); assert(false); // Should not be reached CATCH(B) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(B, NULL); assert(false); // Should not be reached CATCH(B) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(B, NULL); assert(false); // Should not be reached CATCH(B) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(B, "A cause %s", "and another cause"); assert(false); // Should not be reached CATCH(B) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(A, NULL); assert(false); // Should not be reached CATCH(A) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(B, NULL); assert(false); // Should not be reached CATCH(B) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY THROW(D, NULL); assert(false); // Should not be reached CATCH(D) // Ok ELSE assert(false); // Should not be reached END_TRY; TRY RETURN (NULL); assert(false); // Should not be reached CATCH(A) assert(false); // Should not be reached END_TRY; return NULL; } int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Exception Tests\n\n"); printf("=> Test1: TRY-CATCH\n"); { TRY THROW(A, "A cause"); assert(false); // Should not be reached CATCH(A) printf("\tResult: Ok\n"); END_TRY; } printf("=> Test1: OK\n\n"); printf("=> Test2: TRY-CATCH indirect throw\n"); { TRY indirectA(); assert(false); // Should not be reached CATCH(A) printf("\tResult: Ok\n"); END_TRY; } printf("=> Test2: OK\n\n"); printf("=> Test3: TRY-ELSE\n"); { TRY THROW(B, NULL); assert(false); // Should not be reached ELSE printf("\tResult: Ok\n"); END_TRY; } printf("=> Test3: OK\n\n"); printf("=> Test4: TRY-CATCH-ELSE\n"); { TRY throwB(); assert(false); // Should not be reached CATCH(A) assert(false); // Should not be reached ELSE printf("\tResult: Ok\n"); END_TRY; } printf("=> Test4: OK\n\n"); printf("=> Test5: TRY-FINALLY\n"); { volatile int i = 0; TRY i++; FINALLY printf("\tResult: ok\n"); assert(i==1); END_TRY; } printf("=> Test5: OK\n\n"); printf("=> Test6: TRY-CATCH-FINALLY\n"); { volatile int i = 0; TRY i++; THROW(C, "A cause"); CATCH(C) i++; FINALLY printf("\tResult: ok\n"); assert(i == 2); END_TRY; } printf("=> Test6: OK\n\n"); printf("=> Test7: CATCH NumberFormatException\n"); { TRY Str_parseInt("not a number"); assert(false); // Should not be reached CATCH(NumberFormatException) printf("\tResult: ok got NumberFormatException\n"); END_TRY; } printf("=> Test7: OK\n\n"); printf("=> Test8: CATCH AssertException\n"); { TRY assert(false); // Throws AssertException printf("Test8 failed\n"); exit(1); CATCH(AssertException) printf("\tResult: ok got AssertException\n"); END_TRY; } printf("=> Test8: OK\n\n"); printf("=> Test9: Nested TRY-CATCH\n"); { TRY TRY THROW(B, "A cause"); THROW(A, "Another cause"); assert(false); // Should not be reached CATCH(A) assert(false); // Should not be reached END_TRY; CATCH(B) printf("\tResult: ok\n"); END_TRY; } printf("=> Test9: OK\n\n"); printf("=> Test10: RETHROW\n"); { TRY TRY THROW(A, "A cause %s", "and a cause"); assert(false); // Should not be reached CATCH(A) RETHROW; END_TRY; CATCH(A) printf("\tResult: ok got Exception\n"); END_TRY; } printf("=> Test10: OK\n\n"); printf("=> Test11: No exception thrown\n"); { TRY __attribute__ ((unused)) int i = 0; i++; ELSE assert(false); // Should not be reached END_TRY; } printf("=> Test11: OK\n\n"); printf("=> Test12: Exception message append\n"); { TRY TRY THROW(AssertException, "Original reason"); exit(0); // Should not be reached CATCH(AssertException) THROW(AssertException, "%s - Appended reason", Exception_frame.message); END_TRY; CATCH(AssertException) printf("\tResult: Got '%s' with reason: %s\n", AssertException.name, Exception_frame.message); assert(Str_startsWith(Exception_frame.message, "Original")); END_TRY; } printf("=> Test12: OK\n\n"); printf("=> Test13: FINALLY rethrows exception\n"); { TRY { TRY { THROW(AssertException, "A reason"); exit(0); // Should not be reached } FINALLY END_TRY; exit(0); // Should not be reached } CATCH(AssertException) { printf("\tResult: Got '%s' thrown from FINALLY\n", AssertException.name); } END_TRY; } printf("=> Test13: OK\n\n"); printf("=> Test14: Test thread-safeness\n"); { int i; Thread_T threads[THREADS]; for (i = 0; i < THREADS; i++) { Thread_create(threads[i], thread, NULL); } for (i = 0; i Test14: OK\n\n"); printf("=> Test15: 2nd level FINALLY rethrows exception from nested 1st level TRY with '%%n' characters in vararg string argument\n"); { TRY { TRY { TRY { // Trigger exception printf("\t1st level TRY: throw exception with string argument 'hello%%nelly'\n"); THROW(AssertException, "1st level TRY: %s", "hello%nelly"); } END_TRY; } FINALLY { printf("\t2nd level TRY: FINALLY will rethrow the 1st level exception '%s'\n", Exception_frame.message); // The FINALLY will RETHROW the exception, which leads to Exception_throw() } END_TRY; } ELSE { // Catch the exception printf("\t3nd level TRY: catch the 1st level exception '%s'\n", Exception_frame.message); assert(Str_isEqual(Exception_frame.message, "1st level TRY: hello%nelly")); } END_TRY; } printf("=> Test15: OK\n\n"); printf("=> Test16: 2nd level FINALLY rethrows exception from nested 1st level TRY with '%%s' characters in vararg string argument\n"); { TRY { TRY { TRY { // Trigger exception printf("\t1st level TRY: throw exception with string argument 'hello%%sally'\n"); THROW(AssertException, "1st level TRY: %s", "hello%sally"); } END_TRY; } FINALLY { printf("\t2nd level TRY: FINALLY will rethrow the 1st level exception '%s'\n", Exception_frame.message); // The FINALLY will RETHROW the exception, which leads to Exception_throw() } END_TRY; } ELSE { // Catch the exception printf("\t3nd level TRY: catch the 1st level exception '%s'\n", Exception_frame.message); assert(Str_isEqual(Exception_frame.message, "1st level TRY: hello%sally")); } END_TRY; } printf("=> Test16: OK\n\n"); printf("============> Exception Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/DirTest.c0000644000016400001720000000446315007061157014177 00000000000000#include "Config.h" #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/Time.h" #include "File.h" #include "Dir.h" /** * Dir.c unity tests. */ int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Dir Tests\n\n"); printf("=> Test1: mkdir\n"); { File_setUmask(022); assert(Dir_mkdir("X", 0)); printf("\tResult: Dir X created with default perm = %#o\n", File_mod("X")); assert(File_mod("X") & 755); assert(Dir_mkdir("Y", 0700)); printf("\tResult: Dir Y created with perm = %#o\n", File_mod("Y")); assert(File_mod("Y") & 700); assert(Dir_mkdir("", 0700) == false); assert(Dir_mkdir(NULL, 0700) == false); } printf("=> Test1: OK\n\n"); printf("=> Test2: chdir\n"); { printf("\tResult: Changing working dir to X\n"); assert(Dir_chdir("X")); printf("\tResult: Changing working dir to Y\n"); assert(Dir_chdir("../Y")); assert(Dir_chdir(NULL) == false); } printf("=> Test2: OK\n\n"); printf("=> Test3: getwd\n"); { char cwd[STRLEN]; assert(Dir_cwd(cwd, STRLEN)); printf("\tResult: Current working dir is: %s\n", cwd); assert(Str_endsWith(cwd, "Y")); assert(Dir_chdir("..")); assert(Dir_cwd(cwd, STRLEN)); printf("\tResult: Current working dir is: %s\n", cwd); assert(Dir_cwd(NULL, 0) == false); } printf("=> Test3: OK\n\n"); printf("=> Test4: delete\n"); { printf("\tResult: deleting dir X.. "); assert(Dir_delete("X")); printf("ok\n"); printf("\tResult: deleting dir Y.. "); assert(Dir_delete("Y")); printf("ok\n"); assert(Dir_delete(NULL) == false); printf("ok\n"); } printf("=> Test4: OK\n\n"); printf("============> Dir Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/ArrayTest.c0000644000016400001720000001002315007061157014524 00000000000000#include "Config.h" #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "Array.h" /** * Array.c unit tests. */ typedef struct value_t { int key; char value[STRLEN]; } *value_t; static void _apply(int key, void **value, void *ap) { *(int *)ap += 1; value_t v = *value; assert(key == v->key); assert(Str_parseInt(v->value) == key); } static bool _predicate(void *value, void *needle) { value_t v = value; int term = *(int*)needle; return v->key == term; } static void _release(__attribute__ ((unused))int key, void **value, void *ap) { *(int *)ap -= 1; FREE(*value); } int main(void) { Array_T T = NULL; Bootstrap(); // Need to initialize library printf("============> Start Array Tests\n\n"); printf("=> Test0: create\n"); { T = Array_new(1024); assert(T); assert(Array_length(T) == 0); } printf("=> Test0: OK\n\n"); printf("=> Test1: Array_put() & Array_length()\n"); { for (int i = 0; i < 20; i++) { value_t v = ALLOC(sizeof *(v)); v->key = i; snprintf(v->value, STRLEN, "%d", i); assert(Array_put(T, i, v) == NULL); // Check that the entry was not present already assert(Array_put(T, i, v) != NULL); // Try to put duplicate } assert(Array_length(T) == 20); } printf("=> Test1: OK\n\n"); printf("=> Test2: Array_get()\n"); { assert(Array_get(T, 20) == NULL); assert(Array_get(T, 10)); } printf("=> Test2: OK\n\n"); printf("=> Test3: Array_remove()\n"); { value_t save; assert((save = Array_remove(T, 10)) != 0); assert(save->key == 10); assert(Array_get(T, 10) == NULL); assert(Array_length(T) == 19); // Put it back for reuse below Array_put(T, 10, save); assert(Array_get(T, 10)); assert(Array_length(T) == 20); } printf("=> Test3: OK\n\n"); printf("=> Test4: Array_map()\n"); { int i = 0; Array_map(T, _apply, &i); assert(i == 20); } printf("=> Test4: OK\n\n"); printf("=> Test5: Array_find()\n"); { int needle = 12; value_t v = Array_find(T, _predicate, &needle); assert(v); assert(v->key == needle); needle = 123; v = Array_find(T, _predicate, &needle); assert(v == NULL); } printf("=> Test5: OK\n\n"); printf("=> Test6: Array_free\n"); { int i = Array_length(T); assert(i == 20); Array_map(T, _release, &i); assert(i == 0); assert(Array_length(T) == 20); Array_free(&T); assert(T == NULL); } printf("=> Test6: OK\n\n"); printf("=> Test7: sparseness()\n"); { T = Array_new(4); int numbers[] = {0, 509, 1021, 2053, 4093, 8191, 16381, 32771, 65521, -INT_MAX, INT_MAX}; int numbers_length = (int)(sizeof(numbers)/sizeof(numbers[0])); for (int i = 0; i < numbers_length; i++) assert(Array_put(T, numbers[i], &numbers[i]) == NULL); assert(Array_length(T) == numbers_length); for (int i = 0; i < numbers_length; i++) { int *n = Array_get(T, numbers[i]); assert(*n == numbers[i]); } Array_free(&T); } printf("=> Test7: OK\n\n"); printf("============> Array Tests: OK\n\n"); } monit-5.35.2/libmonit/test/data/0000755000016400001720000000000015007061157013437 500000000000000monit-5.35.2/libmonit/test/data/stream.data0000644000016400001720000000002215007061157015477 00000000000000line1 line2 line3 monit-5.35.2/libmonit/test/InputStreamTest.c0000644000016400001720000001277715007061157015743 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include "Bootstrap.h" #include "InputStream.h" #include "File.h" #include "Str.h" #include "system/System.h" /** * InputStream.c unit tests. */ #define DATA "./data/stream.data" #define TIMEOUT 50 int main(void) { int fd; InputStream_T in = NULL; Bootstrap(); // Need to initialize library printf("============> Start InputStream Tests\n\n"); printf("=> Test0: create/destroy the stream\n"); { in = InputStream_new(File_open(DATA, "r")); assert(!InputStream_isClosed(in)); File_close(InputStream_getDescriptor(in)); InputStream_free(&in); assert(in == NULL); } printf("=> Test0: OK\n\n"); printf("=> Test1: get/set timeout\n"); { assert((fd = File_open(DATA, "r")) >= 0); in = InputStream_new(fd); printf("\tCurrent timeout: %lldms\n", (long long)InputStream_getTimeout(in)); InputStream_setTimeout(in, TIMEOUT); assert(InputStream_getTimeout(in) == TIMEOUT); printf("\tTimeout set to: %dms\n", TIMEOUT); File_close(fd); InputStream_free(&in); } printf("=> Test1: OK\n\n"); printf("=> Test2: read file by characters\n"); { int byte; int byteno = 0; char content[][1] = {"l", "i", "n", "e", "1", "\n", "l", "i", "n", "e", "2", "\n", "l", "i", "n", "e", "3", "\n"}; assert((fd = File_open(DATA, "r")) >= 0); in = InputStream_new(fd); while ((byte = InputStream_read(in)) > 0) { assert(byte == *content[byteno++]); } File_close(fd); InputStream_free(&in); } printf("=> Test2: OK\n\n"); printf("=> Test3: read file by lines\n"); { int lineno = 0; char line[STRLEN]; char content[][STRLEN] = {"line1\n", "line2\n", "line3\n"}; assert((fd = File_open(DATA, "r")) >= 0); in = InputStream_new(fd); assert(InputStream_buffered(in) == 0); InputStream_clear(in); while (InputStream_readLine(in, line, sizeof(line))) { assert(Str_isEqual(content[lineno++], line)); } File_close(fd); InputStream_free(&in); } printf("=> Test3: OK\n\n"); printf("=> Test4: read file by bytes\n"); { char array[STRLEN]; char content[] = "line1\nline2\nline3\n"; memset(array, 0, STRLEN); assert((fd = File_open(DATA, "r")) >= 0); in = InputStream_new(fd); while (InputStream_readBytes(in, array, sizeof(array)-1)) { assert(Str_isEqual(content, array)); } File_close(fd); InputStream_free(&in); } printf("=> Test4: OK\n\n"); printf("=> Test5: read a large file\n"); { if ((fd = File_open("/usr/share/dict/words", "r")) >= 0) { char array[2][STRLEN + 1] = {}; in = InputStream_new(fd); for (int i = 0; InputStream_readBytes(in, array[i], STRLEN) > 0; i = i ? 0 : 1) assert(strncmp(array[0], array[1], STRLEN/2) != 0); // ensure that InputStream buffer is filled anew File_rewind(fd); // Test read data larger than InputStream's internal buffer int filesize = (int)File_size("/usr/share/dict/words"); char *bigarray = CALLOC(1, filesize + 1); int n = InputStream_readBytes(in, bigarray, filesize); assert(n == filesize); File_close(fd); InputStream_free(&in); FREE(bigarray); } else ERROR("\t/usr/share/dict/words not available -- skipping test\n"); } printf("=> Test5: OK\n\n"); printf("=> Test6: wrong descriptor - expecting read fail\n"); { in = InputStream_new(999); TRY assert(InputStream_read(in) != -1); printf("Test6: Failed"); exit(1); // Should not come here CATCH(AssertException) // Passed END_TRY; InputStream_free(&in); } printf("=> Test6: OK\n\n"); printf("=> Test7: closed stream\n"); { in = InputStream_new(File_open(DATA, "r")); assert(!InputStream_isClosed(in)); File_close(InputStream_getDescriptor(in)); assert(InputStream_read(in) == -1); // 1st assert(InputStream_read(in) == -1); // 2nd assert(InputStream_isClosed(in)); InputStream_free(&in); assert(in == NULL); } printf("=> Test7: OK\n\n"); printf("============> InputStream Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/RandomTest.c0000644000016400001720000000325615007061157014700 00000000000000#include "Config.h" #include #include #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/Random.h" #include "system/Time.h" /** * Ranom.c unity tests. */ int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Random Tests\n\n"); printf("=> Test0: Random data generator\n"); { // printf("\tnumber: %llu\n", Random_number()); // printf("\t1 byte: "); char buf0[1]; assert(Random_bytes(buf0, sizeof(buf0))); for (size_t i = 0; i < sizeof(buf0); i++) { printf("%x", buf0[i]); } printf("\n"); // printf("\t4 bytes: "); char buf1[4]; assert(Random_bytes(buf1, sizeof(buf1))); for (size_t i = 0; i < sizeof(buf1); i++) { printf("%x", buf1[i]); } printf("\n"); // printf("\t16 bytes: "); char buf2[16]; assert(Random_bytes(buf2, sizeof(buf2))); for (size_t i = 0; i < sizeof(buf2); i++) { printf("%x", buf2[i]); } printf("\n"); // assert(Random_number() != Random_number()); } printf("=> Test0: OK\n\n"); printf("============> Random Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/FmtTest.c0000644000016400001720000000500615007061157014201 00000000000000#include "Config.h" #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "Fmt.h" /** * Fmt.c unity tests */ int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Fmt Tests\n\n"); printf("=> Test1: Fmt_bytes2str\n"); { char str[10]; Fmt_bytes2str(0, str); assert(Str_isEqual(str, "0 B")); Fmt_bytes2str(2048, str); assert(Str_isEqual(str, "2 KB")); Fmt_bytes2str(2097152, str); assert(Str_isEqual(str, "2 MB")); Fmt_bytes2str(2621440, str); assert(Str_isEqual(str, "2.5 MB")); Fmt_bytes2str(9083741824, str); assert(Str_isEqual(str, "8.5 GB")); Fmt_bytes2str((double)9083741824987653, str); assert(Str_isEqual(str, "8.1 PB")); Fmt_bytes2str((double)LLONG_MAX, str); assert(Str_isEqual(str, "8 EB")); Fmt_bytes2str(-9083741824, str); assert(Str_isEqual(str, "-8.5 GB")); } printf("=> Test1: OK\n\n"); printf("=> Test2: Fmt_time2str\n"); { char str[13]; Fmt_time2str(0, str); assert(Str_isEqual(str, "0 ms")); Fmt_time2str(0.5, str); assert(Str_isEqual(str, "0.500 ms")); Fmt_time2str(1, str); assert(Str_isEqual(str, "1 ms")); Fmt_time2str(999.999, str); assert(Str_isEqual(str, "999.999 ms")); Fmt_time2str(2000, str); assert(Str_isEqual(str, "2 s")); Fmt_time2str(2123, str); assert(Str_isEqual(str, "2.123 s")); Fmt_time2str(60000, str); assert(Str_isEqual(str, "1 m")); Fmt_time2str(90000, str); assert(Str_isEqual(str, "1.500 m")); Fmt_time2str(3600000, str); assert(Str_isEqual(str, "1 h")); Fmt_time2str(1258454321, str); assert(Str_isEqual(str, "14.565 d")); Fmt_time2str(3e+12, str); assert(Str_isEqual(str, "95.129 y")); Fmt_time2str(-2000, str); assert(Str_isEqual(str, "-2 s")); } printf("=> Test2: OK\n\n"); printf("============> Fmt Tests: OK\n\n"); return 0; } monit-5.35.2/libmonit/test/test.sh0000755000016400001720000000042415007061157013764 00000000000000#!/bin/sh PATH="$PATH:." export PATH StrTest && \ FmtTest && \ TimeTest && \ SystemTest && \ RandomTest && \ ArrayTest && \ ListTest && \ StringBufferTest && \ DirTest && \ InputStreamTest && \ OutputStreamTest && \ FileTest && \ ExceptionTest && \ NetTest && \ CommandTest monit-5.35.2/libmonit/test/StrTest.c0000644000016400001720000005262615007061157014235 00000000000000#include "Config.h" #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" /** * Str.c unity tests */ int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Str Tests\n\n"); printf("=> Test1: copy\n"); { char s3[STRLEN]; printf("\tResult: %s\n", Str_copy(s3, "The abc house", 7)); assert(Str_isEqual(s3, "The abc")); printf("\tTesting for NULL argument\n"); assert(!Str_copy(NULL, NULL, 7)); assert(Str_isEqual(Str_copy(s3, NULL, sizeof(s3)), "")); } printf("=> Test1: OK\n\n"); printf("=> Test2: dup\n"); { char *s4 = Str_dup("abc123"); printf("\tResult: %s\n", s4); assert(Str_isEqual(s4, "abc123")); printf("\tTesting for NULL argument\n"); assert(!Str_dup(NULL)); FREE(s4); } printf("=> Test2: OK\n\n"); printf("=> Test3: ndup\n"); { char *s5 = Str_ndup("abc123", 3); printf("\tResult: %s\n", s5); assert(Str_isEqual(s5, "abc")); printf("\tTesting for NULL argument\n"); assert(!Str_ndup(NULL, 3)); FREE(s5); } printf("=> Test3: OK\n\n"); printf("=> Test4: Str_cat & Str_vcat\n"); { char *s6; s6 = Str_cat("%s://%s%s?%s", "https", "foo.bar", "/uri", "abc=123"); printf("\tResult: %s\n", s6); assert(Str_isEqual(s6, "https://foo.bar/uri?abc=123")); FREE(s6); printf("\tTesting for NULL arguments\n"); s6 = Str_cat(NULL); assert(s6==NULL); FREE(s6); } printf("=> Test4: OK\n\n"); printf("=> Test5: chomp\n"); { char s3[] = "abc\r\n123"; printf("\tResult: %s\n", Str_chomp(s3)); assert(Str_isEqual(s3, "abc")); printf("\tTesting for NULL argument\n"); assert(!Str_chomp(NULL)); } printf("=> Test5: OK\n\n"); printf("=> Test6: trim\n"); { char el[] = " "; char er[] = " "; char elr[] = " "; char ol[] = " a "; char or[] = " a "; char olr[] = " a "; char s[] = " abcdef"; char s4[] = " \t abc \r\n\t "; assert(Str_isEqual(Str_ltrim(s), "abcdef")); printf("\tResult: %s\n", Str_trim(s4)); assert(Str_isEqual(s4, "abc")); printf("\tTesting for NULL argument\n"); assert(!Str_trim(NULL)); assert(Str_isEqual(Str_ltrim(el), "")); assert(Str_isEqual(Str_rtrim(er), "")); assert(Str_isEqual(Str_trim(elr), "")); assert(Str_isEqual(Str_ltrim(ol), "a ")); assert(Str_isEqual(Str_rtrim(or), " a")); assert(Str_isEqual(Str_trim(olr), "a")); assert(Str_isEqual(Str_trim(olr), "a")); } printf("=> Test6: OK\n\n"); printf("=> Test7: trim quotes\n"); { char s5[] = "\"'abc'\""; char s5a[] = "\"'abc"; char s5b[] = "abc'\""; char s5c[] = "'\""; char s5d[] = " \t abc def '\" "; printf("\tResult: %s\n", Str_unquote(s5)); assert(Str_isEqual(s5, "abc")); printf("\tResult: %s\n", Str_unquote(s5a)); assert(Str_isEqual(s5, "abc")); printf("\tResult: %s\n", Str_unquote(s5b)); assert(Str_isEqual(s5, "abc")); printf("\tResult: %s\n", Str_unquote(s5b)); assert(Str_isEqual(s5, "abc")); printf("\tTesting for NULL argument\n"); assert(!Str_unquote(NULL)); printf("\tTesting for quotes-only argument\n"); assert(Str_isEqual("", Str_unquote(s5c))); printf("\tTesting for quotes and white-space removal\n"); assert(Str_isEqual("abc def", Str_unquote(s5d))); } printf("=> Test7: OK\n\n"); printf("=> Test8: toLowerCase\n"); { char s6[] = "AbC"; printf("\tResult: %s\n", Str_toLower(s6)); assert(Str_isEqual(s6, "abc")); printf("\tTesting for NULL argument\n"); assert(!Str_toLower(NULL)); } printf("=> Test8: OK\n\n"); printf("=> Test9: toUpperCase\n"); { char s7[] = "aBc"; printf("\tResult: %s\n", Str_toUpper(s7)); assert(Str_isEqual(s7, "ABC")); printf("\tTesting for NULL argument\n"); assert(!Str_toUpper(NULL)); } printf("=> Test9: OK\n\n"); printf("=> Test10: parseInt, parseLLong, parseDouble\n"); { char i[STRLEN] = " -2812 bla"; char ll[STRLEN] = " 2147483642 blabla"; char d[STRLEN] = " 2.718281828 this is e"; char de[STRLEN] = "1.495E+08 kilometer = An Astronomical Unit"; char ie[STRLEN] = " 9999999999999999999999999999999999999999"; char ie2[] = " 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"; printf("\tResult:\n"); printf("\tParsed int = %d\n", Str_parseInt(i)); assert(Str_parseInt(i)==-2812); TRY { assert(Str_parseInt(NULL) == 0); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; TRY { assert(Str_parseInt("") == 0); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; TRY { Str_parseInt(ie); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; printf("\tParsed long long = %lld\n", Str_parseLLong(ll)); assert(Str_parseLLong(ll)==2147483642); TRY { assert(Str_parseLLong(NULL) == 0); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; TRY { assert(Str_parseLLong("") == 0); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; TRY { Str_parseLLong(ie2); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; printf("\tParsed double = %.9f\n", Str_parseDouble(d)); assert(Str_parseDouble(d)==2.718281828); printf("\tParsed double exp = %.3e\n", Str_parseDouble(de)); assert(Str_parseDouble(de)==1.495e+08); TRY { assert(Str_parseDouble(NULL) == 0); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; TRY { assert(Str_parseDouble("") == 0); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; TRY { printf("%lf\n", Str_parseDouble(ie2)); assert(false); } CATCH(NumberFormatException) { printf("\tok\n"); } END_TRY; } printf("=> Test10: OK\n\n"); printf("=> Test11: replace\n"); { char s9[] = "abccba"; printf("\tResult: %s\n", Str_replaceChar(s9, 'b', 'X')); assert(Str_isEqual(s9, "aXccXa")); printf("\tTesting for NULL argument\n"); assert(!Str_replaceChar(NULL, 'b', 'X')); } printf("=> Test11: OK\n\n"); printf("=> Test12: startsWith\n"); { char *a = "mysql://localhost:3306/zild?user=root&password=swordfish"; printf("\tResult: starts with mysql - %s\n", Str_startsWith(a, "mysql") ? "yes" : "no"); assert(Str_startsWith(a, "mysql")); assert(!Str_startsWith(a, "sqlite")); assert(Str_startsWith("sqlite", "sqlite")); printf("\tTesting for NULL and NUL argument\n"); assert(!Str_startsWith(a, NULL)); assert(!Str_startsWith(a, "")); assert(!Str_startsWith(NULL, "mysql")); assert(!Str_startsWith("", NULL)); assert(!Str_startsWith(NULL, NULL)); assert(Str_startsWith("", "")); assert(!Str_startsWith("/", "/WEB-INF")); } printf("=> Test12: OK\n\n"); printf("=> Test13: endsWith\n"); { char *a = "mysql://localhost:3306"; printf("\tResult: ends with 3306 - %s\n", Str_endsWith(a, "3306") ? "yes" : "no"); assert(Str_endsWith(a, "3306")); assert(!Str_endsWith(a, "sqlite")); assert(Str_endsWith("sqlite", "sqlite")); printf("\tTesting for NULL and NUL argument\n"); assert(!Str_endsWith(a, NULL)); assert(Str_endsWith(a, "")); // a ends with 0 assert(!Str_endsWith(NULL, "mysql")); assert(!Str_endsWith("", NULL)); assert(!Str_endsWith(NULL, NULL)); assert(Str_endsWith("", "")); assert(!Str_endsWith("abc", "defabc")); } printf("=> Test13: OK\n\n"); printf("=> Test14: isEqual\n"); { char *a = "mysql://localhost:3306"; printf("\tResult: is equal - %s\n", Str_isEqual(a, "mysql://localhost:3306") ? "yes" : "no"); assert(Str_isEqual("sqlite", "sqlite")); printf("\tTesting for NULL and NUL argument\n"); assert(!Str_isEqual(a, NULL)); assert(!Str_isEqual(a, "")); assert(!Str_isEqual(NULL, "mysql")); assert(!Str_isEqual("", NULL)); assert(!Str_isEqual(NULL, NULL)); assert(Str_isEqual("", "")); } printf("=> Test14: OK\n\n"); printf("=> Test15: trail\n"); { char s[] = "This string will be trailed someplace"; assert(Str_trunc(NULL, 100) == NULL); assert(Str_isEqual(Str_trunc("", 0), "")); assert(Str_isEqual(Str_trunc(s, (int)strlen(s)), "This string will be trailed someplace")); printf("\tResult: %s\n", Str_trunc(s, 30)); assert(Str_isEqual(s, "This string will be trailed...")); printf("\tResult: %s\n", Str_trunc(s, 3)); assert(Str_isEqual(s, "...")); printf("\tResult: %s\n", Str_trunc(s, 0)); assert(Str_isEqual(s, "")); } printf("=> Test15: OK\n\n"); printf("=> Test16: hash\n"); { char *x = "a"; char *y = "b"; char *a = "abc"; char *b = "bca"; char *c = "this is a long string"; char *d = "this is a longer string"; printf("\tResult: %s -> %d\n", x, Str_hash(x)); printf("\tResult: %s -> %d\n", y, Str_hash(y)); assert(Str_hash(x) != Str_hash(y)); assert(Str_hash(x) == Str_hash(x)); assert(Str_hash(y) == Str_hash(y)); printf("\tResult: %s -> %d\n", a, Str_hash(a)); printf("\tResult: %s -> %d\n", b, Str_hash(b)); assert(Str_hash(a) != Str_hash(b)); assert(Str_hash(a) == Str_hash(a)); assert(Str_hash(b) == Str_hash(b)); printf("\tResult: %s -> %d\n", c, Str_hash(c)); printf("\tResult: %s -> %d\n", d, Str_hash(d)); assert(Str_hash(c) != Str_hash(d)); assert(Str_hash(c) == Str_hash(c)); assert(Str_hash(d) == Str_hash(d)); } printf("=> Test16: OK\n\n"); printf("=> Test17: regular expression match\n"); { char *phone_pattern = "^[-0-9+( )]{7,40}$"; char *email_pattern = "^[^@ ]+@([-a-zA-Z0-9]+\\.)+[a-zA-Z]{2,}$"; char *valid_phone1 = "+4797141255"; char *valid_phone2 = "(47)-97-14-12-55"; char *invalid_phone1 = "141255"; char *invalid_phone2 = "(47)971412551234567890123456789012345678901234567890"; char *invalid_phone3 = ""; char *invalid_phone4 = "abc123"; char *valid_email1 = "hauk@TILDESLASH.com"; char *valid_email2 = "jan-henrik.haukeland@haukeland.co.uk"; char *invalid_email1 = "hauktildeslash.com"; char *invalid_email2 = ""; char *invalid_email3 = "hauk@tildeslashcom"; char *invalid_email4 = "hauk@æøåtildeslash.com"; char *invalid_pattern = "^[["; // phone printf("\tResult: match(%s, %s)\n", phone_pattern, valid_phone1); assert(Str_match(phone_pattern, valid_phone1)); printf("\tResult: match(%s, %s)\n", phone_pattern, valid_phone2); assert(Str_match(phone_pattern, valid_phone2)); printf("\tResult: match(%s, %s)\n", phone_pattern, invalid_phone1); assert(! Str_match(phone_pattern, invalid_phone1)); printf("\tResult: match(%s, %s)\n", phone_pattern, invalid_phone2); assert(! Str_match(phone_pattern, invalid_phone2)); printf("\tResult: match(%s, %s)\n", phone_pattern, invalid_phone3); assert(! Str_match(phone_pattern, invalid_phone3)); printf("\tResult: match(%s, %s)\n", phone_pattern, invalid_phone4); assert(! Str_match(phone_pattern, invalid_phone4)); // email printf("\tResult: match(%s, %s)\n", email_pattern, valid_email1); assert(Str_match(email_pattern, valid_email1)); printf("\tResult: match(%s, %s)\n", email_pattern, valid_email2); assert(Str_match(email_pattern, valid_email2)); printf("\tResult: match(%s, %s)\n", email_pattern, invalid_email1); assert(! Str_match(email_pattern, invalid_email1)); printf("\tResult: match(%s, %s)\n", email_pattern, invalid_email2); assert(! Str_match(email_pattern, invalid_email2)); printf("\tResult: match(%s, %s)\n", email_pattern, invalid_email3); assert(! Str_match(email_pattern, invalid_email3)); printf("\tResult: match(%s, %s)\n", email_pattern, invalid_email4); assert(! Str_match(email_pattern, invalid_email4)); // invalid regex TRY { Str_match(invalid_pattern, valid_email1); assert(false); } CATCH(AssertException) { printf("\tok\n"); } END_TRY; } printf("=> Test17: OK\n\n"); printf("=> Test18: lim\n"); { char *zero = ""; char *two = "12"; char *ten = "1234567890"; assert(! Str_lim(zero, 0)); assert(!Str_lim(zero, 1)); assert(Str_lim(two, 0)); assert(Str_lim(two, 1)); assert(!Str_lim(two, 2)); assert(Str_lim(ten, 0)); assert(Str_lim(ten, 5)); assert(Str_lim(ten, 9)); assert(!Str_lim(ten, 10)); assert(! Str_lim(ten, 100)); } printf("=> Test18: OK\n\n"); printf("=> Test19: substring\n"); { assert(Str_sub("foo bar baz", "bar")); assert(! Str_sub("foo bar baz", "barx")); assert(Str_isEqual(Str_sub("foo bar baz", "baz"), "baz")); assert(Str_sub("foo bar baz", "foo bar baz")); assert(Str_sub("a", "a")); assert(! Str_sub("a", "b")); assert(! Str_sub("", "")); assert(! Str_sub("foo", "")); assert(! Str_sub("abc", "abcdef")); assert(! Str_sub("foo", "foo bar")); assert(Str_isEqual(Str_sub("foo foo bar", "foo bar"), "foo bar")); assert(Str_sub("foo foo bar foo bar baz fuu", "foo bar baz")); assert(Str_isEqual(Str_sub("abcd abcc", "abcc"), "abcc")); } printf("=> Test19: OK\n\n"); printf("=> Test20: Str_join\n"); { char *p = NULL; char dest[10+1] = "xxxxxxxxx"; char a[] = "abc"; char *b = "def"; char *c = "xxx123"; assert(Str_isEqual(Str_join(dest, 10, a, b, "ghi"), "abcdefghi")); assert(Str_isEqual(Str_join(dest, 10, p), "")); assert(Str_isEqual(Str_join(dest, 10), "")); assert(Str_isEqual(Str_join(dest, 10, "012", "3456789", "0123456789"), "0123456789")); assert(Str_isEqual(Str_join(dest, 4, "a", "b", "cd", "ghi", "jklmnopq"), "abcd")); assert(Str_isEqual(Str_join(dest, 10, a, c + 3), "abc123")); Str_join(dest, 0); assert(dest[0]==0); } printf("=> Test20: OK\n\n"); printf("=> Test21: Str_has\n"); { char *foo = "'bar' (baz)"; assert(Str_has("(')", foo)); assert(! Str_has(",;", foo)); } printf("=> Test21: OK\n\n"); printf("=> Test22: Str_curtail\n"); { char s[] = "Hello World"; assert(Str_isByteEqual(Str_curtail(s, ""), "Hello World")); assert(Str_isByteEqual(Str_curtail(s, ">"), " Test22: OK\n\n"); printf("=> Test23: Str_unescape\n"); { char s[] = "foo\\'ba\\`r\\}baz"; char t[] = "\\>\\;"; assert(Str_isEqual("foo'ba`r\\}baz", Str_unescape("`'", s))); assert(Str_isEqual(s, Str_unescape("@*", s))); assert(Str_isEqual(Str_unescape("&;", t), ">")); assert(Str_unescape("@*!#$%&/(=", NULL) == NULL); } printf("=> Test23: OK\n\n"); printf("=> Test24: Str_authcmp\n"); { assert(!Str_authcmp(NULL, NULL)); assert(!Str_authcmp("abcdef", NULL)); assert(!Str_authcmp(NULL, "abcdef")); assert(!Str_authcmp("", "abcdef")); assert(!Str_authcmp("abcdef", "")); assert(Str_authcmp("abcdef", "abcdef")); assert(!Str_authcmp("abcdef", "ABCDEF")); char *a = "da091173a92116fc7b86990368647f99228cd0b5d993e93248b501e059674b7e"; char *b = "9b594557f02a0084bcd10cbb160406618312ce6612aeb8da86e57b2929fa1465"; assert(!Str_authcmp(a, b)); assert(Str_authcmp(a, a)); } printf("=> Test24: OK\n\n"); printf("=> Test25: Str_cmp\n"); { assert(Str_cmp("foo", "foo") == 0); assert(Str_cmp("foo", "FOO") != 0); assert(Str_cmp("foo", "bar") != 0); } printf("=> Test25: OK\n\n"); printf("============> Str Tests: OK\n\n"); return 0; } monit-5.35.2/configure0000755000016400001720000300275315007061161011566 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for monit 5.35.2. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 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. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (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 \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: monit-general@nongnu.org about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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=`printf "%s\n" "$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 || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop 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_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='monit' PACKAGE_TARNAME='monit' PACKAGE_VERSION='5.35.2' PACKAGE_STRING='monit 5.35.2' PACKAGE_BUGREPORT='monit-general@nongnu.org' PACKAGE_URL='' ac_unique_file="src/monit.c" enable_option_checking=no # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= ac_func_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS WITH_CODESIGN_FALSE WITH_CODESIGN_TRUE CODESIGN_IDENTITY ssllibdir sslincldir ARCH CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX LIBOBJS LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL POD2MANFLAGS POD2MAN FLEX YACC am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC subdirs AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_static enable_shared with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_ipv6 with_piddir with_largefiles enable_largefile with_zlib with_pam with_asan with_ssl_static with_ssl with_ssl_dir with_ssl_incl_dir with_ssl_lib_dir enable_optimized enable_werror enable_profiling enable_codesign ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CXX CXXFLAGS CCC CXXCPP' ac_subdirs_all='libmonit' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) 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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) 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'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --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" ;; *=*) 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 eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures monit 5.35.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/monit] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of monit 5.35.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-largefile omit support for large files --enable-optimized Build software optimized --enable-werror Treat warnings as errors (default: warnings are not errors) --enable-profiling Build with debug and profiling options --enable-codesign=identity Add code signature to the monit binary on macOS Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --without-ipv6 Disable the IPv6 support (default: check) --with-piddir=DIR Define a pid directory (default: autodetection) --without-largefiles disable large files support (default: enabled) --with-zlib(=) Link Monit with zlib. An optional path argument may be given to specify the top-level directory to search for zlib to link with --without-pam disable the use of pam (default: enabled) --with-asan enable the use of AddressSanitizer (default: disabled) --with-ssl-static=DIR location of SSL installation --without-ssl disable the use of ssl (default: enabled) --with-ssl-dir=DIR location of SSL installation --with-ssl-incl-dir=DIR location of installed SSL include files --with-ssl-lib-dir=DIR location of installed SSL library files Some influential environment variables: CC C compiler command CFLAGS C compiler flags 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 you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF monit configure 5.35.2 generated by GNU Autoconf 2.71 Copyright (C) 2021 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 ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop 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 $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop 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. */ #include #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 (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { 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 (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 printf %s "checking for $2.$3... " >&6; } if eval test \${$4+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else $as_nop eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_try_run LINENO # ---------------------- # Try to run 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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_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 conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_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\"" printf "%s\n" "$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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam 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\"" printf "%s\n" "$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 printf "%s\n" "$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_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid; break else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=$ac_mid; break else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval (void) { return $2; } static unsigned long int ulongval (void) { return $2; } #include #include int main (void) { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : echo >>conftest.val; read $3 &5 printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_check_decl ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac 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 monit $as_me 5.35.2, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _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 case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "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=`printf "%s\n" "$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=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " vfork.h vfork_h HAVE_VFORK_H" as_fn_append ac_func_c_list " fork HAVE_FORK" as_fn_append ac_func_c_list " vfork HAVE_VFORK" # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " # Auxiliary files required by this configure script. ac_aux_files="config.guess config.sub ltmain.sh compile missing install-sh" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}/config" # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # 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 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # 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. MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." 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 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='monit' VERSION='5.35.2' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi subdirs="$subdirs libmonit" ac_config_commands="$ac_config_commands libtool_patch" ac_config_commands="$ac_config_commands monitrc" # ------------------------------------------------------------------------ # Programs # ------------------------------------------------------------------------ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$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_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$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 (void) { 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. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$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\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$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 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi for ac_prog in 'bison -y' byacc yacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_YACC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="$PATH:/usr/local/bin:/usr/bin" for as_dir in $as_dummy do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 printf "%s\n" "$YACC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="no" if test "x$YACC" = "xno"; then # Require bison unless y.tab.c already is built if test ! -f src/y.tab.c; then as_fn_error $? "Monit require bison, byacc or yacc. Download bison from http://www.gnu.org/software/bison/" "$LINENO" 5 fi fi # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_FLEX+y} then : printf %s "(cached) " >&6 else $as_nop case $FLEX in [\\/]* | ?:[\\/]*) ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="$PATH:/usr/local/bin:/usr/bin" for as_dir in $as_dummy do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_FLEX="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="no" ;; esac fi FLEX=$ac_cv_path_FLEX if test -n "$FLEX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5 printf "%s\n" "$FLEX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$FLEX" = "xno"; then # Require flex unless lex.yy.c already is built if test ! -f src/lex.yy.c; then as_fn_error $? "flex is required. Download from http://www.gnu.org/software/flex/" "$LINENO" 5 fi fi # Extract the first word of "pod2man", so it can be a program name with args. set dummy pod2man; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_POD2MAN+y} then : printf %s "(cached) " >&6 else $as_nop case $POD2MAN in [\\/]* | ?:[\\/]*) ac_cv_path_POD2MAN="$POD2MAN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="$PATH:/usr/local/bin:/usr/bin" for as_dir in $as_dummy do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_POD2MAN="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_POD2MAN" && ac_cv_path_POD2MAN="no" ;; esac fi POD2MAN=$ac_cv_path_POD2MAN if test -n "$POD2MAN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $POD2MAN" >&5 printf "%s\n" "$POD2MAN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$POD2MAN" = "xno"; then # Require pod2man unless monit.1 already is built if test ! -f monit.1; then as_fn_error $? "pod2man is required to build the monit.1 man file." "$LINENO" 5 fi else POD2MANFLAGS="--center 'User Commands' --release 5.35.2 --date='www.mmonit.com' --lax" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra" >&5 printf %s "checking whether C compiler accepts -Wextra... " >&6; } if test ${ax_cv_check_cflags___Wextra+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wextra" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___Wextra=yes else $as_nop ax_cv_check_cflags___Wextra=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wextra" >&5 printf "%s\n" "$ax_cv_check_cflags___Wextra" >&6; } if test "x$ax_cv_check_cflags___Wextra" = xyes then : CFLAGS="$CFLAGS -Wextra" else $as_nop : fi if test `uname` != "AIX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector-all" >&5 printf %s "checking whether C compiler accepts -fstack-protector-all... " >&6; } if test ${ax_cv_check_cflags___fstack_protector_all+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fstack-protector-all" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fstack_protector_all=yes else $as_nop ax_cv_check_cflags___fstack_protector_all=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstack_protector_all" >&5 printf "%s\n" "$ax_cv_check_cflags___fstack_protector_all" >&6; } if test "x$ax_cv_check_cflags___fstack_protector_all" = xyes then : CFLAGS="$CFLAGS -fstack-protector-all" else $as_nop : fi fi # ------------------------------------------------------------------------ # Libtool # ------------------------------------------------------------------------ # Check whether --enable-static was given. if test ${enable_static+y} then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_static=no fi case `pwd` in *\ * | *\ *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 printf "%s\n" "printf" >&6; } ;; print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 printf "%s\n" "print -r" >&6; } ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 printf "%s\n" "cat" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 printf %s "checking for fgrep... " >&6; } if test ${ac_cv_path_FGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in fgrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test ${lt_cv_path_NM+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 printf "%s\n" "$DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 printf %s "checking the name lister ($NM) interface... " >&6; } if test ${lt_cv_nm_interface+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 printf "%s\n" "$lt_cv_nm_interface" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 printf %s "checking the maximum length of command line arguments... " >&6; } if test ${lt_cv_sys_max_cmd_len+y} then : printf %s "(cached) " >&6 else $as_nop i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 printf %s "checking how to convert $build file names to $host format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 printf %s "checking how to convert $build file names to toolchain format... " >&6; } if test ${lt_cv_to_tool_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 printf %s "checking for $LD option to reload object files... " >&6; } if test ${lt_cv_ld_reload_flag+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_reload_flag='-r' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 printf "%s\n" "$OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 printf %s "checking how to recognize dependent libraries... " >&6; } if test ${lt_cv_deplibs_check_method+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 printf "%s\n" "$DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 printf %s "checking how to associate runtime and link libraries... " >&6; } if test ${lt_cv_sharedlib_from_linklib_cmd+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cr} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 printf %s "checking for archiver @FILE support... " >&6; } if test ${lt_cv_ar_at_file+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 printf %s "checking command to parse $NM output from $compiler object... " >&6; } if test ${lt_cv_sys_global_symbol_pipe+y} then : printf %s "(cached) " >&6 else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 printf "%s\n" "failed" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test ${with_sysroot+y} then : withval=$with_sysroot; else $as_nop with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 printf "%s\n" "${lt_sysroot:-no}" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 printf %s "checking for a working dd... " >&6; } if test ${ac_cv_path_lt_DD+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in dd do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 printf "%s\n" "$ac_cv_path_lt_DD" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 printf %s "checking how to truncate binary pipes... " >&6; } if test ${lt_cv_truncate_bin+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 printf "%s\n" "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test ${enable_libtool_lock+y} then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 printf %s "checking whether the C compiler needs -belf... " >&6; } if test ${lt_cv_cc_needs_belf+y} then : printf %s "(cached) " >&6 else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_cc_needs_belf=yes else $as_nop lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 printf "%s\n" "$MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if test ${lt_cv_path_mainfest_tool+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 printf "%s\n" "$DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 printf "%s\n" "$NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 printf "%s\n" "$ac_ct_NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 printf "%s\n" "$LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 printf "%s\n" "$ac_ct_LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 printf "%s\n" "$OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 printf "%s\n" "$ac_ct_OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 printf "%s\n" "$OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 printf "%s\n" "$ac_ct_OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 printf %s "checking for -single_module linker flag... " >&6; } if test ${lt_cv_apple_cc_single_mod+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_ld_exported_symbols_list=yes else $as_nop lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 printf %s "checking for -force_load linker flag... " >&6; } if test ${lt_cv_ld_force_load+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cr libconftest.a conftest.o" >&5 $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[912]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes then : printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_shared=yes fi # Check whether --with-pic was given. if test ${with_pic+y} then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop pic_mode=default fi # Check whether --enable-fast-install was given. if test ${enable_fast_install+y} then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test ${with_aix_soname+y} then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else $as_nop if test ${lt_cv_with_aix_soname+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 printf %s "checking for objdir... " >&6; } if test ${lt_cv_objdir+y} then : printf %s "(cached) " >&6 else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 printf %s "checking for ${ac_tool_prefix}file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 printf %s "checking for file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test ${lt_cv_prog_compiler_rtti_exceptions+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test ${lt_cv_prog_compiler_pic_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 printf %s "checking if $CC understands -b... " >&6; } if test ${lt_cv_prog_compiler__b+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_irix_exported_symbol=yes else $as_nop lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes then : lt_cv_dlopen=shl_load else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char shl_load (); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes then : lt_cv_dlopen=dlopen else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 printf %s "checking for dlopen in -lsvld... " >&6; } if test ${ac_cv_lib_svld_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_svld_dlopen=yes else $as_nop ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 printf %s "checking for dld_link in -ldld... " >&6; } if test ${ac_cv_lib_dld_dld_link+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dld_link (); int main (void) { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_dld_link=yes else $as_nop ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 printf %s "checking whether a program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 printf %s "checking whether a statically linked program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self_static+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi # Report what library types will actually be built { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 printf %s "checking if libtool supports shared libraries... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 printf "%s\n" "$can_build_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 printf "%s\n" "$enable_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 printf "%s\n" "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: # ------------------------------------------------------------------------ # Libraries # ------------------------------------------------------------------------ # Check for libraries { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 printf %s "checking for socket in -lsocket... " >&6; } if test ${ac_cv_lib_socket_socket+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char socket (); int main (void) { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_socket_socket=yes else $as_nop ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 printf "%s\n" "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes then : printf "%s\n" "#define HAVE_LIBSOCKET 1" >>confdefs.h LIBS="-lsocket $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socket in -linet" >&5 printf %s "checking for socket in -linet... " >&6; } if test ${ac_cv_lib_inet_socket+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char socket (); int main (void) { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_inet_socket=yes else $as_nop ac_cv_lib_inet_socket=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_socket" >&5 printf "%s\n" "$ac_cv_lib_inet_socket" >&6; } if test "x$ac_cv_lib_inet_socket" = xyes then : printf "%s\n" "#define HAVE_LIBINET 1" >>confdefs.h LIBS="-linet $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inet_addr in -lnsl" >&5 printf %s "checking for inet_addr in -lnsl... " >&6; } if test ${ac_cv_lib_nsl_inet_addr+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char inet_addr (); int main (void) { return inet_addr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_nsl_inet_addr=yes else $as_nop ac_cv_lib_nsl_inet_addr=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_inet_addr" >&5 printf "%s\n" "$ac_cv_lib_nsl_inet_addr" >&6; } if test "x$ac_cv_lib_nsl_inet_addr" = xyes then : printf "%s\n" "#define HAVE_LIBNSL 1" >>confdefs.h LIBS="-lnsl $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 printf %s "checking for inet_aton in -lresolv... " >&6; } if test ${ac_cv_lib_resolv_inet_aton+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char inet_aton (); int main (void) { return inet_aton (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_resolv_inet_aton=yes else $as_nop ac_cv_lib_resolv_inet_aton=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 printf "%s\n" "$ac_cv_lib_resolv_inet_aton" >&6; } if test "x$ac_cv_lib_resolv_inet_aton" = xyes then : printf "%s\n" "#define HAVE_LIBRESOLV 1" >>confdefs.h LIBS="-lresolv $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for crypt in -lc" >&5 printf %s "checking for crypt in -lc... " >&6; } if test ${ac_cv_lib_c_crypt+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char crypt (); int main (void) { return crypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_c_crypt=yes else $as_nop ac_cv_lib_c_crypt=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_crypt" >&5 printf "%s\n" "$ac_cv_lib_c_crypt" >&6; } if test "x$ac_cv_lib_c_crypt" = xyes then : : else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 printf %s "checking for crypt in -lcrypt... " >&6; } if test ${ac_cv_lib_crypt_crypt+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char crypt (); int main (void) { return crypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_crypt_crypt=yes else $as_nop ac_cv_lib_crypt_crypt=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 printf "%s\n" "$ac_cv_lib_crypt_crypt" >&6; } if test "x$ac_cv_lib_crypt_crypt" = xyes then : printf "%s\n" "#define HAVE_LIBCRYPT 1" >>confdefs.h LIBS="-lcrypt $LIBS" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 printf %s "checking for pthread_create in -lpthread... " >&6; } if test ${ac_cv_lib_pthread_pthread_create+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_create (); int main (void) { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pthread_pthread_create=yes else $as_nop ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes then : printf "%s\n" "#define HAVE_LIBPTHREAD 1" >>confdefs.h LIBS="-lpthread $LIBS" else $as_nop as_fn_error $? "POSIX thread library is required" "$LINENO" 5 fi # ------------------------------------------------------------------------ # Header files # ------------------------------------------------------------------------ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 printf %s "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test ${ac_cv_header_sys_wait_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main (void) { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_header_sys_wait_h=yes else $as_nop ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 printf "%s\n" "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 printf %s "checking whether stat file-mode macros are broken... " >&6; } if test ${ac_cv_header_stat_broken+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if defined S_ISBLK && defined S_IFDIR extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #endif #if defined S_ISBLK && defined S_IFCHR extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; #endif #if defined S_ISLNK && defined S_IFREG extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif #if defined S_ISSOCK && defined S_IFREG extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_header_stat_broken=no else $as_nop ac_cv_header_stat_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 printf "%s\n" "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "alloca.h" "ac_cv_header_alloca_h" "$ac_includes_default" if test "x$ac_cv_header_alloca_h" = xyes then : printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" if test "x$ac_cv_header_arpa_inet_h" = xyes then : printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "asm/page.h" "ac_cv_header_asm_page_h" "$ac_includes_default" if test "x$ac_cv_header_asm_page_h" = xyes then : printf "%s\n" "#define HAVE_ASM_PAGE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "asm/param.h" "ac_cv_header_asm_param_h" "$ac_includes_default" if test "x$ac_cv_header_asm_param_h" = xyes then : printf "%s\n" "#define HAVE_ASM_PARAM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "cf.h" "ac_cv_header_cf_h" "$ac_includes_default" if test "x$ac_cv_header_cf_h" = xyes then : printf "%s\n" "#define HAVE_CF_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "crt_externs.h" "ac_cv_header_crt_externs_h" "$ac_includes_default" if test "x$ac_cv_header_crt_externs_h" = xyes then : printf "%s\n" "#define HAVE_CRT_EXTERNS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" if test "x$ac_cv_header_ctype_h" = xyes then : printf "%s\n" "#define HAVE_CTYPE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "crypt.h" "ac_cv_header_crypt_h" "$ac_includes_default" if test "x$ac_cv_header_crypt_h" = xyes then : printf "%s\n" "#define HAVE_CRYPT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "CoreFoundation/CoreFoundation.h" "ac_cv_header_CoreFoundation_CoreFoundation_h" "$ac_includes_default" if test "x$ac_cv_header_CoreFoundation_CoreFoundation_h" = xyes then : printf "%s\n" "#define HAVE_COREFOUNDATION_COREFOUNDATION_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "devstat.h" "ac_cv_header_devstat_h" "$ac_includes_default" if test "x$ac_cv_header_devstat_h" = xyes then : printf "%s\n" "#define HAVE_DEVSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "dirent.h" "ac_cv_header_dirent_h" "$ac_includes_default" if test "x$ac_cv_header_dirent_h" = xyes then : printf "%s\n" "#define HAVE_DIRENT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "DiskArbitration/DiskArbitration.h" "ac_cv_header_DiskArbitration_DiskArbitration_h" "$ac_includes_default" if test "x$ac_cv_header_DiskArbitration_DiskArbitration_h" = xyes then : printf "%s\n" "#define HAVE_DISKARBITRATION_DISKARBITRATION_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes then : printf "%s\n" "#define HAVE_ERRNO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default" if test "x$ac_cv_header_execinfo_h" = xyes then : printf "%s\n" "#define HAVE_EXECINFO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes then : printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" if test "x$ac_cv_header_getopt_h" = xyes then : printf "%s\n" "#define HAVE_GETOPT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "glob.h" "ac_cv_header_glob_h" "$ac_includes_default" if test "x$ac_cv_header_glob_h" = xyes then : printf "%s\n" "#define HAVE_GLOB_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default" if test "x$ac_cv_header_grp_h" = xyes then : printf "%s\n" "#define HAVE_GRP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "$ac_includes_default" if test "x$ac_cv_header_ifaddrs_h" = xyes then : printf "%s\n" "#define HAVE_IFADDRS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "IOKit/storage/IOBlockStorageDriver.h" "ac_cv_header_IOKit_storage_IOBlockStorageDriver_h" "$ac_includes_default" if test "x$ac_cv_header_IOKit_storage_IOBlockStorageDriver_h" = xyes then : printf "%s\n" "#define HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDRIVER_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "kinfo.h" "ac_cv_header_kinfo_h" "$ac_includes_default" if test "x$ac_cv_header_kinfo_h" = xyes then : printf "%s\n" "#define HAVE_KINFO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "kvm.h" "ac_cv_header_kvm_h" "$ac_includes_default" if test "x$ac_cv_header_kvm_h" = xyes then : printf "%s\n" "#define HAVE_KVM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" if test "x$ac_cv_header_paths_h" = xyes then : printf "%s\n" "#define HAVE_PATHS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "kstat.h" "ac_cv_header_kstat_h" "$ac_includes_default" if test "x$ac_cv_header_kstat_h" = xyes then : printf "%s\n" "#define HAVE_KSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "libzfs.h" "ac_cv_header_libzfs_h" "$ac_includes_default" if test "x$ac_cv_header_libzfs_h" = xyes then : printf "%s\n" "#define HAVE_LIBZFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "zone.h" "ac_cv_header_zone_h" "$ac_includes_default" if test "x$ac_cv_header_zone_h" = xyes then : printf "%s\n" "#define HAVE_ZONE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/protosw.h" "ac_cv_header_sys_protosw_h" "$ac_includes_default" if test "x$ac_cv_header_sys_protosw_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PROTOSW_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "libproc.h" "ac_cv_header_libproc_h" "$ac_includes_default" if test "x$ac_cv_header_libproc_h" = xyes then : printf "%s\n" "#define HAVE_LIBPROC_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes then : printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "loadavg.h" "ac_cv_header_loadavg_h" "$ac_includes_default" if test "x$ac_cv_header_loadavg_h" = xyes then : printf "%s\n" "#define HAVE_LOADAVG_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" if test "x$ac_cv_header_locale_h" = xyes then : printf "%s\n" "#define HAVE_LOCALE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "lvm.h" "ac_cv_header_lvm_h" "$ac_includes_default" if test "x$ac_cv_header_lvm_h" = xyes then : printf "%s\n" "#define HAVE_LVM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "mach/host_info.h" "ac_cv_header_mach_host_info_h" "$ac_includes_default" if test "x$ac_cv_header_mach_host_info_h" = xyes then : printf "%s\n" "#define HAVE_MACH_HOST_INFO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default" if test "x$ac_cv_header_mach_mach_h" = xyes then : printf "%s\n" "#define HAVE_MACH_MACH_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "mach/mach_host.h" "ac_cv_header_mach_mach_host_h" "$ac_includes_default" if test "x$ac_cv_header_mach_mach_host_h" = xyes then : printf "%s\n" "#define HAVE_MACH_MACH_HOST_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "memory.h" "ac_cv_header_memory_h" "$ac_includes_default" if test "x$ac_cv_header_memory_h" = xyes then : printf "%s\n" "#define HAVE_MEMORY_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "mntent.h" "ac_cv_header_mntent_h" "$ac_includes_default" if test "x$ac_cv_header_mntent_h" = xyes then : printf "%s\n" "#define HAVE_MNTENT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" if test "x$ac_cv_header_netdb_h" = xyes then : printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/tcp.h" "ac_cv_header_netinet_tcp_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_tcp_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_TCP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/in_systm.h" "ac_cv_header_netinet_in_systm_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_systm_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IN_SYSTM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "pam/pam_appl.h" "ac_cv_header_pam_pam_appl_h" "$ac_includes_default" if test "x$ac_cv_header_pam_pam_appl_h" = xyes then : printf "%s\n" "#define HAVE_PAM_PAM_APPL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "security/pam_appl.h" "ac_cv_header_security_pam_appl_h" "$ac_includes_default" if test "x$ac_cv_header_security_pam_appl_h" = xyes then : printf "%s\n" "#define HAVE_SECURITY_PAM_APPL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" if test "x$ac_cv_header_poll_h" = xyes then : printf "%s\n" "#define HAVE_POLL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "procfs.h" "ac_cv_header_procfs_h" "$ac_includes_default" if test "x$ac_cv_header_procfs_h" = xyes then : printf "%s\n" "#define HAVE_PROCFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/procfs.h" "ac_cv_header_sys_procfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_procfs_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PROCFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "procinfo.h" "ac_cv_header_procinfo_h" "$ac_includes_default" if test "x$ac_cv_header_procinfo_h" = xyes then : printf "%s\n" "#define HAVE_PROCINFO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" if test "x$ac_cv_header_pwd_h" = xyes then : printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" if test "x$ac_cv_header_regex_h" = xyes then : printf "%s\n" "#define HAVE_REGEX_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sigsetjmp.h" "ac_cv_header_sigsetjmp_h" "$ac_includes_default" if test "x$ac_cv_header_sigsetjmp_h" = xyes then : printf "%s\n" "#define HAVE_SIGSETJMP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" if test "x$ac_cv_header_signal_h" = xyes then : printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" if test "x$ac_cv_header_stdarg_h" = xyes then : printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" if test "x$ac_cv_header_stddef_h" = xyes then : printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" if test "x$ac_cv_header_stdio_h" = xyes then : printf "%s\n" "#define HAVE_STDIO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes then : printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" if test "x$ac_cv_header_strings_h" = xyes then : printf "%s\n" "#define HAVE_STRINGS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stropts.h" "ac_cv_header_stropts_h" "$ac_includes_default" if test "x$ac_cv_header_stropts_h" = xyes then : printf "%s\n" "#define HAVE_STROPTS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/cfgodm.h" "ac_cv_header_sys_cfgodm_h" "$ac_includes_default" if test "x$ac_cv_header_sys_cfgodm_h" = xyes then : printf "%s\n" "#define HAVE_SYS_CFGODM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/cfgdb.h" "ac_cv_header_sys_cfgdb_h" "$ac_includes_default" if test "x$ac_cv_header_sys_cfgdb_h" = xyes then : printf "%s\n" "#define HAVE_SYS_CFGDB_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/dk.h" "ac_cv_header_sys_dk_h" "$ac_includes_default" if test "x$ac_cv_header_sys_dk_h" = xyes then : printf "%s\n" "#define HAVE_SYS_DK_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/dkstat.h" "ac_cv_header_sys_dkstat_h" "$ac_includes_default" if test "x$ac_cv_header_sys_dkstat_h" = xyes then : printf "%s\n" "#define HAVE_SYS_DKSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/disk.h" "ac_cv_header_sys_disk_h" "$ac_includes_default" if test "x$ac_cv_header_sys_disk_h" = xyes then : printf "%s\n" "#define HAVE_SYS_DISK_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_filio_h" = xyes then : printf "%s\n" "#define HAVE_SYS_FILIO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/fs/zfs.h" "ac_cv_header_sys_fs_zfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_fs_zfs_h" = xyes then : printf "%s\n" "#define HAVE_SYS_FS_ZFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/instance.h" "ac_cv_header_sys_instance_h" "$ac_includes_default" if test "x$ac_cv_header_sys_instance_h" = xyes then : printf "%s\n" "#define HAVE_SYS_INSTANCE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ioctl_h" = xyes then : printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/iostat.h" "ac_cv_header_sys_iostat_h" "$ac_includes_default" if test "x$ac_cv_header_sys_iostat_h" = xyes then : printf "%s\n" "#define HAVE_SYS_IOSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/loadavg.h" "ac_cv_header_sys_loadavg_h" "$ac_includes_default" if test "x$ac_cv_header_sys_loadavg_h" = xyes then : printf "%s\n" "#define HAVE_SYS_LOADAVG_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/lock.h" "ac_cv_header_sys_lock_h" "$ac_includes_default" if test "x$ac_cv_header_sys_lock_h" = xyes then : printf "%s\n" "#define HAVE_SYS_LOCK_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/mntent.h" "ac_cv_header_sys_mntent_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mntent_h" = xyes then : printf "%s\n" "#define HAVE_SYS_MNTENT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/mnttab.h" "ac_cv_header_sys_mnttab_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mnttab_h" = xyes then : printf "%s\n" "#define HAVE_SYS_MNTTAB_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/mutex.h" "ac_cv_header_sys_mutex_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mutex_h" = xyes then : printf "%s\n" "#define HAVE_SYS_MUTEX_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/nlist.h" "ac_cv_header_sys_nlist_h" "$ac_includes_default" if test "x$ac_cv_header_sys_nlist_h" = xyes then : printf "%s\n" "#define HAVE_SYS_NLIST_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/nvpair.h" "ac_cv_header_sys_nvpair_h" "$ac_includes_default" if test "x$ac_cv_header_sys_nvpair_h" = xyes then : printf "%s\n" "#define HAVE_SYS_NVPAIR_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" if test "x$ac_cv_header_sys_param_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/pstat.h" "ac_cv_header_sys_pstat_h" "$ac_includes_default" if test "x$ac_cv_header_sys_pstat_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/queue.h" "ac_cv_header_sys_queue_h" "$ac_includes_default" if test "x$ac_cv_header_sys_queue_h" = xyes then : printf "%s\n" "#define HAVE_SYS_QUEUE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/resource.h" "ac_cv_header_sys_resource_h" "$ac_includes_default" if test "x$ac_cv_header_sys_resource_h" = xyes then : printf "%s\n" "#define HAVE_SYS_RESOURCE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/sched.h" "ac_cv_header_sys_sched_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sched_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SCHED_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/statfs.h" "ac_cv_header_sys_statfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_statfs_h" = xyes then : printf "%s\n" "#define HAVE_SYS_STATFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_statvfs_h" = xyes then : printf "%s\n" "#define HAVE_SYS_STATVFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/sysinfo.h" "ac_cv_header_sys_sysinfo_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysinfo_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SYSINFO_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysmacros_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SYSMACROS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/systemcfg.h" "ac_cv_header_sys_systemcfg_h" "$ac_includes_default" if test "x$ac_cv_header_sys_systemcfg_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SYSTEMCFG_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/tree.h" "ac_cv_header_sys_tree_h" "$ac_includes_default" if test "x$ac_cv_header_sys_tree_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TREE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/un.h" "ac_cv_header_sys_un_h" "$ac_includes_default" if test "x$ac_cv_header_sys_un_h" = xyes then : printf "%s\n" "#define HAVE_SYS_UN_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/utsname.h" "ac_cv_header_sys_utsname_h" "$ac_includes_default" if test "x$ac_cv_header_sys_utsname_h" = xyes then : printf "%s\n" "#define HAVE_SYS_UTSNAME_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/var.h" "ac_cv_header_sys_var_h" "$ac_includes_default" if test "x$ac_cv_header_sys_var_h" = xyes then : printf "%s\n" "#define HAVE_SYS_VAR_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/vmmeter.h" "ac_cv_header_sys_vmmeter_h" "$ac_includes_default" if test "x$ac_cv_header_sys_vmmeter_h" = xyes then : printf "%s\n" "#define HAVE_SYS_VMMETER_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/vm_usage.h" "ac_cv_header_sys_vm_usage_h" "$ac_includes_default" if test "x$ac_cv_header_sys_vm_usage_h" = xyes then : printf "%s\n" "#define HAVE_SYS_VM_USAGE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/vfs.h" "ac_cv_header_sys_vfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_vfs_h" = xyes then : printf "%s\n" "#define HAVE_SYS_VFS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" if test "x$ac_cv_header_syslog_h" = xyes then : printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes then : printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "utmpx.h" "ac_cv_header_utmpx_h" "$ac_includes_default" if test "x$ac_cv_header_utmpx_h" = xyes then : printf "%s\n" "#define HAVE_UTMPX_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "uvm/uvm_extern.h" "ac_cv_header_uvm_uvm_extern_h" "$ac_includes_default" if test "x$ac_cv_header_uvm_uvm_extern_h" = xyes then : printf "%s\n" "#define HAVE_UVM_UVM_EXTERN_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "uvm/uvm_param.h" "ac_cv_header_uvm_uvm_param_h" "$ac_includes_default" if test "x$ac_cv_header_uvm_uvm_param_h" = xyes then : printf "%s\n" "#define HAVE_UVM_UVM_PARAM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "vm/vm.h" "ac_cv_header_vm_vm_h" "$ac_includes_default" if test "x$ac_cv_header_vm_vm_h" = xyes then : printf "%s\n" "#define HAVE_VM_VM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/if_media.h" "ac_cv_header_net_if_media_h" "$ac_includes_default" if test "x$ac_cv_header_net_if_media_h" = xyes then : printf "%s\n" "#define HAVE_NET_IF_MEDIA_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/if_dl.h" "ac_cv_header_net_if_dl_h" "$ac_includes_default" if test "x$ac_cv_header_net_if_dl_h" = xyes then : printf "%s\n" "#define HAVE_NET_IF_DL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/route.h" "ac_cv_header_net_route_h" "$ac_includes_default" if test "x$ac_cv_header_net_route_h" = xyes then : printf "%s\n" "#define HAVE_NET_ROUTE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "libperfstat.h" "ac_cv_header_libperfstat_h" " #ifdef HAVE_SYS_PROTOSW_H #include #endif " if test "x$ac_cv_header_libperfstat_h" = xyes then : printf "%s\n" "#define HAVE_LIBPERFSTAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/ip.h" "ac_cv_header_netinet_ip_h" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif " if test "x$ac_cv_header_netinet_ip_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IP_H #include #endif " if test "x$ac_cv_header_net_if_h" = xyes then : printf "%s\n" "#define HAVE_NET_IF_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/ip_icmp.h" "ac_cv_header_netinet_ip_icmp_h" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IP_H #include #endif " if test "x$ac_cv_header_netinet_ip_icmp_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IP_ICMP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/icmp6.h" "ac_cv_header_netinet_icmp6_h" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IP_H #include #endif " if test "x$ac_cv_header_netinet_icmp6_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_ICMP6_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" " #ifdef HAVE_SYS_PARAM_H #include #endif " if test "x$ac_cv_header_sys_sysctl_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" " #ifdef HAVE_SYS_PARAM_H #include #endif " if test "x$ac_cv_header_sys_mount_h" = xyes then : printf "%s\n" "#define HAVE_SYS_MOUNT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/proc.h" "ac_cv_header_sys_proc_h" " #ifdef HAVE_SYS_PARAM_H #include #endif " if test "x$ac_cv_header_sys_proc_h" = xyes then : printf "%s\n" "#define HAVE_SYS_PROC_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/swap.h" "ac_cv_header_sys_swap_h" " #ifdef HAVE_SYS_PARAM_H #include #endif " if test "x$ac_cv_header_sys_swap_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SWAP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/ucred.h" "ac_cv_header_sys_ucred_h" " #ifdef HAVE_SYS_PARAM_H #include #endif " if test "x$ac_cv_header_sys_ucred_h" = xyes then : printf "%s\n" "#define HAVE_SYS_UCRED_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/user.h" "ac_cv_header_sys_user_h" " #ifdef HAVE_SYS_PARAM_H #include #endif " if test "x$ac_cv_header_sys_user_h" = xyes then : printf "%s\n" "#define HAVE_SYS_USER_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "machine/vmparam.h" "ac_cv_header_machine_vmparam_h" " #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_QUEUE_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_VM_PMAP_H #include #endif " if test "x$ac_cv_header_machine_vmparam_h" = xyes then : printf "%s\n" "#define HAVE_MACHINE_VMPARAM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "vm/pmap.h" "ac_cv_header_vm_pmap_h" " #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_QUEUE_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_VM_PMAP_H #include #endif " if test "x$ac_cv_header_vm_pmap_h" = xyes then : printf "%s\n" "#define HAVE_VM_PMAP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "machine/pmap.h" "ac_cv_header_machine_pmap_h" " #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_QUEUE_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_VM_PMAP_H #include #endif " if test "x$ac_cv_header_machine_pmap_h" = xyes then : printf "%s\n" "#define HAVE_MACHINE_PMAP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "vm/vm_map.h" "ac_cv_header_vm_vm_map_h" " #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_QUEUE_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_VM_PMAP_H #include #endif " if test "x$ac_cv_header_vm_vm_map_h" = xyes then : printf "%s\n" "#define HAVE_VM_VM_MAP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "vm/vm_object.h" "ac_cv_header_vm_vm_object_h" " #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_QUEUE_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_VM_PMAP_H #include #endif " if test "x$ac_cv_header_vm_vm_object_h" = xyes then : printf "%s\n" "#define HAVE_VM_VM_OBJECT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/resourcevar.h" "ac_cv_header_sys_resourcevar_h" " #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_RESOURCE_H #include #endif " if test "x$ac_cv_header_sys_resourcevar_h" = xyes then : printf "%s\n" "#define HAVE_SYS_RESOURCEVAR_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "uvm/uvm_map.h" "ac_cv_header_uvm_uvm_map_h" " #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_TREE_H #include #endif #ifdef HAVE_UVM_UVM_EXTERN_H #include #endif " if test "x$ac_cv_header_uvm_uvm_map_h" = xyes then : printf "%s\n" "#define HAVE_UVM_UVM_MAP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "uvm/uvm_pmap.h" "ac_cv_header_uvm_uvm_pmap_h" " #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_TREE_H #include #endif #ifdef HAVE_UVM_UVM_EXTERN_H #include #endif " if test "x$ac_cv_header_uvm_uvm_pmap_h" = xyes then : printf "%s\n" "#define HAVE_UVM_UVM_PMAP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "uvm/uvm_object.h" "ac_cv_header_uvm_uvm_object_h" " #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_LOCK_H #include #endif #ifdef HAVE_SYS_TREE_H #include #endif #ifdef HAVE_UVM_UVM_EXTERN_H #include #endif " if test "x$ac_cv_header_uvm_uvm_object_h" = xyes then : printf "%s\n" "#define HAVE_UVM_UVM_OBJECT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "uvm/uvm.h" "ac_cv_header_uvm_uvm_h" " #ifdef HAVE_SYS_MUTEX_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif " if test "x$ac_cv_header_uvm_uvm_h" = xyes then : printf "%s\n" "#define HAVE_UVM_UVM_H 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Types # ------------------------------------------------------------------------ ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes then : else $as_nop printf "%s\n" "#define mode_t int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_pid_type='int' else $as_nop ac_pid_type='__int64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_pid_type='int' else $as_nop ac_pid_type='__int64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h fi # Check for structures. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 printf %s "checking whether struct tm is in sys/time.h or time.h... " >&6; } if test ${ac_cv_struct_tm+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_struct_tm=time.h else $as_nop ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 printf "%s\n" "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then printf "%s\n" "#define TM_IN_SYS_TIME 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default" if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TM_TM_GMTOFF 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Checks for library functions. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 printf %s "checking for error_at_line... " >&6; } if test ${ac_cv_lib_error_at_line+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_error_at_line=yes else $as_nop ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 printf "%s\n" "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then case " $LIBOBJS " in *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi ac_func= for ac_item in $ac_func_c_list do if test $ac_func; then ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then echo "#define $ac_item 1" >> confdefs.h fi ac_func= else ac_func=$ac_item fi done if test "x$ac_cv_func_fork" = xyes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 printf %s "checking for working fork... " >&6; } if test ${ac_cv_func_fork_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_func_fork_works=cross else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_fork_works=yes else $as_nop ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 printf "%s\n" "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 printf "%s\n" "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 printf %s "checking for working vfork... " >&6; } if test ${ac_cv_func_vfork_works+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_func_vfork_works=cross else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #include #ifdef HAVE_VFORK_H # include #endif static void do_nothing (int sig) { (void) sig; } /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void sparc_address_test (int arg) { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main (void) { pid_t parent = getpid (); pid_t child; sparc_address_test (0); /* On Solaris 2.4, changes by the child to the signal handler also munge signal handlers in the parent. To detect this, start by putting the parent's handler in a known state. */ signal (SIGTERM, SIG_DFL); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* Alter the child's signal handler. */ if (signal (SIGTERM, do_nothing) != SIG_DFL) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child munge the parent's signal handler? */ || signal (SIGTERM, SIG_DFL) != SIG_DFL /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_vfork_works=yes else $as_nop ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 printf "%s\n" "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 printf "%s\n" "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then printf "%s\n" "#define HAVE_WORKING_VFORK 1" >>confdefs.h else printf "%s\n" "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then printf "%s\n" "#define HAVE_WORKING_FORK 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 printf %s "checking whether lstat correctly handles trailing slash... " >&6; } if test ${ac_cv_func_lstat_dereferences_slashed_symlink+y} then : printf %s "(cached) " >&6 else $as_nop 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 : case "$host_os" in # (( # Guess yes on glibc systems. *-gnu*) ac_cv_func_lstat_dereferences_slashed_symlink=yes ;; # If we don't know, assume the worst. *) ac_cv_func_lstat_dereferences_slashed_symlink=no ;; esac else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. 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; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else $as_nop 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 fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 printf "%s\n" "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && printf "%s\n" "#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1" >>confdefs.h if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 printf %s "checking whether stat accepts an empty string... " >&6; } if test ${ac_cv_func_stat_empty_string_bug+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_func_stat_empty_string_bug=yes else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_stat_empty_string_bug=no else $as_nop 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 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 printf "%s\n" "$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 printf "%s\n" "#define HAVE_STAT_EMPTY_STRING_BUG 1" >>confdefs.h fi for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes then : printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h else $as_nop # strftime is in -lintl on SCO UNIX. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 printf %s "checking for strftime in -lintl... " >&6; } if test ${ac_cv_lib_intl_strftime+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char strftime (); int main (void) { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_intl_strftime=yes else $as_nop ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 printf "%s\n" "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes then : printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done ac_fn_c_check_func "$LINENO" "statfs" "ac_cv_func_statfs" if test "x$ac_cv_func_statfs" = xyes then : printf "%s\n" "#define HAVE_STATFS 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "statvfs" "ac_cv_func_statvfs" if test "x$ac_cv_func_statvfs" = xyes then : printf "%s\n" "#define HAVE_STATVFS 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" if test "x$ac_cv_func_setlocale" = xyes then : printf "%s\n" "#define HAVE_SETLOCALE 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" if test "x$ac_cv_func_getaddrinfo" = xyes then : printf "%s\n" "#define HAVE_GETADDRINFO 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog" if test "x$ac_cv_func_syslog" = xyes then : printf "%s\n" "#define HAVE_SYSLOG 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "vsyslog" "ac_cv_func_vsyslog" if test "x$ac_cv_func_vsyslog" = xyes then : printf "%s\n" "#define HAVE_VSYSLOG 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes then : printf "%s\n" "#define HAVE_BACKTRACE 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg" if test "x$ac_cv_func_getloadavg" = xyes then : printf "%s\n" "#define HAVE_GETLOADAVG 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" if test "x$ac_cv_func_getopt_long" = xyes then : printf "%s\n" "#define HAVE_GETOPT_LONG 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Compiler # ------------------------------------------------------------------------ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else $as_nop 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 /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_98+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CXX_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 printf %s "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test ${ac_cv_prog_CXXCPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CXX needs to be expanded for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 printf "%s\n" "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if test ${lt_cv_prog_compiler_pic_works_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc_CXX+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 printf "%s\n" "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_const=yes else $as_nop ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then printf "%s\n" "#define const /**/" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 printf %s "checking whether byte ordering is bigendian... " >&6; } if test ${ac_cv_c_bigendian+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_bigendian=no else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac # Define _GNU_SOURCE so we can have Posix headers etc included. We use the # -std=cXX compiler switch which only include a minimum of C headers CFLAGS="$CFLAGS -D_GNU_SOURCE" # Compiler; tune warnings CFLAGS="$CFLAGS -Wall -Wunused "; # Require at least C99 and use C11 if available if ac_fn_c_compute_int "$LINENO" "__STDC_VERSION__" "STDC_VERSION" "" then : else $as_nop STDC_VERSION=0 fi if test "$STDC_VERSION" -ge 201112 then : CFLAGS="$CFLAGS -std=c11" else $as_nop CFLAGS="$CFLAGS -std=c99" fi for ac_header in stdint.h stdbool.h do : as_ac_Header=`printf "%s\n" "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 `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else $as_nop as_fn_error $? "toolchain does not have C99 headers" "$LINENO" 5 fi done # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ # Check whether --with-ipv6 was given. if test ${with_ipv6+y} then : withval=$with_ipv6; if test "x$withval" = "xno" then with_ipv6=0 elif test "x$withval" = "xyes" then with_ipv6=1 printf "%s\n" "#define HAVE_IPV6 1" >>confdefs.h fi else $as_nop # Note inverse test. Check by default { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IPv6 support" >&5 printf %s "checking for IPv6 support... " >&6; } if test ${ac_cv_ipv6+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_ipv6=no else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Make sure the definitions for AF_INET6 and struct sockaddr_in6 * are defined, and that we can actually create an IPv6 TCP socket.*/ int main(void) { int fd; struct sockaddr_in6 foo; fd = socket(AF_INET6, SOCK_STREAM, 0); exit(fd >= 0 ? 0 : 1); } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_ipv6=yes else $as_nop ac_cv_ipv6=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ipv6" >&5 printf "%s\n" "$ac_cv_ipv6" >&6; } if test $ac_cv_ipv6 = yes then with_ipv6=1 printf "%s\n" "#define HAVE_IPV6 1" >>confdefs.h else with_ipv6=0 fi fi # ------------------------------------------------------------------------ # Paths # ------------------------------------------------------------------------ # Find the right directory to put the root-mode PID file in { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pid file location" >&5 printf %s "checking pid file location... " >&6; } # Check whether --with-piddir was given. if test ${with_piddir+y} then : withval=$with_piddir; piddir="$withval" else $as_nop if test -d "/run" then piddir="/run" elif test -d "/var/run"; then piddir="/var/run" elif test -d "/etc"; then piddir="/etc" fi fi printf "%s\n" "#define PIDDIR \"$piddir\"" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $piddir" >&5 printf "%s\n" "$piddir" >&6; } # Test mounted filesystem description file if test -f "/etc/mtab" then printf "%s\n" "#define HAVE_MTAB 1" >>confdefs.h elif test -f "/etc/mnttab"; then printf "%s\n" "#define HAVE_MNTTAB 1" >>confdefs.h fi # ------------------------------------------------------------------------ # Architecture/OS detection # ------------------------------------------------------------------------ # Backward compatibility until we get ride of arch settings architecture=`uname` if test "$architecture" = "SunOS" then ARCH="SOLARIS" CFLAGS="$CFLAGS -D _REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -m64" LDFLAGS="$LDFLAGS -m64" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libzfs_init in -lzfs" >&5 printf %s "checking for libzfs_init in -lzfs... " >&6; } if test ${ac_cv_lib_zfs_libzfs_init+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lzfs $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char libzfs_init (); int main (void) { return libzfs_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_zfs_libzfs_init=yes else $as_nop ac_cv_lib_zfs_libzfs_init=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zfs_libzfs_init" >&5 printf "%s\n" "$ac_cv_lib_zfs_libzfs_init" >&6; } if test "x$ac_cv_lib_zfs_libzfs_init" = xyes then : printf "%s\n" "#define HAVE_LIBZFS 1" >>confdefs.h LIBS="-lzfs $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nvlist_free in -lnvpair" >&5 printf %s "checking for nvlist_free in -lnvpair... " >&6; } if test ${ac_cv_lib_nvpair_nvlist_free+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lnvpair $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char nvlist_free (); int main (void) { return nvlist_free (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_nvpair_nvlist_free=yes else $as_nop ac_cv_lib_nvpair_nvlist_free=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nvpair_nvlist_free" >&5 printf "%s\n" "$ac_cv_lib_nvpair_nvlist_free" >&6; } if test "x$ac_cv_lib_nvpair_nvlist_free" = xyes then : printf "%s\n" "#define HAVE_LIBNVPAIR 1" >>confdefs.h LIBS="-lnvpair $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5 printf %s "checking for kstat_open in -lkstat... " >&6; } if test ${ac_cv_lib_kstat_kstat_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkstat $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kstat_open (); int main (void) { return kstat_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kstat_kstat_open=yes else $as_nop ac_cv_lib_kstat_kstat_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5 printf "%s\n" "$ac_cv_lib_kstat_kstat_open" >&6; } if test "x$ac_cv_lib_kstat_kstat_open" = xyes then : printf "%s\n" "#define HAVE_LIBKSTAT 1" >>confdefs.h LIBS="-lkstat $LIBS" fi if test `uname -m` = "i86pc" then if test "x$GCC" = "xyes" then CFLAGS="$CFLAGS -mtune=opteron" LDFLAGS="$LDFLAGS -mtune=opteron" else CFLAGS="$CFLAGS -xarch=sse2" LDFLAGS="$LDFLAGS -xarch=sse2" fi else if test "x$GCC" = "xyes" then CFLAGS="$CFLAGS -mtune=v9" LDFLAGS="$LDFLAGS -mtune=v9" else CFLAGS="$CFLAGS -xarch=sparc" LDFLAGS="$LDFLAGS -xarch=sparc" fi fi elif test "$architecture" = "Linux" then ARCH="LINUX" CFLAGS="$CFLAGS -D _REENTRANT" LDFLAGS="$LDFLAGS -rdynamic" elif test "$architecture" = "OpenBSD" then ARCH="OPENBSD" CFLAGS="$CFLAGS -D _REENTRANT" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 printf %s "checking for kvm_open in -lkvm... " >&6; } if test ${ac_cv_lib_kvm_kvm_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kvm_open (); int main (void) { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kvm_kvm_open=yes else $as_nop ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 printf "%s\n" "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes then : printf "%s\n" "#define HAVE_LIBKVM 1" >>confdefs.h LIBS="-lkvm $LIBS" fi with_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for backtrace in -lexecinfo" >&5 printf %s "checking for backtrace in -lexecinfo... " >&6; } if test ${ac_cv_lib_execinfo_backtrace+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lexecinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char backtrace (); int main (void) { return backtrace (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_execinfo_backtrace=yes else $as_nop ac_cv_lib_execinfo_backtrace=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_execinfo_backtrace" >&5 printf "%s\n" "$ac_cv_lib_execinfo_backtrace" >&6; } if test "x$ac_cv_lib_execinfo_backtrace" = xyes then : printf "%s\n" "#define HAVE_BACKTRACE 1" >>confdefs.h LIBS="-lexecinfo $LIBS" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: backtrace function not found in libexecinfo" >&5 printf "%s\n" "$as_me: WARNING: backtrace function not found in libexecinfo" >&2;} fi elif test "$architecture" = "FreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for devstat_getnumdevs in -ldevstat" >&5 printf %s "checking for devstat_getnumdevs in -ldevstat... " >&6; } if test ${ac_cv_lib_devstat_devstat_getnumdevs+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldevstat $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char devstat_getnumdevs (); int main (void) { return devstat_getnumdevs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_devstat_devstat_getnumdevs=yes else $as_nop ac_cv_lib_devstat_devstat_getnumdevs=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devstat_devstat_getnumdevs" >&5 printf "%s\n" "$ac_cv_lib_devstat_devstat_getnumdevs" >&6; } if test "x$ac_cv_lib_devstat_devstat_getnumdevs" = xyes then : printf "%s\n" "#define HAVE_LIBDEVSTAT 1" >>confdefs.h LIBS="-ldevstat $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 printf %s "checking for kvm_open in -lkvm... " >&6; } if test ${ac_cv_lib_kvm_kvm_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kvm_open (); int main (void) { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kvm_kvm_open=yes else $as_nop ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 printf "%s\n" "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes then : printf "%s\n" "#define HAVE_LIBKVM 1" >>confdefs.h LIBS="-lkvm $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for backtrace in -lexecinfo" >&5 printf %s "checking for backtrace in -lexecinfo... " >&6; } if test ${ac_cv_lib_execinfo_backtrace+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lexecinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char backtrace (); int main (void) { return backtrace (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_execinfo_backtrace=yes else $as_nop ac_cv_lib_execinfo_backtrace=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_execinfo_backtrace" >&5 printf "%s\n" "$ac_cv_lib_execinfo_backtrace" >&6; } if test "x$ac_cv_lib_execinfo_backtrace" = xyes then : printf "%s\n" "#define HAVE_BACKTRACE 1" >>confdefs.h LIBS="-lexecinfo $LIBS" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: backtrace function not found in libexecinfo" >&5 printf "%s\n" "$as_me: WARNING: backtrace function not found in libexecinfo" >&2;} fi elif test "$architecture" = "GNU/kFreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for devstat_getnumdevs in -ldevstat" >&5 printf %s "checking for devstat_getnumdevs in -ldevstat... " >&6; } if test ${ac_cv_lib_devstat_devstat_getnumdevs+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldevstat $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char devstat_getnumdevs (); int main (void) { return devstat_getnumdevs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_devstat_devstat_getnumdevs=yes else $as_nop ac_cv_lib_devstat_devstat_getnumdevs=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devstat_devstat_getnumdevs" >&5 printf "%s\n" "$ac_cv_lib_devstat_devstat_getnumdevs" >&6; } if test "x$ac_cv_lib_devstat_devstat_getnumdevs" = xyes then : printf "%s\n" "#define HAVE_LIBDEVSTAT 1" >>confdefs.h LIBS="-ldevstat $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 printf %s "checking for kvm_open in -lkvm... " >&6; } if test ${ac_cv_lib_kvm_kvm_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kvm_open (); int main (void) { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kvm_kvm_open=yes else $as_nop ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 printf "%s\n" "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes then : printf "%s\n" "#define HAVE_LIBKVM 1" >>confdefs.h LIBS="-lkvm $LIBS" fi elif test "$architecture" = "NetBSD" then ARCH="NETBSD" CFLAGS="$CFLAGS -D _REENTRANT -Wno-char-subscripts" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 printf %s "checking for kvm_open in -lkvm... " >&6; } if test ${ac_cv_lib_kvm_kvm_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kvm_open (); int main (void) { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kvm_kvm_open=yes else $as_nop ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 printf "%s\n" "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes then : printf "%s\n" "#define HAVE_LIBKVM 1" >>confdefs.h LIBS="-lkvm $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for backtrace in -lexecinfo" >&5 printf %s "checking for backtrace in -lexecinfo... " >&6; } if test ${ac_cv_lib_execinfo_backtrace+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lexecinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char backtrace (); int main (void) { return backtrace (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_execinfo_backtrace=yes else $as_nop ac_cv_lib_execinfo_backtrace=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_execinfo_backtrace" >&5 printf "%s\n" "$ac_cv_lib_execinfo_backtrace" >&6; } if test "x$ac_cv_lib_execinfo_backtrace" = xyes then : printf "%s\n" "#define HAVE_BACKTRACE 1" >>confdefs.h LIBS="-lexecinfo $LIBS" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: backtrace function not found in libexecinfo" >&5 printf "%s\n" "$as_me: WARNING: backtrace function not found in libexecinfo" >&2;} fi elif test "$architecture" = "DragonFly" then ARCH="DRAGONFLY" CFLAGS="$CFLAGS -D _REENTRANT" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 printf %s "checking for kvm_open in -lkvm... " >&6; } if test ${ac_cv_lib_kvm_kvm_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kvm_open (); int main (void) { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kvm_kvm_open=yes else $as_nop ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 printf "%s\n" "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes then : printf "%s\n" "#define HAVE_LIBKVM 1" >>confdefs.h LIBS="-lkvm $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for getnumdevs in -ldevstat" >&5 printf %s "checking for getnumdevs in -ldevstat... " >&6; } if test ${ac_cv_lib_devstat_getnumdevs+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldevstat $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char getnumdevs (); int main (void) { return getnumdevs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_devstat_getnumdevs=yes else $as_nop ac_cv_lib_devstat_getnumdevs=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devstat_getnumdevs" >&5 printf "%s\n" "$ac_cv_lib_devstat_getnumdevs" >&6; } if test "x$ac_cv_lib_devstat_getnumdevs" = xyes then : printf "%s\n" "#define HAVE_LIBDEVSTAT 1" >>confdefs.h LIBS="-ldevstat $LIBS" fi elif test "$architecture" = "Darwin" then ARCH="DARWIN" CFLAGS="$CFLAGS -DREENTRANT -no-cpp-precomp -DNEED_SOCKLEN_T_DEFINED" LDFLAGS="$LDFLAGS -Wl,-search_paths_first" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 printf %s "checking for kvm_open in -lkvm... " >&6; } if test ${ac_cv_lib_kvm_kvm_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char kvm_open (); int main (void) { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_kvm_kvm_open=yes else $as_nop ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 printf "%s\n" "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes then : printf "%s\n" "#define HAVE_LIBKVM 1" >>confdefs.h LIBS="-lkvm $LIBS" fi LIBS="$LIBS -framework System -framework CoreFoundation -framework DiskArbitration -framework IOKit" elif test "$architecture" = "AIX" then ARCH="AIX" CFLAGS=`echo $CFLAGS|sed 's/-g//g'` CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" LIBS="$LIBS -lodm -lperfstat -lm" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Architecture not supported: ${architecture}" >&5 printf "%s\n" "$as_me: WARNING: Architecture not supported: ${architecture}" >&2;} CFLAGS="$CFLAGS -D _REENTRANT" ARCH="UNKNOWN" fi # ------------------------------------------------------------------------ # Large files code # ------------------------------------------------------------------------ # Check if we want to have large files support { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for large files support" >&5 printf %s "checking for large files support... " >&6; } # Check whether --with-largefiles was given. if test ${with_largefiles+y} then : withval=$with_largefiles; if test "x$withval" = "xno" ; then with_largefiles=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test "x$withval" = "xyes" ; then with_largefiles=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi else $as_nop if test `uname` = "AIX" then with_largefiles=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } else with_largefiles=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi fi # Settings for largefiles support if test $with_largefiles -eq 1; then # Check whether --enable-largefile was given. if test ${enable_largefile+y} then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 printf %s "checking for special C compiler options needed for large files... " >&6; } if test ${ac_cv_sys_largefile_CC+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : break fi rm -f core conftest.err conftest.$ac_objext conftest.beam CC="$CC -n32" if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test ${ac_cv_sys_file_offset_bits+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } if test ${ac_cv_sys_large_files+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 printf "%s\n" "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h ;; esac rm -rf conftest* fi fi printf "%s\n" "#define HAVE_LARGEFILES 1" >>confdefs.h fi # ------------------------------------------------------------------------ # zlib Code # ------------------------------------------------------------------------ # Check whether --with-zlib was given. if test ${with_zlib+y} then : withval=$with_zlib; if test "x$withval" = "xyes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 printf %s "checking for zlibVersion in -lz... " >&6; } if test ${ac_cv_lib_z_zlibVersion+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char zlibVersion (); int main (void) { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_z_zlibVersion=yes else $as_nop ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 printf "%s\n" "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes then : printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h LIBS="-lz $LIBS" else $as_nop as_fn_error $? "libz not found" "$LINENO" 5 fi with_zlib=1 ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes then : printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h fi elif test "x$withval" != "xno"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib in $withval" >&5 printf %s "checking for zlib in $withval... " >&6; } LDFLAGS="-L$withval/lib -lz $LDFLAGS " CFLAGS="-I$withval/include $CFLAGS" if test -r "$withval/lib/libz.a" -a -r "$withval/include/zlib.h"; then with_zlib=1 printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } else with_zlib=0 as_fn_error $? "zlib not found in $withval" "$LINENO" 5 fi else with_zlib=0 fi else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 printf %s "checking for zlibVersion in -lz... " >&6; } if test ${ac_cv_lib_z_zlibVersion+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char zlibVersion (); int main (void) { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_z_zlibVersion=yes else $as_nop ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 printf "%s\n" "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes then : printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h LIBS="-lz $LIBS" else $as_nop as_fn_error $? "libz not found" "$LINENO" 5 fi with_zlib=1 ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes then : printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h fi fi # ------------------------------------------------------------------------ # PAM Code # ------------------------------------------------------------------------ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PAM support" >&5 printf %s "checking for PAM support... " >&6; } # Check whether --with-pam was given. if test ${with_pam+y} then : withval=$with_pam; if test "x$withval" = "xno" || test "x$with_pam" = "x0"; then with_pam=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } else with_pam=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi else $as_nop # Note inverse test. On by default with_pam=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi if test $with_pam -eq 1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5 printf %s "checking for pam_start in -lpam... " >&6; } if test ${ac_cv_lib_pam_pam_start+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpam $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pam_start (); int main (void) { return pam_start (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_pam_pam_start=yes else $as_nop ac_cv_lib_pam_pam_start=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5 printf "%s\n" "$ac_cv_lib_pam_pam_start" >&6; } if test "x$ac_cv_lib_pam_pam_start" = xyes then : printf "%s\n" "#define HAVE_LIBPAM 1" >>confdefs.h LIBS="-lpam $LIBS" else $as_nop as_fn_error $? "PAM enabled but headers or library not found, install the PAM development support or run configure --without-pam" "$LINENO" 5 fi fi # ------------------------------------------------------------------------ # AddressSanitizer # ------------------------------------------------------------------------ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AddressSanitizer support" >&5 printf %s "checking for AddressSanitizer support... " >&6; } # Check whether --with-asan was given. if test ${with_asan+y} then : withval=$with_asan; if test "x$withval" = "xno" ; then with_asan=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test "x$withval" = "xyes" ; then with_asan=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi else $as_nop with_asan=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test $with_asan -eq 1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=address" >&5 printf %s "checking whether C compiler accepts -fsanitize=address... " >&6; } if test ${ax_cv_check_cflags___fsanitize_address+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=address" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_address=yes else $as_nop ax_cv_check_cflags___fsanitize_address=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_address" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_address" >&6; } if test "x$ax_cv_check_cflags___fsanitize_address" = xyes then : CFLAGS="$CFLAGS -fsanitize=address" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-omit-frame-pointer" >&5 printf %s "checking whether C compiler accepts -fno-omit-frame-pointer... " >&6; } if test ${ax_cv_check_cflags___fno_omit_frame_pointer+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fno-omit-frame-pointer" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fno_omit_frame_pointer=yes else $as_nop ax_cv_check_cflags___fno_omit_frame_pointer=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fno_omit_frame_pointer" >&5 printf "%s\n" "$ax_cv_check_cflags___fno_omit_frame_pointer" >&6; } if test "x$ax_cv_check_cflags___fno_omit_frame_pointer" = xyes then : CFLAGS="$CFLAGS -fno-omit-frame-pointer" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=bool" >&5 printf %s "checking whether C compiler accepts -fsanitize=bool... " >&6; } if test ${ax_cv_check_cflags___fsanitize_bool+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=bool" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_bool=yes else $as_nop ax_cv_check_cflags___fsanitize_bool=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_bool" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_bool" >&6; } if test "x$ax_cv_check_cflags___fsanitize_bool" = xyes then : CFLAGS="$CFLAGS -fsanitize=bool" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=enum" >&5 printf %s "checking whether C compiler accepts -fsanitize=enum... " >&6; } if test ${ax_cv_check_cflags___fsanitize_enum+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=enum" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_enum=yes else $as_nop ax_cv_check_cflags___fsanitize_enum=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_enum" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_enum" >&6; } if test "x$ax_cv_check_cflags___fsanitize_enum" = xyes then : CFLAGS="$CFLAGS -fsanitize=enum" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=float-divide-by-zero" >&5 printf %s "checking whether C compiler accepts -fsanitize=float-divide-by-zero... " >&6; } if test ${ax_cv_check_cflags___fsanitize_float_divide_by_zero+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_float_divide_by_zero=yes else $as_nop ax_cv_check_cflags___fsanitize_float_divide_by_zero=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_float_divide_by_zero" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_float_divide_by_zero" >&6; } if test "x$ax_cv_check_cflags___fsanitize_float_divide_by_zero" = xyes then : CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize-address-use-after-scope" >&5 printf %s "checking whether C compiler accepts -fsanitize-address-use-after-scope... " >&6; } if test ${ax_cv_check_cflags___fsanitize_address_use_after_scope+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize-address-use-after-scope" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_address_use_after_scope=yes else $as_nop ax_cv_check_cflags___fsanitize_address_use_after_scope=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_address_use_after_scope" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_address_use_after_scope" >&6; } if test "x$ax_cv_check_cflags___fsanitize_address_use_after_scope" = xyes then : CFLAGS="$CFLAGS -fsanitize-address-use-after-scope" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=signed-integer-overflow" >&5 printf %s "checking whether C compiler accepts -fsanitize=signed-integer-overflow... " >&6; } if test ${ax_cv_check_cflags___fsanitize_signed_integer_overflow+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_signed_integer_overflow=yes else $as_nop ax_cv_check_cflags___fsanitize_signed_integer_overflow=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_signed_integer_overflow" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_signed_integer_overflow" >&6; } if test "x$ax_cv_check_cflags___fsanitize_signed_integer_overflow" = xyes then : CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=vla-bound" >&5 printf %s "checking whether C compiler accepts -fsanitize=vla-bound... " >&6; } if test ${ax_cv_check_cflags___fsanitize_vla_bound+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=vla-bound" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_vla_bound=yes else $as_nop ax_cv_check_cflags___fsanitize_vla_bound=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_vla_bound" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_vla_bound" >&6; } if test "x$ax_cv_check_cflags___fsanitize_vla_bound" = xyes then : CFLAGS="$CFLAGS -fsanitize=vla-bound" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=bounds-strict" >&5 printf %s "checking whether C compiler accepts -fsanitize=bounds-strict... " >&6; } if test ${ax_cv_check_cflags___fsanitize_bounds_strict+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=bounds-strict" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_bounds_strict=yes else $as_nop ax_cv_check_cflags___fsanitize_bounds_strict=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_bounds_strict" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_bounds_strict" >&6; } if test "x$ax_cv_check_cflags___fsanitize_bounds_strict" = xyes then : CFLAGS="$CFLAGS -fsanitize=bounds-strict" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=null" >&5 printf %s "checking whether C compiler accepts -fsanitize=null... " >&6; } if test ${ax_cv_check_cflags___fsanitize_null+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_null=yes else $as_nop ax_cv_check_cflags___fsanitize_null=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_null" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_null" >&6; } if test "x$ax_cv_check_cflags___fsanitize_null" = xyes then : CFLAGS="$CFLAGS -fsanitize=null " else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=object-size" >&5 printf %s "checking whether C compiler accepts -fsanitize=object-size... " >&6; } if test ${ax_cv_check_cflags___fsanitize_object_size+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=object-size" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_object_size=yes else $as_nop ax_cv_check_cflags___fsanitize_object_size=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_object_size" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_object_size" >&6; } if test "x$ax_cv_check_cflags___fsanitize_object_size" = xyes then : CFLAGS="$CFLAGS -fsanitize=object-size" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=undefined" >&5 printf %s "checking whether C compiler accepts -fsanitize=undefined... " >&6; } if test ${ax_cv_check_cflags___fsanitize_undefined+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fsanitize=undefined" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___fsanitize_undefined=yes else $as_nop ax_cv_check_cflags___fsanitize_undefined=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_undefined" >&5 printf "%s\n" "$ax_cv_check_cflags___fsanitize_undefined" >&6; } if test "x$ax_cv_check_cflags___fsanitize_undefined" = xyes then : CFLAGS="$CFLAGS -fsanitize=undefined" else $as_nop : fi printf "%s\n" "#define HAVE_ASAN 1" >>confdefs.h fi # ------------------------------------------------------------------------ # SSL Code # ------------------------------------------------------------------------ # Check for ssl includes checksslincldir() { : if test -f "$1/openssl/ssl.h"; then sslincldir="$1" return 0 fi return 1 } # Check for ssl libraries checkssllibdirdynamic() { : CRYPTOLIB=`ls -1 $1/libcrypto.so* $1/libcrypto.dylib* 2>/dev/null | wc -l` SSLLIB=`ls -1 $1/libssl.so* $1/libssl.dylib* 2>/dev/null | wc -l` if test "(" $CRYPTOLIB -gt 0 -a $SSLLIB -gt 0 ")" then ssllibdir="$1" return 0 fi return 1 } checkssllibdirstatic() { : if test "(" -f "$1/libcrypto.a" ")" -a \ "(" -f "$1/libssl.a" ")" ; then ssllibdir="$1" return 0 fi return 1 } # Check if we want to have SSL { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static SSL support" >&5 printf %s "checking for static SSL support... " >&6; } # Check whether --with-ssl-static was given. if test ${with_ssl_static+y} then : withval=$with_ssl_static; for dir in "$withval" "$withval/include"; do checksslincldir "$dir" done for dir in "$withval" "$withval/lib"; do checkssllibdirstatic "$dir" && break done with_sslstatic=1 LDFLAGS="`echo $LDFLAGS | sed -e 's/-rdynamic/-ldl/g'`" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } printf "%s\n" "#define HAVE_OPENSSL 1" >>confdefs.h CFLAGS="$CFLAGS -I$sslincldir" LIBS="$LIBS $ssllibdir/libssl.a $ssllibdir/libcrypto.a" if test `uname` = "Linux" && test `uname -m` = "aarch64"; then LIBS="$LIBS -ldl" fi else $as_nop with_sslstatic=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test $with_sslstatic -eq 0 then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL support" >&5 printf %s "checking for SSL support... " >&6; } # Check whether --with-ssl was given. if test ${with_ssl+y} then : withval=$with_ssl; if test "x$withval" = "xno" ; then with_ssl=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 printf "%s\n" "disabled" >&6; } fi if test "x$withval" = "xyes" ; then with_ssl=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi else $as_nop # Note inverse test. On by default with_ssl=1 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 printf "%s\n" "enabled" >&6; } fi # Check for SSL directory if test $with_ssl -eq 1; then # Check whether --with-ssl-dir was given. if test ${with_ssl_dir+y} then : withval=$with_ssl_dir; for dir in "$withval" "$withval/include"; do checksslincldir "$dir" done for dir in "$withval" "$withval/lib"; do checkssllibdirdynamic "$dir" && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL include directory" >&5 printf %s "checking for SSL include directory... " >&6; } # Check whether --with-ssl-incl-dir was given. if test ${with_ssl_incl_dir+y} then : withval=$with_ssl_incl_dir; checksslincldir "$withval" else $as_nop if test -z "$sslincldir"; then for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw /opt/freeware; do for dir in "$maindir/include"\ "$maindir/include/openssl"\ "$maindir/include/ssl"\ "$maindir/ssl/include"; do checksslincldir $dir && break 2 done done fi fi if test -z "$sslincldir"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 printf "%s\n" "Not found" >&6; } echo echo "Couldn't find your SSL header files." echo "Use --with-ssl-incl-dir option to fix this problem or disable" echo "the SSL support with --without-ssl" echo exit 1 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sslincldir" >&5 printf "%s\n" "$sslincldir" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL library directory" >&5 printf %s "checking for SSL library directory... " >&6; } # Check whether --with-ssl-lib-dir was given. if test ${with_ssl_lib_dir+y} then : withval=$with_ssl_lib_dir; checkssllibdirdynamic "$withval" else $as_nop if test -z "$ssllibdir"; then for maindir in "" \ /usr \ /usr/local \ /usr/pkg \ /var \ /opt \ /usr/sfw \ /opt/csw \ /opt/freeware; do for dir in $maindir \ $maindir/openssl \ $maindir/ssl \ $maindir/lib \ $maindir/lib/openssl \ $maindir/lib/ssl \ $maindir/ssl/lib \ $maindir/lib/64 \ $maindir/lib/64/openssl \ $maindir/lib/64/ssl \ $maindir/ssl/lib/64 \ $maindir/lib64 \ $maindir/lib64/openssl \ $maindir/lib64/ssl \ $maindir/ssl/lib64 \ $maindir/lib/${host} \ $maindir/lib/${host_alias}; do checkssllibdirdynamic $dir && break 2 done done fi fi if test -z "$ssllibdir"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 printf "%s\n" "Not found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 printf %s "checking for SSL_new in -lssl... " >&6; } if test ${ac_cv_lib_ssl_SSL_new+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lssl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char SSL_new (); int main (void) { return SSL_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_ssl_SSL_new=yes else $as_nop ac_cv_lib_ssl_SSL_new=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5 printf "%s\n" "$ac_cv_lib_ssl_SSL_new" >&6; } if test "x$ac_cv_lib_ssl_SSL_new" = xyes then : printf "%s\n" "#define HAVE_LIBSSL 1" >>confdefs.h LIBS="-lssl $LIBS" else $as_nop as_fn_error $? "Could not find SSL library, please use --with-ssl-lib-dir option or disabled the SSL support using --without-ssl" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_new_ex_data in -lcrypto" >&5 printf %s "checking for CRYPTO_new_ex_data in -lcrypto... " >&6; } if test ${ac_cv_lib_crypto_CRYPTO_new_ex_data+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char CRYPTO_new_ex_data (); int main (void) { return CRYPTO_new_ex_data (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_crypto_CRYPTO_new_ex_data=yes else $as_nop ac_cv_lib_crypto_CRYPTO_new_ex_data=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_new_ex_data" >&5 printf "%s\n" "$ac_cv_lib_crypto_CRYPTO_new_ex_data" >&6; } if test "x$ac_cv_lib_crypto_CRYPTO_new_ex_data" = xyes then : printf "%s\n" "#define HAVE_LIBCRYPTO 1" >>confdefs.h LIBS="-lcrypto $LIBS" else $as_nop as_fn_error $? "Could not find SSL library, please use --with-ssl-lib-dir option or disabled the SSL support using --without-ssl" "$LINENO" 5 fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ssllibdir" >&5 printf "%s\n" "$ssllibdir" >&6; } fi printf "%s\n" "#define HAVE_OPENSSL 1" >>confdefs.h fi # Add SSL includes and libraries if test "$sslincldir" -a "$ssllibdir" then if test "x$ARCH" = "xDARWIN"; then # Darwin already knows about ssldirs LIBS="$LIBS -lssl -lcrypto" elif test -f "/usr/kerberos/include/krb5.h"; then # Redhat 9 compilation fix: CFLAGS="$CFLAGS -I$sslincldir -I/usr/kerberos/include" LIBS="$LIBS -L$ssllibdir -lssl -lcrypto" else CFLAGS="$CFLAGS -I$sslincldir" LIBS="$LIBS -L$ssllibdir -lssl -lcrypto" fi fi fi # Check TLS version if test $with_sslstatic -eq 1 || test $with_ssl -eq 1; then if test "x$sslincldir" != "x"; then CFLAGS="$CFLAGS -I$sslincldir" fi if test "x$ssllibdir" != "x"; then LIBS="$LIBS -L$ssllibdir" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSLv2" >&5 printf %s "checking for SSLv2... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { SSLv2_client_method() ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : sslv2=yes else $as_nop sslv2=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sslv2" >&5 printf "%s\n" "$sslv2" >&6; } if test "$sslv2" = "yes" ; then printf "%s\n" "#define HAVE_SSLV2 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" # This test program should *not* compile successfully. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { (void) strchr; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the # off chance that they somehow elicit warnings. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include extern void ac_decl (int, char *); int main (void) { (void) ac_decl (0, (char *) 0); (void) ac_decl; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' else $as_nop ac_cv_c_undeclared_builtin_options=$ac_arg fi break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins See \`config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; esac ac_fn_check_decl "$LINENO" "SSL_OP_NO_TLSv1_1" "ac_cv_have_decl_SSL_OP_NO_TLSv1_1" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_SSL_OP_NO_TLSv1_1" = xyes then : printf "%s\n" "#define HAVE_TLSV1_1 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "SSL_OP_NO_TLSv1_2" "ac_cv_have_decl_SSL_OP_NO_TLSv1_2" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_SSL_OP_NO_TLSv1_2" = xyes then : printf "%s\n" "#define HAVE_TLSV1_2 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "SSL_OP_NO_TLSv1_3" "ac_cv_have_decl_SSL_OP_NO_TLSv1_3" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_SSL_OP_NO_TLSv1_3" = xyes then : printf "%s\n" "#define HAVE_TLSV1_3 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EC_KEY support" >&5 printf %s "checking for EC_KEY support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { EC_KEY_new_by_curve_name(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ec=yes else $as_nop ec=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ec" >&5 printf "%s\n" "$ec" >&6; } if test "$ec" = "yes" ; then printf "%s\n" "#define HAVE_EC_KEY 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ASN1_TIME_diff support" >&5 printf %s "checking for ASN1_TIME_diff support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { ASN1_TIME_diff(0, 0, 0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : asn1timediff=yes else $as_nop asn1timediff=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $asn1timediff" >&5 printf "%s\n" "$asn1timediff" >&6; } if test "$asn1timediff" = "yes" ; then printf "%s\n" "#define HAVE_ASN1_TIME_DIFF 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set_keylog_callback support" >&5 printf %s "checking for SSL_CTX_set_keylog_callback support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { SSL_CTX_set_keylog_callback(0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : sslkeylogfile=yes else $as_nop sslkeylogfile=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sslkeylogfile" >&5 printf "%s\n" "$sslkeylogfile" >&6; } if test "$sslkeylogfile" = "yes" ; then printf "%s\n" "#define HAVE_SSL_CTX_SET_KEYLOG_CALLBACK 1" >>confdefs.h fi fi # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- # Check whether --enable-optimized was given. if test ${enable_optimized+y} then : enableval=$enable_optimized; CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g[^ ]*//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -O3 -DNDEBUG" enable_optimized=1 else enable_optimized=0 fi else $as_nop enable_optimized=0 fi # Check whether --enable-werror was given. if test ${enable_werror+y} then : enableval=$enable_werror; enable_werror="$enableval" else $as_nop enable_werror=no fi if test "x$enable_werror" = "xyes" then : CFLAGS="$CFLAGS -Werror" fi # Check whether --enable-profiling was given. if test ${enable_profiling+y} then : enableval=$enable_profiling; if test "x$enableval" = "xyes" ; then CFLAGS=`echo $CFLAGS|sed 's/-g.//g'` CFLAGS=`echo $CFLAGS|sed 's/-O.//g'` CFLAGS="$CFLAGS -g -pg -fprofile-arcs -ftest-coverage" enable_profile=1 else enable_profile=0 fi else $as_nop enable_profile=0 fi # Check whether --enable-codesign was given. if test ${enable_codesign+y} then : enableval=$enable_codesign; if test "x$enableval" = "xno" ; then enable_codesign=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for validity of signing identity" >&5 printf %s "checking for validity of signing identity... " >&6; } if test "x$enableval" = "xyes"; then as_fn_error $? "Please provide a signing identity" "$LINENO" 5 else if test -n "$(security find-identity -v|grep $enableval)"; then enable_codesign=1 CODESIGN_IDENTITY=$enableval { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else as_fn_error $? "Signing identity not found" "$LINENO" 5 fi fi fi else $as_nop enable_codesign=0 fi if test $enable_codesign -eq 1; then WITH_CODESIGN_TRUE= WITH_CODESIGN_FALSE='#' else WITH_CODESIGN_TRUE='#' WITH_CODESIGN_FALSE= fi # Determine the minimum macOS version we can build if [ $(uname) == "Darwin" ]; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for minimum macOS version supported" >&5 printf %s "checking for minimum macOS version supported... " >&6; } # Create a simple C program echo "int main() { return 0; }" > t.c # Try to compile it with the specified macOS version $CC -mmacosx-version-min=10.15 -o t t.c || as_fn_error $? "Could not compile test program" "$LINENO" 5 # Extract the minos value using otool min_macos_version=$(otool -l t | awk '/minos/{print $2}') # Clean up the test files rm -f t.c t # Check if min_macos_version is set if test -z "$min_macos_version"; then as_fn_error $? "Could not determine minimum macOS version" "$LINENO" 5 else # Set CFLAGS with the determined minimum macOS version CFLAGS="$CFLAGS -mmacosx-version-min=$min_macos_version" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $min_macos_version" >&5 printf "%s\n" "$min_macos_version" >&6; } fi fi # ------------------------------------------------------------------------ # Outputs # ------------------------------------------------------------------------ ac_config_headers="$ac_config_headers src/config.h" ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files system/startup/monit.upstart" ac_config_files="$ac_config_files system/startup/monit.service" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `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" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= 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 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 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 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 fi if test -z "${WITH_CODESIGN_TRUE}" && test -z "${WITH_CODESIGN_FALSE}"; then as_fn_error $? "conditional \"WITH_CODESIGN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # 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 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$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_nop 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_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$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 || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by monit $as_me 5.35.2, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ monit config.status 5.35.2 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "libtool_patch") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool_patch" ;; "monitrc") CONFIG_COMMANDS="$CONFIG_COMMANDS monitrc" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "system/startup/monit.upstart") CONFIG_FILES="$CONFIG_FILES system/startup/monit.upstart" ;; "system/startup/monit.service") CONFIG_FILES="$CONFIG_FILES system/startup/monit.service" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$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 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "libtool_patch":C) test `uname` = "OpenBSD" && perl -p -i -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool ;; "monitrc":C) chmod 600 monitrc ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Whether or not to build static libraries. build_old_libs=$enable_static # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 printf "%s\n" "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 printf "%s\n" "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo echo "Monit Build Information:" echo echo " Architecture: ${ARCH}" if test $with_sslstatic -eq 1 || test $with_ssl -eq 1; then echo " SSL include directory: ${sslincldir}" echo " SSL library directory: ${ssllibdir}" fi echo " Compiler flags: ${CFLAGS}" echo " Linker flags: ${LIBS}" echo " pid file location: ${piddir}" echo " Install directory: ${prefix}" echo cat < Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. 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 them 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. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . License Exception In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. monit-5.35.2/doc/0000755000016400001720000000000015007061177010501 500000000000000monit-5.35.2/doc/monit.pod0000644000016400001720000044332315007061157012262 00000000000000# The right margin in this file is 72 characters. =head1 NAME Monit - utility for monitoring services on a Unix system =head1 SYNOPSIS B [options] =head1 DESCRIPTION B is a utility for managing and monitoring processes, programs, files, directories and filesystems on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You can use Monit to monitor files, directories and filesystems for changes, such as timestamps changes, checksum changes or size changes. Monit is controlled via an easy to configure control file based on a free-format, token-oriented syntax. Monit logs to syslog or to its own log file and notifies you about error conditions via customisable alert messages. Monit can perform various TCP/IP network checks, protocol checks and can utilise SSL for such checks. Monit provides a HTTP(S) interface and you may use a browser to access the Monit program. =head1 WHAT TO MONITOR? You can use Monit to monitor daemon B or similar programs running on localhost. Monit is particularly useful for monitoring daemon processes, such as those started at system boot time. For instance sendmail, sshd, apache and mysql. In contrast to many other monitoring systems, Monit can act if an error situation should occur, e.g.; if sendmail is not running, monit can start sendmail again automatically or if apache is using too many resources (e.g. if a DoS attack is in progress) Monit can stop or restart apache and send you an alert message. Monit can also monitor process characteristics, such as how much memory or cpu cycles a process is using. You can also use Monit to monitor B, B and B on localhost. Monit can monitor these items for changes, such as timestamps changes, checksum changes or size changes. This is also useful for security reasons - you can monitor the md5 or sha1 checksum of files that should not change and get an alert or perform an action if they should change. Monit can monitor B to various servers, either on localhost or on remote hosts. TCP, UDP and Unix Domain Sockets are supported. Network test can be performed on a protocol level; Monit has built-in tests for the main Internet protocols, such as HTTP, SMTP etc. Even if a protocol is not supported you can still test the server because you can configure Monit to send any data and test the response from the server. Monit can be used to test B or scripts at certain times, much like cron, but in addition, you can test the exit value of a program and perform an action or send an alert if the exit value indicates an error. This means that you can use Monit to perform any type of check you can write a script for. Finally, Monit can be used to monitor general B resources on localhost such as overall CPU usage, Memory and System Load. =head1 GENERAL OPERATION The behaviour of Monit is controlled by command-line options I a run control file, L, the syntax of which we describe in a later section. Command-line options override F<.monitrc> declarations. The default location for F is F<~/.monitrc>. If this file does not exist, Monit will try I and a few other places. See L for details. You can also specify the control file directly by using the I<-c> command-line switch to monit. For instance, $ monit -c /var/monit/monitrc Before Monit is started the first time, you can test the control file for syntax errors: $ monit -t $ Control file syntax OK If there was an error, Monit will print an error message to the console, including the line number in the control file from where the error was found. Once you have a working Monit control file, simply start Monit from the console, like so: $ monit You can change some configuration directives via command-line switches, but for simplicity it is recommended that you put these in the control file. Monit will detach from the terminal and run as a background process, i.e. as a daemon process. As a daemon, Monit runs in cycles; It monitor services, then goes to sleep for a configured period, then wakes up and start monitoring again in an endless loop. =head2 Options The following options are recognized by Monit. However, it is recommended that you set options (when applicable) directly in the I<.monitrc> control file. B<-c> I Use this control file B<-d> I Run Monit as a daemon once per I seconds. Or use I<"set daemon"> in monitrc. B<-g> I Set group name for start, stop, restart, monitor, unmonitor, status and summary action. B<-l> I Print log information to this file. Or use I<"set log"> in monitrc. B<-p> I Use this lock file in daemon mode. Or use I<"set pidfile"> in monitrc. B<-s> I Write state information to this file. Or use I<"set statefile"> in monitrc. B<-B> Batch command line mode (no tabular output and no colors). Or use I<"set terminal batch"> in monitrc. B<-I> Do not run in background mode (needed to run from init). Or use I<"set init"> in monitrc. B<-i> Print Monit's unique ID B<-r> Reset Monit's unique ID. Use with caution B<-t> Run syntax check for the control file B<-v> Verbose mode, work noisy (diagnostic output) B<-vv> Very verbose mode, same as -v plus log stack-trace on error B<-H> I<[filename]> Print MD5 and SHA1 hashes of the file or of stdin if the filename is omitted; Monit will exit afterwards B<-V> Print version number and patch level B<-h> Print a help text =head2 Arguments Once you have Monit running as a daemon process, you can call Monit with one of the following arguments. Monit will then connect to the Monit daemon (on TCP port 127.0.0.1:2812 by default) and ask the Monit daemon to perform the requested action. In other words; calling monit without arguments starts the Monit daemon, and calling monit I arguments enables you to communicate with the Monit daemon process. =over 4 =item start all Start all services listed in the control file and enable monitoring for them. If the group option is set (I<-g>), only start and enable monitoring of services in the named group ("all" is not required in this case). =item start Start the named service and enable monitoring for it. The name is a service entry name from the monitrc file. You can use a regex pattern too (note that it is case insensitive). =item stop all Stop all services listed in the control file and disable their monitoring. If the group option is set, only stop and disable monitoring of the services in the named group ("all" is not required in this case). =item stop Stop the named service and disable its monitoring. The name is a service entry name from the monitrc file. You can use a regex pattern too (note that it is case insensitive). =item restart all Stop and start I services. If the group option is set, only restart the services in the named group ("all" is not required in this case). =item restart Restart the named service. The name is a service entry name from the monitrc file. You can use a regex pattern too (note that it is case insensitive). =item monitor all Enable monitoring of all services listed in the control file. If the group option is set, only start monitoring of services in the named group ("all" is not required in this case). =item monitor Enable monitoring of the named service. The name is a service entry name from the monitrc file. Monit will also enable monitoring of all services this service depends on. You can use a regex pattern too (note that it is case insensitive). =item unmonitor all Disable monitoring of all services listed in the control file. If the group option is set, only disable monitoring of services in the named group ("all" is not required in this case). =item unmonitor Disable monitoring of the named service. The name is a service entry name from the monitrc file. Monit will also disable monitoring of all services that depends on this service. You can use a regex pattern too (note that it is case insensitive). =item status [name|pattern] Print service status information. =item summary [name|pattern] Print a short status summary. =item report [up | down | initialising | unmonitored | total] Report services state. The output can easily be parsed by scripts. Without options, prints a short overview of the state of all services managed by Monit. The option, I prints the number of all services in this state, I likewise and so on. =item reload Reinitialise a running Monit daemon, the daemon will reread its configuration, close and reopen log files. =item quit Kill the Monit daemon process =item validate Check all services listed in the control file. This action is also the default behaviour when Monit runs in daemon mode. =item procmatch Allows for easy testing of pattern for process match check. The command takes regular expression as an argument and displays all running processes matching the pattern. =back =head1 THE MONIT CONTROL FILE Monit is configured and controlled via a control file called I. The default location for this file is ~/.monitrc. If this file does not exist, Monit will try /etc/monitrc, then @sysconfdir@/monitrc and finally ./monitrc. If you build Monit from source, the value of @sysconfdir@ can be given at configure time as ./configure --sysconfdir. For instance, using I<./configure --sysconfdir /var/monit/etc> will make Monit search for I in I To protect the security of your control file and passwords the control file must have read-write permissions I (u=xrw,g=,o=); Monit will complain and exit otherwise. When there is a conflict between the command-line arguments and the arguments in this file, the command-line arguments takes precedence. Monit uses its own Domain Specific Language (DSL); The control file consists of a series of service entries and global option statements. Comments begin with a C<'#'> and extend through the end of the line. Otherwise the file consists of a series of service entries or global option statements in a free-format, token-oriented syntax. You can use noise keywords like C<'if'>, C<'and'>, C<'with(in)'>, C<'has'>, C<'us(ing|e)'>, C<'on(ly)'>, C<'then'>, C<'for'>, C<'of'> anywhere in an entry to make it resemble English. They're ignored, but can make entries much easier to read at a glance. Keywords are case insensitive. There are three kinds of tokens: I, I (i.e. decimal digit sequences) and I. Strings can be either quoted or unquoted. A quoted string is bounded by double quotes and may contain whitespace (and quoted digits are treated as a string). An unquoted string is any whitespace-delimited token, containing characters and/or numbers. On a semantic level, the control file consists of three types of entries: =over 4 =item 1. Global set-statements A global set-statement starts with the keyword C and the item to configure. =item 2. Global include-statement The include statement consists of the keyword C and a glob string. This statement is used to include configure directives from separate files. =item 3. One or more service entry statements. =back =head2 Service checks Each service entry consists of the keywords C, followed by the service type. Each entry requires a B descriptive name, which may be freely chosen. This name is used by Monit to refer to the service internally and in all interactions with the user. The name is case insensitive. Currently, nine types of check statements are supported: =head3 Process CHECK PROCESS | MATCHING > is the absolute path to the program's pid-file. A pid-file is a file, containing a Process's unique ID. If the pid-file does not exist or does not contain the PID number of a running process, Monit will call the entry's start method if defined. is an alternative to using PID files and uses process name pattern matching to find the process to monitor. The top-most matching parent with highest uptime is selected, so this form of check is most useful if the process name is unique. Pid-file should be used where possible as it defines expected PID exactly. You can test if a process match a pattern from the command-line using C. This will lists all processes matching or not, the regex-pattern. =head3 File CHECK FILE PATH is the absolute path to the file. If the file does not exist, Monit will call the entry's start method if defined, if does not point to a regular file type (for instance a directory), Monit will disable monitoring of this entry. If Monit runs in passive mode or the start method is not defined, Monit will just send an alert on error. =head3 Fifo CHECK FIFO PATH is the absolute path to the fifo. If the fifo does not exist, Monit will call the entry's start method if defined, if does not point to a fifo type (for instance a directory), Monit will disable monitoring of this entry. If Monit runs in passive mode or the start method is not defined, Monit will just send an alert on error. =head3 Filesystem CHECK FILESYSTEM PATH is the path to the device/disk, mount point or NFS/CIFS/FUSE connection string. If the filesystem becomes unavailable, Monit will call the service's start method if defined. If Monit runs in passive mode or the start method is not defined, Monit will just send an alert on error. =head3 Directory CHECK DIRECTORY PATH is the absolute path to the directory. If the directory does not exist, Monit will call the entry's start method if defined. If does not point to a directory, monit will disable monitoring of this entry. If Monit runs in passive mode or the start methods is not defined, Monit will just send an alert on error. =head3 Remote host CHECK HOST ADDRESS The host address can be specified as a hostname string or as an IP-address string on a dotted decimal format. Such as, "tildeslash.com" or "64.87.72.95". =head3 System CHECK SYSTEM The I is usually the local host name, but any descriptive name can be used. If you use the variable $HOST as the name, it will expand to the hostname. This check allows one to monitor general system resources such as CPU usage, total memory usage or load average. The I is used as the system hostname in mail alerts and as the initial name of the host entry in M/Monit. =head3 Program CHECK PROGRAM PATH [TIMEOUT SECONDS] is the absolute path to the executable program or script. The L allows one to check the program's exit status. If the program does not finish executing within seconds, Monit will terminate it. The default program timeout is 300 seconds (5 minutes). The output of the program is recorded and made available in the User Interface and in alerts, by default up to 512 bytes. You can change the output limit using the L statement). =head3 Network CHECK NETWORK

| INTERFACE > is the IPv4 or IPv6 address of the monitored network interface. It is also possible to use interface name, such as "eth0" on Linux. =head1 LOGGING Monit will log status and error messages to a file or via syslog. Use the I statement in the monitrc control file. To setup Monit to log to its own file, use e.g. I. Note, the previous I statement is deprecated, but can alternatively be used. If B is given as a value for the C<-l> command-line switch or the keyword I is found in the control file, Monit will use the B system daemon to log messages with a priority assigned to each message based on the context. To turn off logging, simply do not set the log in the control file (and of course, do not use the -l switch) The format for an entry in the log file is: [date] priority : message for example: [2020-08-12T16:35:00+0200] info : 'localhost' Monit started =head1 TERMINAL OUTPUT Monit uses ANSI escape sequences to colorise important parts of the command-line output, if the terminal supports colors, and UTF-8 box characters for tabular output. If you want to process the monit CLI output in a script, you can use either the -B option or use the following statement in the monit configuration file to disable tabular output and colors completely: SET TERMINAL BATCH =head1 DAEMON MODE Use SET DAEMON [[WITH] START DELAY ] to specify Monit's poll cycle length and run Monit in daemon mode. You must specify a numeric argument which is a polling interval in seconds. In daemon mode, Monit detaches from the console, puts itself in the background and runs continuously, monitoring each specified service and then goes to sleep for the given poll interval, wakes up and start monitoring again in an endless cycle. Alternatively, you can use the C<-d> command line switch to set the poll interval, but it is strongly recommended to set the poll interval in your I<~/.monitrc> file, by using I. Monit will then always start in daemon mode. If you do not use this statement and do not start monit with the -d option, Monit will just run through the service checks once and then exit. This might be useful in some situations, but Monit is primarily designed to run as a daemon process. Calling C with a Monit daemon running in the background sends a wake-up signal to the daemon, forcing it to check services immediately. Calling C with the quit argument will kill a running Monit daemon process instead of waking it up. The start delay option can be used to wait (once) before Monit starts checking services after system reboot. Monit will by default start checking services immediately at startup. =head1 INIT SUPPORT The C statement prevents Monit from transforming itself into a daemon process. Instead Monit will run as a foreground process. (You should still use C to specify the poll cycle). This is required to run Monit from init. Using init to start Monit is probably the best way to run Monit if you want to be certain that you always have a running Monit daemon on your system. Another option is to run Monit from crontab. In any case, you should make sure that the control file does not have any syntax errors before you start Monit from init or crontab (use C to check). To setup Monit to run from init, you can either use the C statement in Monit's control file or use the C<-I> option from the command line. Here is what you must add to C: # Run Monit in standard run-levels mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc After you have modified init's configuration file, you can run the following command to re-examine /etc/inittab and start Monit: telinit q For systems without telinit: kill -1 1 If Monit is used to monitor services that are also started at boot time (e.g. services started via SYSV init rc scripts or via inittab) then, in some cases, a race condition could occur. That is; if a service is slow to start, Monit can assume that the service is not running and possibly try to start it and raise an alert, while, in fact the service is already about to start or already in its startup sequence. Please see the FAQ for a solution to this problem. The short version is to start Monit on a higher run-level after system processes. =head1 INCLUDE FILES The Monit control file, C, can include additional configuration files. This feature helps one to organise configuration into separate files instead of having everything in one file, if you like this kind of thing. Include statements can be placed at virtually any place in C though the convention is at the bottom. The syntax is the following: INCLUDE The globstring is any kind of string as defined in C. Thus, you can refer to a single file or you can load several files at once. If you want to use whitespace in your string the globstring needs to be embedded into quotes (') or double quotes ("). If the globstring matches a directory instead of a file, it is silently ignored. Any I statements in an included file are parsed as in the main control file. If the globstring matches several results, the files are included in a non sorted manner. If you need to rely on a certain order, you should avoid wild-card globbing and instead specify the full path of files included. An example, include /etc/monit.d/*.cfg This will load any file matching the globstring. That is, all files in I that ends with the prefix I<.cfg>. Up to 1024 include files are supported. If this limit is exceeded, Monit will report an error. =head1 SSL OPTIONS Common SSL/TLS options can be set using the following statement and will apply to all SSL connections made through Monit: SET [OPTIONS] { VERSION: , ... VERIFY: SELFSIGNED: CIPHERS: PEMFILE: PEMCHAIN: PEMKEY: CLIENTPEMFILE: CACERTIFICATEFILE: CACERTIFICATEPATH: } I set the specific SSL/TLS version to use. By default Monit uses AUTO. In AUTO mode, only TLS 1.2 and 1.3 are allowed, all other protocols are considered obsolete. If you want to use the obsolete protocol you must explicitly set the version. You can exclude the protocol using the "-" prefix. Exclude list example: set ssl { version: auto -sslv2 -sslv3 -tlsv1 -tlsv11 } Example of allowed protocols list: set ssl { version: tlsv12 tlsv13 } I enable SSL server certificate verification. This will verify and report an error if the server certificate is not trusted, not valid or has expired. By default certificate verification is disabled, though we recommend enabling it, otherwise there is no guarantee that Monit speaks with the server you think it speaks with. I self-signed certificates are rejected by default. Use this option to allow self-signed certificates. Warning: not recommended in production for security reasons, as in such case the client cannot verify it talks to the correct server and attack types like man-in-the-middle or DNS hijacking are possible). I override default SSL/TLS ciphers. I set the path to the SSL server certificate "database-file" in PEM format. This options has effect only for the monit HTTP interface. As an alternative to setting I with a combined chain-key file, I and I set the path to the SSL certificate chain respectively the server private key file in PEM format. This options has effect only for the monit HTTP interface. I set the path to the PEM encoded SSL client certificates database file. If set, a client certificate authentication is enabled. I set the path to the PEM encoded file containing Certificate Authority (CA) certificates. Monit uses OpenSSL's default CA certificates if this options is not used (I can be used to get the default CA certificates). Many distributions comes with SSL and CA certificates already setup and using this option is normally not necessary. I set the path to the directory containing Certificate Authority (CA) certificates. Monit uses OpenSSL's default CA certificates if this options is not used. Many distributions comes with SSL and CA certificates already setup and using this option is normally not necessary. The SSL options statement will globally apply to all SSL/TLS connection made through Monit. SSL options can also be set in a local check, in I settings or in the I statement, and will then override or extend the global settings. To set global SSL options, put this statement near the top of your I<.monitrc> file: set ssl options {...} Here is an example of setting both global and local SSL options: # Enable certificate verification for all SSL connections # Self-signed certificates are not allowed by default set ssl options { verify: enable } # Verify certificate (via global setting) # Allow self-signed certificate for this check check host example with address example.com if failed port 443 protocol https with ssl options {selfsigned: allow} then alert # Do not verify example2.com's certificate (override global setting) check host example2 with address example2.com if failed port 443 protocol https with ssl options {verify: disable} then alert =head1 FIPS MODE To enable FIPS mode (provided your OpenSSL library supports it), add this statement to Monit control file: SET FIPS =head1 MONIT HTTPD If specified in the control file, Monit will start with HTTP support. You can then use Monit CLI to start and stop services, disable or enable service monitoring as well as view the status of each service. If HTTP support is enabled over TCP rather than over a Unix Socket, you can also view Monit's informative dashboard in your web browser. Note that if HTTP support is disabled, the Monit CLI interface will have reduced functionality, as most CLI commands (such as "monit status") needs to communicate with the Monit background process via the HTTP interface. We strongly recommend having HTTP support enabled. If security is a concern, bind the HTTP interface to local host only or use Unix Socket so Monit is not accessible from the outside. =head2 UNIX SOCKET Syntax for Unix Socket: SET HTTPD UNIXSOCKET [UID ] [GID ] [PERMISSION ] ALLOW + Example: set httpd unixsocket /var/run/monit.sock allow username:password B set the path to the Unix Socket Monit should bind to and listen on. B Socket owner (optional, defaults to the user who executes Monit) B Socket group (optional, defaults to primary group of the user who executes Monit) B Socket permissions - absolute octal mode (optional, process UMASK is applied by default) =head2 TCP PORT Syntax for TCP port: SET HTTPD PORT [ADDRESS ] [[with] SSL {pemfile: }] ALLOW + B set the port Monit should bind to and listen on. Monit is usually setup on port 2812. Example: set httpd port 2812 allow username:password You can now use L to access Monit's web interface from a browser, after you have entered username and password as credentials. You might need to use double quotes around the password if it contains special chars such as "p@ssw:r#". B
make Monit listen on a specific interface only. For example if you I want to expose Monit's web interface to the network, bind it to localhost only. Monit will accept connections on any addresses if the ADDRESS option is not used: set httpd port 2812 use address 127.0.0.1 allow username:password Monit HTTP over TCP supports both IP version 4 and 6. Support is transparent and does not require any special configuration. If the bind I
is B specified as in this example: set httpd port 2812 allow ... Monit will bind to and listen on port 2812 on all interfaces, both IPv4 and IPv6 if available. To force Monit HTTP to only listen on and accept connections over IP version 6, specify an IPv6 address: set httpd port 2812 use address "fe80::222:19ff:fe53:6c59" allow ... Likewise, to force Monit HTTP to only listen on and accept connections over IP version 4, specify an IPv4 address: set httpd port 2812 use address 62.109.39.247 allow ... =head3 SSL settings B enable SSL/TLS for Monit's web interface. See L for full list of SSL options. I sets the path to the PEM encoded file, which contains the server's private key and certificate. This file should be stored in a safe place on the filesystem and should have strict permissions, no more than 0700. As an alternative I and I sets the path to separate PEM encoded certificate chain and private key file. The key file should be stored in a safe place on the filesystem and should have strict permissions, no more than 0700. Example for using pemfile: set httpd port 2812 with ssl { pemfile: /etc/ssl/certs/monit.pem } allow myuser:mypassword Example for using separate certificate chain and key: set httpd port 2812 with ssl { pemchain: /etc/ssl/certs/monit.chain.pem pemkey: /etc/ssl/certs/monit.key.pem } allow myuser:mypassword You can now use L to access the Monit web server over a TLS encrypted connection. Self-signed server certificates note: The Monit CLI works on a client-server basis and uses the Monit HTTP GUI to collect status from the Monit daemon and pass commands like start/stop to it. As self-signed certificates are rejected by default for security reasons, the CLI won't work unless you explicitly allow it by using the I option: set httpd port 2812 with ssl { pemfile: /etc/ssl/certs/monit.pem selfsigned: allow } allow myuser:mypassword B enables a client certificate based authentication and sets the path to a PEM encoded database file, that contains a list of allowed client certificates. A connecting client has to provide a certificate known to Monit (listed in I), otherwise it is rejected. This file must also include all necessary CA certificates. By default self-signed client certificates are B for security reasons, if you want to allow self-signed client certificates (recommended only for testing), you have to allow it explicitly using the B option (see the example above). See your browser's documentation for how to import client certificate to it. Example: set httpd port 2812 with SSL { pemfile: /etc/ssl/certs/monit.pem clientpemfile: /etc/ssl/certs/monit-client.pem } =head2 Monit version signature B can be used to hide Monit version from the HTTP response header and error pages. For example: set httpd port 2812 signature disable allow myuser:mypassword =head2 Authentication Access to the Monit web interface is controlled primarily via the B option which is used to specify authentication and authorise only specific clients to connect. If the Monit command line interface is being used, at least one cleartext password is necessary (see below), otherwise the Monit command line interface will not be able to connect to the Monit web interface. Clients that try to connect to Monit, but submit a wrong username and/or password are logged with their IP-address. =head3 Client certificates This authentication method is a strong authentication mechanism and employ HTTPS client certificates to verify the authenticity of a connecting client. Clients must posses a Public Key Certificate known by Monit. The client must connect to Monit over SSL and Monit will ask the client to send its certificate. Upon receiving the certificate Monit compares the certificate to certificates located in the I file. Access is granted if the client certificate is in this file. See L settings for details. =head3 Basic Authentication Monit supports Basic Authentication as described in RFC 2617. In short; a server challenge a client (e.g. a Browser) to send authentication information (username and password) and if accepted, the server will allow the client access to the requested document. The biggest weakness with Basic Authentication is that username and password is sent in clear-text over the network (i.e. base64 encoded). It is therefore recommended that you do not use this authentication method unless you run Monit with I support. With ssl, it is safe to use Basic Authentication since I HTTP data, including Basic Authentication headers will be encrypted. =head4 Cleartext user and password Monit will use Basic Authentication if an allow statement contains a username and a password separated with a single ':' character. Note: Special characters can be used, but for non-alphanumerics the password has to be quoted. Syntax: ALLOW : =head3 Host and network allow list Monit maintains an access-control list of hosts and networks allowed to connect. You can add as many hosts as you want to, but only hosts with a valid domain name or its IP address are allowed. Monit will query a name server to check any hosts trying to connect. If a host (client) is trying to connect, but cannot be found in the access list or cannot be resolved, Monit will shutdown the connection to the client promptly. Control file example: set httpd port 2812 allow localhost allow my.other.work.machine.com allow 10.1.1.1 allow 192.168.1.0/255.255.255.0 allow 10.0.0.0/8 Clients, not mentioned in the allow list and trying to connect to Monit will be denied access and are logged with their IP-address. =head4 PAM PAM is supported on platforms which provide PAM (such as Linux, macOS, FreeBSD, NetBSD). Syntax: ALLOW @ where C is the group name allowed to access Monit's web interface. Monit uses a PAM service called I for PAM authentication, see the PAM manual page for detailed instructions on how to set the PAM service and PAM authentication plugins. Sample PAM service for Monit on macOS (store as "/etc/pam.d/monit" file): # monit: auth account password session #auth sufficient pam_securityserver.so #auth sufficient pam_unix.so auth sufficient pam_opendirectory.so auth required pam_deny.so account required pam_permit.so password required pam_deny.so session required pam_permit.so And a similar PAM service for Monit on Linux (store as "/etc/pam.d/monit" file): # monit: auth account password session auth sufficient pam_unix2.so auth required pam_deny.so account required pam_permit.so password required pam_deny.so session required pam_permit.so A C config which only allows group C and C authenticated via PAM to access the web interface: set httpd port 2812 allow @admin allow @staff readonly =head4 htpasswd file Alternatively you store credentials in a C formatted file (one I entry per line), like so: I. The default is cleartext passwords. In case passwords are digested it is necessary to specify the cryptographic method. If you do not want all users in the password file to have access to Monit, you can specify only those users that should have access in the allow statement. Otherwise all users are added. Example1: set httpd port 2812 allow md5 /etc/httpd/htpasswd john paul ringo george If you use this method together with a host list, then only clients from the listed hosts will be allowed to connect to the Monit HTTP server and each client will be asked to provide a username and a password. Example2: set httpd port 2812 allow localhost allow 10.1.1.1 allow hauk:"passw@rd" If you only want to use Basic Authentication, then just provide allow entries with username and password or password files as in example 1 above. =head4 Read-only users Further it is possible to define some users as read-only. A read-only user can read the Monit web pages but will I get access to push-buttons and cannot change a service from the web interface. set httpd port 2812 allow admin:password allow hauk:password read-only allow @admins allow @users read-only A user is set to read-only by using the I keyword B username:password. In the above example the user I is defined as a read-only user, while the I user has all access rights. =head4 Read-only http server Finally is is possible to restrict the entire web interface as read-only. All users, regardless if defined with or without the I keyword, have only the permissions described above. When using this setting it is recommend to set up a B as well, otherwise the monit CLI will B work. set httpd port 2812 read-only unixsocket /run/monit.socket allow @users =head1 ALERT MESSAGES Monit will raise an alert in the following situations: o A service does not exist (e.g. process is not running) o Cannot read service data (e.g. cannot get filesystem usage) o Execution of a service related script failed (e.g. start failed) o Invalid service type (e.g. if path points to directory instead of file) o Custom test script returned error o Ping test failed o TCP/UDP connection and/or port test failed o Resource usage test failed (e.g. cpu usage too high) o Checksum mismatch or change (e.g. file changed) o File size test failed (e.g. file too large) o Timestamp test failed (e.g. file is older then expected) o Permission test failed (e.g. file mode doesn't match) o An UID test failed (e.g. file owned by different user) o A GID test failed (e.g. file owned by different group) o A process's PID changed out of Monit's control o A process's PPID changed out of Monit control o Too many service recovery attempts failed o A file content test found a match o Filesystem flags changed o A service action was performed by administrator o A network link down or up o A network link capacity changed o A network link saturation failed o A network link upload/download rate failed o Monit was started, stopped or reloaded To get an alert via e-mail, set the alert target using the global C statement (for all services) or the C statement in the context of a service entry (for a single service). =head2 Setting an alert recipient If an event occurs, Monit will send an alert. There are two kinds of alert statement: global and local. Global syntax: SET ALERT mail-address [[NOT] {event, ...}] [REMINDER cycles] Example: set alert foo@bar will send a default email to the address foo@bar whenever any event occurs on any service. If you want to send alert messages to more email addresses, add a C statement for each address. It is also possible to use the local alert statement in the context of a service check to enable alert for the given service only: ALERT mail-address [[NOT] {event, ...}] [REMINDER cycles] Local alert example: check host myhost with address 1.2.3.4 if failed port 3306 protocol mysql then alert if failed port 80 protocol http then alert alert foo@baz # Local service alert You can combine global and local alert statements. If there is a conflict, the local alert has precedence and overrides the global statement. =head3 Setting an event filter If you only want an alert message sent for certain events, list them in an C<{event, ...}> block, e.g.: set alert foo@bar only on { timeout, nonexist } The event list can also be negated to send alerts for all events I those which are listed, by prepending the list with the word C. For example, to receive all alerts except notification about Monit program start and stop: set alert foo@bar but not on { instance } Here is a list of all possible event types emitted by Monit. Values from the first column can be used in the event filter list mentioned above: Event: | Failure state: | Success state: --------------------------------------------------------------------- action | "Action failed" | "Action done" checksum | "Checksum failed" | "Checksum succeeded" bytein | "Download bytes exceeded" | "Download bytes ok" byteout | "Upload bytes exceeded" | "Upload bytes ok" connection | "Connection failed" | "Connection succeeded" content | "Content failed", | "Content succeeded" data | "Data access error" | "Data access succeeded" exec | "Execution failed" | "Execution succeeded" fsflags | "Filesystem flags failed" | "Filesystem flags succeeded" gid | "GID failed" | "GID succeeded" icmp | "Ping failed" | "Ping succeeded" instance | "Monit instance changed" | "Monit instance changed not" invalid | "Invalid type" | "Type succeeded" link | "Link down" | "Link up" nonexist | "Does not exist" | "Exists" packetin | "Download packets exceeded" | "Download packets ok" packetout | "Upload packets exceeded" | "Upload packets ok" permission | "Permission failed" | "Permission succeeded" pid | "PID failed" | "PID succeeded" ppid | "PPID failed" | "PPID succeeded" resource | "Resource limit matched" | "Resource limit succeeded" saturation | "Saturation exceeded" | "Saturation ok" size | "Size failed" | "Size succeeded" speed | "Speed failed" | "Speed ok" status | "Status failed" | "Status succeeded" timeout | "Timeout" | "Timeout recovery" timestamp | "Timestamp failed" | "Timestamp succeeded" uid | "UID failed" | "UID succeeded" uptime | "Uptime failed" | "Uptime succeeded" Each alert recipient can have it's own filter, for example: set alert foo@bar { nonexist, timeout, resource, icmp, connection } set alert security@bar on { checksum, permission, uid, gid } set alert admin@bar =head3 Setting an error reminder Monit by default sends just I notification if a service failed and another when/if it recovers. If you want to be notified that the service is still in a failed state, you can use the reminder option in the alert statement: SET ALERT mail-address [WITH] REMINDER [ON] number [CYCLES] For example if you want to be notified each tenth cycle if a service remains in a failed state, you can use: alert foo@bar with reminder on 10 cycles Likewise if you want to be notified on each failed cycle, you can use: alert foo@bar with reminder on 1 cycle =head2 Disabling alerts for some service To suppress alerts for some user and service, add the C statement in the context of a service check. NOALERT mail-address Example (send all alerts to foo@bar except for service p3): set alert foo@bar check process p1 with pidfile /var/run/p1.pid check process p2 with pidfile /var/run/p2.pid check process p3 with pidfile /var/run/p3.pid noalert foo@bar =head2 Message format The alert message format can be modified by using the C statement: SET MAIL-FORMAT {mail-format} Example: set mail-format { from: Monit Support reply-to: support@domain.com subject: $SERVICE $EVENT at $DATE message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. Yours sincerely, monit } The I option is the sender's email address for Monit alerts. A sender's name is optional, but if used, requires that the subsequent email-address is enclosed in angle brackets as in the example above. The I option can be used to set the reply-to mail header, optionally with a name. The I option sets the message subject and must be on only I line. The I option sets the mail body. This option should always be the last in a mail-format statement. The mail body can be as long as needed, but must I contain the block-closing '}' character. You need not use all options, only the option which you want to override. For example to globally change the sender address only: set mail-format { from: bofh@foo.bar } The subject and body may contain $NAME variables, which are expanded by Monit. Here is a list of variables that can be used when composing an alert message. =over 4 =item * I<$EVENT> A string describing the event that occurred. =item * I<$SERVICE> The service name =item * I<$DATE> The current time and date (RFC 822 date style). =item * I<$HOST> The name of the host Monit is running on =item * I<$ACTION> The name of the action which was done by Monit. =item * I<$DESCRIPTION> The description of the error condition =back =head2 Setting a mail server for alert delivery The mail server Monit should use to send alert messages is defined with a C statement: SET MAILSERVER [PORT number] [USERNAME string] [PASSWORD string] [using SSL [with options {...}] [CERTIFICATE CHECKSUM [MD5|SHA1] ], ... [with TIMEOUT X SECONDS] [using HOSTNAME hostname] Multiple mail servers can be set by using a comma separated list. If Monit cannot connect to the first server, it will try the next in the list and so on. The port statement allows one to override the default SMTP port (465 for SSL, or 25 for TLS and non secure connection). Monit supports AUTH PLAIN and AUTH LOGIN for SMTP authentication. You can set a username and a password using the USERNAME and PASSWORD options. You can set SSL/TLS L for the connection and also check a SSL certificate checksum. The default connection timeout is 30 seconds. You can change this limit using the TIMEOUT option. Example (setting two mail servers for failover): set mailserver smtp.gmail.com, smtp.other.host By default, Monit uses the local host name in SMTP HELO/EHLO and in the Message-ID header. You can override this using the HOSTNAME option. =head2 Event queue If no mail server is available, Monit I queue events in the local file-system for retry until the mail server recovers. If Monit is used with M/Monit, the event queue provides a safe event store for M/Monit in the case of temporary problems. The event queue is persistent across Monit restarts and provided that the back-end filesystem is persistent, across system restart as well. By default, the queue is disabled and if the alert handler fails, Monit will simply drop the alert message. To enable the event queue, add the following statement: SET EVENTQUEUE BASEDIR [SLOTS ] The is the path to the directory where events will be stored. Optionally if you want to limit the queue size, use the slots option to only store up to I event messages. Example: set eventqueue basedir /var/monit slots 5000 If you are running more then one Monit instance on the same machine, you B use separated event queue directories. =head1 SERVICE METHODS Each service can have associated I, I and I methods which Monit can use to execute action on the service. Syntax: [PROGRAM] = "program" [[AS] UID ] [[AS] GID ] [[WITH] TIMEOUT SECOND(S)] If the C is a shell script it must begin with C<#!> and the remainder of the first line must specify an interpreter for the program. e.g. C<#!/bin/sh> The C must also be executable (for example mode 0755). It's possible to write scripts directly into the I this way: stop = "/bin/sh -c 'kill -s SIGTERM `cat /var/run/process.pid`'" By default the program is executed as the user under which Monit is running. If Monit is running as root, you may optionally specify the I and I the executed program should switch to. Example: check process mmonit with pidfile /usr/local/mmonit/mmonit/logs/mmonit.pid start program = "/usr/local/mmonit/bin/mmonit" as uid "mmonit" and gid "mmonit" stop program = "/usr/local/mmonit/bin/mmonit stop" as uid "mmonit" and gid "mmonit" In the case of a process check, Monit will wait up to 30 seconds for the start/stop action to finish before giving up and report an error. You can override this timeout using the I option or globally using the L. Example: check process foobar with pidfile /var/run/foobar.pid start program = "/etc/init.d/foobar start" with timeout 60 seconds stop program = "/etc/init.d/foobar stop" =head1 SERVICE POLL TIME Services are checked regularly in an interval defined by the C statement. Checks are performed in the same order as they are written in the C<.monitrc> file, except if dependencies are setup between services, where pre-requisite services are tested first. It is possible to modify a service check schedule by using the C statement. There are three variants: =over 4 =item 1. A poll cycle multiple EVERY [number] CYCLES =item 2. Cron-style EVERY [cron] =item 3. Negative Cron-style (do-not-check) NOT EVERY [cron] =back A cron-style string consist of 5 fields separated with white-space. All fields are required: Name: | Allowed values: | Special characters: --------------------------------------------------------------- Minutes | 0-59 | * - , Hours | 0-23 | * - , Day of month | 1-31 | * - , Month | 1-12 (1=jan, 12=dec) | * - , Day of week | 0-6 (0=sunday, 6=saturday) | * - , The special characters: Character: | Description: --------------------------------------------------------------- * (asterisk) | The asterisk indicates that the expression will | match for all values of the field; e.g., using | an asterisk in the 4th field (month) would | indicate every month. - (hyphen) | Hyphens are used to define ranges. For example, | 8-9 in the hour field indicate between 8AM and | 9AM. Note that range is from start time until and | including end time. That is, from 8AM and until | 10AM unless minutes are set. Another example, | 1-5 in the weekday field, specify from monday to | friday (including friday). , (comma) | Comma are used to specify a sequence. For example | 17,18 in the day field indicate the 17th and 18th | day of the month. A sequence can also include | ranges. For example, using 1-5,0 in the weekday | field indicate monday to friday and sunday. Example 1: Check once per two cycles check process nginx with pidfile /var/run/nginx.pid every 2 cycles Example 2: Check every workday between 8AM to 7PM check program checkOracleDatabase with path /var/monit/programs/checkoracle.pl every "* 8-19 * * 1-5" Example 3: Do not run the check in the backup window on Sunday between 0AM to 3AM, otherwise run the check with the regular poll cycle frequency. check process mysqld with pidfile /var/run/mysqld.pid not every "* 0-3 * * 0" Limitations: The current scheduler is poll cycle based. If a service check is scheduled with the I statement, Monit will check if the current time match the cron-string pattern. If it does, then the check is performed otherwise it is skipped. The cron specification does not guarantee when exactly the test will run, this depends on the default poll time and the length of the check cycle. In other words, we cannot guarantee that Monit will run on a specific time. Therefore we B recommend to use an asterix in the minute field or at minimum a range, e..g. 0-15. B use a specific minute as Monit may not run on that minute. We will address this limitation in a future release and convert the scheduler from serial polling into a parallel non-blocking scheduler where checks are guaranteed to run on time and with seconds resolution. =head1 SERVICE GROUPS Service entries in the control file, I, can be grouped together by the I statement. The syntax is simply (keyword in capital): GROUP groupname With this statement it is possible to group similar service entries together and manage them as a whole. Monit provides functions to start, stop, restart, monitor and unmonitor a group of services, like so: To start a group of services from the console: monit -g start To stop a group of services: monit -g stop To restart a group of services: monit -g restart A service can be added to multiple groups by using more than one group statement: group www group filesystem =head1 SERVICE MONITORING MODE Monit supports two monitoring modes: I and I. Syntax: MODE In I mode, Monit will pro-actively monitor a service and in case of problems raise alerts and restart the service. Active is the default mode. The I mode is similar to the I mode, except if the service fails, monit will B try to fix a problem by restarting the service and will raise alerts only. =head1 SYSTEM REBOOT AND SERVICE STARTUP Monit supports three reboot modes: I, I and I. Syntax: ONREBOOT In I mode, Monit will always start the service automatically on reboot, even if it was stopped before restart. This is the default mode and used if I is not specified. In I mode, the service is I started automatically after reboot. This mode is intended for a high-availability solutions with active/passive clusters. For example, a service group HA, consisting of e.g. a mobile IP alias and an application server, is started on host H1, host H2 is backup and heartbeat is in place between both hosts. The service group I must be started on one node only. If H1 dies, H2 takes over the HA group. If H1 reboots, it is important that it won't try to start the HA group also. Even though the group was active on H1 before it crashed, as HA is running on H2 now. In I mode, a service's monitoring state is persistent across reboot. For instance, if a service was started before reboot, it will be started after reboot. If it was stopped before reboot, it will not be started after and so on. The default ONREBOOT START mode can be overridden globally: SET ONREBOOT =head1 SERVICE RESTART LIMIT B provides a restart limit mechanism for situations where a service simply refuses to start or respond over a longer period. The restart limit mechanism is based on number of service restarts and number of poll-cycles. For example, if a service had I restarts within I poll-cycles (where I <= I) then Monit will perform an action (for example unmonitor the service). If a timeout occurs, Monit will send an alert message if you have register interest for this event. The syntax for the timeout statement is as follows (keywords are in capital): IF RESTART CYCLE(S) THEN The I value is either one of common L or TIMEOUT (for backward compatibility, equals to UNMONITOR action). Here is an example where Monit will unmonitor the service if it was restarted 2 times within 3 cycles: if 2 restarts within 3 cycles then unmonitor To have Monit check the service again after monitoring was disabled, run C from the command line. Example for setting custom exec on timeout: if 5 restarts within 5 cycles then exec "/foo/bar" Example for stopping the service: if 7 restarts within 10 cycles then stop =head1 SERVICE DEPENDENCIES If specified in the control file, Monit can do dependency checking before start, stop, monitoring or unmonitoring of services. The dependency statement may be used within any service entries in the Monit control file. The syntax for the depend statement is simply: DEPENDS on service[, service [,...]] Where B is a check service entry name used in your C<.monitrc> file, for instance B or B. You may add more than one service name of any type or use more than one depend statement in an entry. Services specified in a I statement will be checked during stop/start/monitor/unmonitor operations. If a service is stopped or unmonitored it will stop/unmonitor any services that depends on itself. If the service is started, all services which this service depends on will be started before starting this service. if start of some service failed, the service with prerequisites will NOT be started and the, but will remember that it should start and will retry next cycle. If a service is restarted, it will first stop any active services that depend on it and after it is started, start all depending services that were active before the restart again. Here is an example where we set up an apache service entry to depend on the underlying apache binary. If the binary should change an alert is sent and apache is not monitored anymore. The rationale is security and that Monit should not execute a possibly cracked apache binary. (1) check process apache with pidfile "/var/run/httpd.pid" (2) depends on httpd (3) ... (4) (5) check file httpd with path /usr/bin/httpd (6) if failed checksum then stop The first entry is the process entry for apache. The second line sets up a dependency between this entry and the service entry named httpd in line 5. A dependency tree works as follows, if an action is conducted in a lower branch it will propagate upward in the tree and for every dependent entry execute the same action. In this case, if the checksum should fail in line 6 then an stop action is executed and apache binary is not checked anymore. But since the apache process entry depends on the httpd entry this entry will also execute the stop action. In short, if the checksum test for the httpd binary file should fail, both the check file httpd and the check process apache entry are stopped. A dependency tree is a general construct and can be used between all types of service entries and span many levels and propagate any supported action (except the exec action which will not propagate upward in a dependency tree for obvious reasons). Here is another different example. Consider the following common server setup: WEB-SERVER -> APPLICATION-SERVER -> DATABASE -> FILESYSTEM (a) (b) (c) (d) You can set dependencies so that the web-server depends on the application server to run before the web-server starts and the application server depends on the database server and the database depends on the filesystem to be mounted before it starts. See also the example section below for examples using the depend statement. Here we describe how Monit will function with the above dependencies: =over 4 =item If no services are running Monit will start the servers in the following order: I, I, I, I =item If all servers are running When you run 'monit stop all' this is the stop order: I, I, I, I. If you run 'Monit stop d' then I, I and I are also stopped because they depend on I and finally I is stopped. =item If I does not run Monit will start I =item If I does not run Monit will first stop I then start I and finally start I if I is up again. =item If I does not run Monit will first stop I and I then start I and finally start I then I. =item If I does not run Monit will first stop I, I and I then start I and finally start I, I then I. =item If the control file contains a depend loop. A depend loop is for example; a->b and b->a or a->b->c->a. When Monit starts it will check for such loops and complain and exit if a loop was found. It will also exit with a complaint if a depend statement was used that does not point to a service in the control file. =back =head1 SERVICE TESTS =head2 LIMITS You can configure and set various limits to tweak buffer sizes and timeouts used by Monit. In most situations the default values are fine. If needed, below are the limits you can currently modify in Monit. Syntax: SET LIMITS { PROGRAMOUTPUT: , SENDEXPECTBUFFER: , FILECONTENTBUFFER: , HTTPCONTENTBUFFER: , NETWORKTIMEOUT: PROGRAMTIMEOUT: STOPTIMEOUT: STARTTIMEOUT: RESTARTTIMEOUT: EXECTIMEOUT: } Where: I is "B" (byte), "kB" (kilobyte) or "MB" (megabyte) I is "MS" (millisecond) or "S" (second) Options legend: ---------------------------------------------------------------------------------- | Option | Description | Default | ---------------------------------------------------------------------------------- | programOutput | limit for check program output (truncated after) | 512 B | | sendExpectBuffer | limit for send/expect protocol test | 256 B | | fileContentBuffer | limit for file content test (line) | 512 B | | httpContentBuffer | limit for HTTP content test (response body) | 1 MB | | networkTimeout | timeout for network I/O | 5 s | | programTimeout | timeout for check program | 300 s | | stopTimeout | timeout for service stop | 30 s | | startTimeout | timeout for service start | 30 s | | restartTimeout | timeout for service restart | 30 s | | execTimeout | timeout for test action exec | nolimit | ---------------------------------------------------------------------------------- =head2 GENERAL SYNTAX Monit offers several if-tests you can use in a 'check' statement to test various aspects of a service. You can test both for a predefined value or for a range and take actions if the value changes. General syntax for testing a specific value or range: IF THEN [ELSE ] The action is evaluated each time the condition is true. Success action is optional and executed only when the state changes from failure to success. If success action is not set, Monit will send a recovery alert by default. General syntax for a value change test: IF CHANGED THEN The action is executed each time the value changes. Monit will remember the new value and will trigger event if the value change again. =head2 ACTION Each test can have associated I, I, I, I, I or I methods which Monit can use to execute actions or programs on the service. The success action also supports the I method. Syntax: ALERT | IGNORE | START | STOP | RESTART | UNMONITOR or: EXEC "program" [[AS] UID ] [[AS] GID ] [[WITH] TIMEOUT SECOND(S)] [REPEAT EVERY [] CYCLE(S)] In each test you must select the action to be executed from this list: =over 4 =item * B sends the user an alert event on each state change. =item * B restarts the service B send an alert. Restart is performed by calling the service's registered restart method or by first calling the stop method followed by the start method if restart is not set. =item * B starts the service by calling the service's registered start method B send an alert. =item * B stops the service by calling the service's registered stop method B send an alert. If Monit stops a service it will not be checked by Monit anymore nor restarted again later. To reactivate monitoring of the service again you must explicitly enable monitoring from the web interface or from the console. =item * B can be used to execute an arbitrary program B send an alert. If you choose this action you must state the program to be executed and if the program requires arguments you must enclose the program and its arguments in a quoted string. You may optionally specify the uid and gid the executed program should switch to upon start. The program is executed only I if the test fails. You can enable execute repetition if the error persists for a given number of cycles. For instance: if failed then exec "/usr/local/bin/sms.sh" as uid "nobody" and gid "nobody" repeat every 5 cycles Remember, if Monit is run by root, then all programs executed by Monit will be started with superuser privileges unless the uid and gid extension is used. =item * B will disable monitoring of the service B send an alert. The service will not be checked by Monit anymore nor restarted again later. To reactivate monitoring of the service you must explicitly enable monitoring from the web interface or from the console. =item * B can be used in the action to not generate an alert once the check reenters the state. =back =head2 FAULT TOLERANCE By default an action is executed if it matches and the corresponding service is set in an error state. However, you can require a test to fail more than once before the error event is triggered and the service state is changed to failed. This is useful to avoid getting alerts on spurious errors, which can happen, especially with network tests. Syntax: FOR CYCLES ... or: [TIMES WITHIN] CYCLES ... The condition can be used both for failure and success action. The first, simpler and recommended format requires C consecutive events before switching the state: if failed port 80 for 3 cycles then alert The second format is more advanced and allows one to tolerate intermittent issues, but still catch excessive problems, where the service is flapping between error and success states frequently. For example if every second cycle fails (1-0-1-0-1-0-...), then "for 2 cycles" condition will never match, despite the service having problems. The following statement will catch such a state: if failed port 80 for 3 times within 5 cycles then alert Example which sets multiple error levels and actions: check filesystem rootfs with path /dev/hda1 if space usage > 80% for 5 times within 15 cycles then alert if space usage > 90% for 5 cycles then exec '/try/to/free/the/space' Note: the maximum value for cycles is 64. =head2 EXISTENCE TESTS This test allows one to trigger an action based on the monitored object existence. It is supported for I, I, I, I and I services. If no existence test is defined, the implicit non-existence test with restart action is activated, so for example if the process stops, Monit will restart it. There are two types of existence tests: =head3 NON-EXIST This test will trigger an action if the object does not exist. It can be used for example to make sure apache is running, data filesystem is mounted, etc. IF [DOES] NOT EXIST THEN I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: Exec a script if a filesystem does NOT exist: check filesystem disk1 with path /dev/sda1 if does not exist then exec "/sbin/mount..." =head3 EXIST This test is the inverse of the non-existence test: it will trigger an action if the object DOES exist. It can be used for example to kill a process which shouldn't be running. IF [DOES] EXIST THEN I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: kill a process that should not run: check process vmware matching "vmware" if exist then exec "/usr/bin/pkill -9 vmware" Example: Alert if a file exist which shouldn't check file x with path /some/path/x if exist then alert =head2 RESOURCE TESTS Monit can examine how much resources a service is using. This test can only be used within a system or process service entry in the Monit control file. Depending on system or process characteristics, services can be stopped or restarted and alerts can be generated. Thus it is possible to utilise systems which are idle and to spare system under high load. Syntax: IF THEN I is a choice of "<", ">", "!=", "==" in C notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is either an integer or a real number. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". I set depends on the service type: =head3 System resource tests I refers to the system's load average. The load average is the number of processes in the system run queue per CPU core, averaged over the specified time period. Example: if loadavg (1min) per core > 2 for 15 cycles then alert if loadavg (5min) per core > 1.5 for 10 cycles then alert if loadavg (15min) per core > 1 for 8 cycles then alert If you'll omit the I option, the test will check the total load average regardless of CPU cores count. I is the percent of time the system spend in given type of task: =over 4 =item user The CPU is running code in user space mode, which includes any process that doesn't belong to the kernel, such as webservers, databases, shells and desktop related programs. =item system The CPU is running the kernel, which includes drivers and other kernel modules. The kernel also handles requests from user space processes like memory allocation, disk and network I/O and creating child processes. =item wait I/O wait is when the CPU was idle while waiting for an I/O operation from disk or network to complete. =item nice The nice statistics accounts for user space processes that are running with altered priority (higher or lower then normal). =item hardirq The kernel is servicing hardware interrupt requests. Hardware interrupts come from peripherals like keyboard, network interfaces, disks, system clock, etc. =item softirq The kernel is servicing software interrupt requests. Software interrupts come from processes running in the system. =item steal This applies only to virtual machines on a hypervisor. The steal time shows the percentage of time a virtual machine had to wait the real CPU while the hypervisor was servicing another virtual machine. If this number remains high, the host system is too busy and may need more physical CPUs or offload some virtual machines to another host. =item guest This applies only to host machines running a hypervisor. It shows time spent running a virtual CPU for guest operating systems under the control of the Linux kernel. This value is already included in "user" statistics. =item guestnice This applies only to host machines running a hypervisor. It shows time spent running a virtual CPU for guest operating systems under the control of the Linux kernel, with altered priority. This value is already included in "nice" statistics. =back The user/system/wait/nice/hardirq/softirq/steal/guest/guestnice modifier is optional and the support depends on platform (Linux support depends on kernel version, all statistics are available since kernel 2.6.33): ----------------------------------------------------------------------------------------------- | Platform | user | nice | system | wait | hardirq | softirq | steal | guest | guest nice | ----------------------------------------------------------------------------------------------- | AIX | X | | X | X | | | | | | | DragonFlyBSD | X | X | X | | X | | | | | | FreeBSD | X | X | X | | X | | | | | | Linux | X | X | X | X | X | X | X | X | X | | MacOS | X | X | X | | | | | | | | NetBSD | X | X | X | | X | | | | | | OpenBSD | X | X | X | | X | | | | | | Solaris | X | | X | X | | | | | | ----------------------------------------------------------------------------------------------- Example: if cpu usage > 95% for 10 cycles then alert I is the system memory usage [%] or absolute value [B, kB, MB, GB]. Example: if memory usage > 75% for 5 cycles then alert I is the swap usage of the system [%] or absolute [B, kB, MB, GB]. Example: if swap usage > 20% for 10 cycles then alert =head3 Process resource tests I is the CPU usage of the process itself [%]. Monit calculates the CPU usage based on number of threads vs. available CPU cores. If the process has one thread, the 100% CPU usage equals to 100% utilization of one CPU core. If it has 2 threads, 100% CPU usage is reported when it uses 2 CPU cores on 100%, etc. If the process has more threads then the machine's available CPU cores, then the 100% CPU usage corresponds to utilization of all available CPU cores. Example: if cpu > 10% for 5 cycles then restart I is the total CPU usage of the process and its children in (percent). You will want to use TOTAL CPU typically for services like Apache web server where one master process forks child processes as workers. Example: if total cpu > 50% for 10 cycles then restart I is the number of processes' threads. Example: if threads > 3 then alert I is the number of child processes of the process. Example: if children > 10 then alert I is the memory usage of the process itself, [%] or absolute value [B, kB, MB, GB]. Example: if memory usage > 8 MB then alert I is the memory usage of the process and its child processes in either percent or as an amount [B, kB, MB, GB]. Example: if total memory usage > 1% for 10 cycles then alert =head2 PROCESS I/O ACTIVITY TEST Monit can test process's filesystem read and write activity. This test can only be used in the context of a process service type. Monit will normally need to run as the root user to access this metrics. The OS usually supports the per-process I/O metrics by bytes or by operations. Some platforms allows one to differentiate the I/O subset that required physical storage access from generic I/O which was handled by cache. Note that as the physical I/O is usually aligned to the filesystem page, there may be difference between the total and physical I/O even if the process tried to read just 1 byte. Per-process I/O activity statistics by platform: --------------------------------------------------------------- | Platform | Operation | Byte (physical) | Byte (generic) | --------------------------------------------------------------- | AIX | X | | | | DragonFlyBSD | X | | | | FreeBSD | X | | | | Linux | X | X | X | | MacOS | | X | | | NetBSD | X | | | | OpenBSD | X | | | | Solaris | X | | | --------------------------------------------------------------- =head3 Read: bytes per second (generic) Syntax: IF READ [ACTIVITY] /S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process p... if read activity > 1 MB/s then alert =head3 Read: bytes per second (physical storage) Syntax: IF DISK READ [ACTIVITY] /S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process p... if disk read activity > 1 MB/s then alert =head3 Read: operations per second Syntax: IF DISK READ [ACTIVITY] operations/S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process p... if disk read activity > 500 operations/s then alert =head3 Write: bytes per second (generic) Syntax: IF WRITE [ACTIVITY] /S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process p... if write activity > 1 MB/s then alert =head3 Write: bytes per second (physical storage) Syntax: IF DISK WRITE [ACTIVITY] /S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process p... if disk write activity > 1 MB/s then alert =head3 Write: operations per second Syntax: IF DISK WRITE [ACTIVITY] operations/S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process p... if disk write activity > 500 operations/s then alert =head2 FILE CHECKSUM TEST The checksum statement may only be used in a file service entry and can be used to check the file's MD5 or SHA1 checksum. Check specific checksum: IF FAILED [MD5|SHA1] CHECKSUM [EXPECT checksum] THEN action Check any file changes: IF CHANGED [MD5|SHA1] CHECKSUM THEN action The choice of MD5 or SHA1 is optional. MD5 features a 128 bits checksum (32 bytes hex encoded string) and SHA1 a 160 bits checksum (40 bytes hex encoded string). If this option is omitted, Monit will try to guess the method from the EXPECT string or use MD5 as the default checksum. C is optional and if used, specifies the md5 or sha1 string Monit should expect when testing a file's checksum. Monit will then not compute an initial checksum for the file, but instead use the string you submit. For example: if failed checksum expect 8f7f419955cefa0b33a2ba316cba3659 then alert You can, for example, use the GNU utility I or I to create a checksum string for a file and use this string in the expect-statement. Reloading a server if its configuration file was changed: check file apache_conf with path /etc/apache/httpd.conf if changed checksum then exec "/usr/bin/apachectl graceful" I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". =head2 TIMESTAMP TEST The timestamp statement may only be used in a file, fifo or directory service entry. Relative timestamp syntax: IF [unit] THEN Timestamp change syntax: IF CHANGED THEN action There are four timestamp test types: =over 12 =item ACCESS (ATIME) Test the timestamp which is updated whenever the object is accessed, for example the file is read. Filesystem usually allows one to disable I updates using mount options, so this test will work only if the filesystem performs atime updates. =item CHANGE (CTIME) Test the timestamp which is updated whenever the object metadata such as owner, group, permissions or hard link count are changed. =item MODIFICATION (MTIME) Test the timestamp which is updated whenever the object content is modified. The file modification timestamp is updated whenever the file is truncated or written to. The directory modification timestamp is updated whenever some files/subdirectories were added to the directory or removed from that directory. =item DEFAULT (LATEST OF CHANGE AND MODIFICATION TIMES) If no specific timestamp type is set, the latest of change and modification timestamps is checked. This test allows for simple testing of any object modification (data and metadata). =back I is a choice of "<", ">", "!=", "==" in C notation, "GT", "LT", "EQ", "NE" in shell sh notation and "NEWER, "OLDER", "GREATER", "LESS", "EQUAL", "NOTEQUAL" in human readable form (if not specified, default is EQUAL). I is a time watermark. I is either "SECOND(S)", "MINUTE(S)", "HOUR(S)" or "DAY(S)". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". For example to reload apache if the configuration file changed: check file apache_conf with path /etc/apache/httpd.conf if changed timestamp then exec "/usr/bin/apachectl graceful" For example to test directory for file addition or removal: check directory bar path /foo/bar if changed timestamp then alert Example for sending alert if a log file is not updated for more than 1 hour: if timestamp is older than 1 hour then alert =head2 FILE SIZE TEST The size statement may only be used in a check file service entry. If specified in the control file, Monit will compute a size for a file. Testing specific size or range: IF SIZE [[operator] value [unit]] THEN action Testing size changes: IF CHANGED SIZE THEN action I is a choice of "<", ">", "!=", "==" in C notation, "GT", "LT", "EQ", "NE" in shell sh notation and "GREATER", "LESS", "EQUAL", "NOTEQUAL" in human readable form (if not specified, default is EQUAL). I is a size watermark. I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte". If it is not specified, "byte" unit is assumed by default. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". For example to send an alert if the file is too large: check file mydb with path /data/mydatabase.db if size > 1 GB then alert =head2 FILE CONTENT TEST The content statement can be used to incrementally test the content of a text file by using regular expressions. Syntax: IF CONTENT THEN action I is either a "=" for match or "!=" for no-match. I is a string containing the extended regular expression. See also regex(7). I is an absolute path to a file containing extended regular expression on every line. See also regex(7). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". On startup the read position is set to the end of the file and Monit continues to scan to the end of the file on each cycle. If the file size should decrease or inode changed, the read position is set to the start of the file. Only lines ending with a newline character are inspected. By default only the first 511 characters of a line are inspected. You can increase the limit using the L statement. IGNORE CONTENT Lines matching an I are not inspected during later evaluations. I has always precedence over I. All I statements are evaluated first, in the order of their appearance. Thereafter, all the I statements are evaluated. For example: check file syslog with path /var/log/syslog ignore content = "monit" if content = "^mrcoffee" then alert =head2 FILESYSTEM MOUNT FLAGS TEST Monit can test the filesystem mount flags for changes. This test is implicit and Monit will send alert in case of failure by default. This test is useful for detecting changes of filesystem flags such as if the filesystem become read-only (on disk error) or mount flags were changed (such as nosuid). The syntax for the fsflags statement is: IF CHANGED FSFLAGS THEN action I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem rootfs with path / if changed fsflags then exec "/my/script" =head2 SPACE USAGE TEST Monit can test a filesystem or a disk for space usage. This test may only be used in the context of a filesystem service type. Filesystems usually have some space reserved for the root user (ca. 1-5%), so non-superusers cannot write to a nearly full filesystem. If you set a limit for the filesystem which is used by non-root users you might want to consider these reserved blocks when setting the limit. You can use Monit itself to view the reserved blocks percentage by using the CLI status command or the HTTP interface for the given filesystem. Syntax: IF SPACE operator value unit THEN action or: IF SPACE FREE operator value unit THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB", "%" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem rootfs with path / if space usage > 90% then alert =head2 INODE USAGE TEST Monit can test filesystem inode usage. This test may only be used in the context of a filesystem service type. Syntax: IF INODE(S) operator value [unit] THEN action or: IF INODE(S) FREE operator value [unit] THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is optional. If not specified, the value is an absolute count of inodes. You can use the "%" character or the longer alternative "percent" as a unit. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem rootfs with path / if inode usage > 90% then alert =head2 DISK I/O TEST Monit can test a filesystem read and write activity. This test may only be used in the context of a filesystem service type. The available I/O metrics depends on the platform and filesystem. Some platforms allows us to get I/O activity for specific partition, others just for the whole disk. Some allows us to get metrics for network filesystems, others just for block devices. Platforms I/O metrics granularity and filesystem support in Monit: --------------------------------------------------------------------------------------- | Platform | Granularity | Supported filesystems | TBD | --------------------------------------------------------------------------------------- | AIX | per-disk | Disk io monitoring currently not supported | JFSx | | DragonFlyBSD | per-disk | UFS | HAMMER | | FreeBSD | per-disk | UFS, ZFS | | | Linux | per-filesystem | EXTx, XFS, BTRFS, ZFS, NFS, CIFS | | | MacOS | per-disk | HFS | | | NetBSD | per-disk | FFS | NFS | | OpenBSD | per-disk | FFS | | | Solaris | per-filesystem | ZFS, UFS, NFS | | --------------------------------------------------------------------------------------- =head3 Read: bytes per second Syntax: IF READ [RATE] /S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem disk1... if read rate > 1 MB/s then alert =head3 Read: operations per second Syntax: IF READ [RATE] operations/S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem disk1... if read rate > 500 operations/s then alert =head3 Write: bytes per second Syntax: IF WRITE [RATE] /S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte", "percent". I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem disk1... if write rate > 1 MB/s then alert =head3 Write: operations per second Syntax: IF WRITE [RATE] operations/S THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check filesystem disk1... if write rate > 500 operations/s then alert =head3 Service time per operation Service Time is the time taken to complete a read or a write operation. This is a fairly important metric. If it grows, it means that the disk is not able to handle the operations fast enough. Growth charts are available in M/Monit. Syntax: IF SERVICE TIME THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is "MS" (millisecond) or "S" (second) I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: if service time > 10 milliseconds for 3 times within 5 cycles then alert =head2 PERMISSION TEST Monit can test the permissions of file objects. This test may only be used in the context of a file, fifo, directory or filesystem service types. Syntax for testing specific permissions: IF FAILED PERM(ISSION) octalnumber THEN action Syntax for testing any permission change: IF CHANGED PERM(ISSION) THEN action I defines permissions for a file, a directory or a filesystem as four octal digits (0-7). Valid range is 0000 - 7777 (you can omit the leading zeros, Monit will add the zeros to the left. For example, "640" is a valid value and matches "0640"). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check file shadow with path /etc/shadow if failed permission 0640 then alert =head2 UID TEST Monit can monitor the owner user id (uid) of a file, fifo, directory or owner and effective user of a process. Syntax: IF FAILED [E]UID THEN action I defines a user id either in numeric or in string form. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check file shadow with path /etc/shadow if failed uid "root" then alert =head2 GID TEST Monit can monitor the owner group id (gid) of a file, fifo, directory or process. Syntax: IF FAILED GID THEN action I defines a group id either in numeric or in string form. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check file shadow with path /etc/shadow if failed gid "shadow" then alert =head2 HARDLINK TEST The hardlink statement may be used in a check file, fifo or directory service entry. If specified in the control file, Monit will compute the number of hard links for a file, fifo or directory. Testing a specific value: IF HARDLINK [[operator] value] THEN action Testing hardlink changes: IF CHANGED HARDLINK THEN action I is a choice of "<", ">", "!=", "==" in C notation, "GT", "LT", "EQ", "NE" in shell sh notation and "GREATER", "LESS", "EQUAL", "NOTEQUAL" in human readable form (if not specified, default is EQUAL). I is a watermark. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". For example to send an alert if the number of used hard links of a directory is too large: check directory upload with path /data/upload if hardlink > 32000 then alert =head2 PID TEST Monit can test the process's PID. Monit will send an alert in case the PID changed outside of Monit's control. Syntax: IF CHANGED PID THEN action I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". This test is useful to detect possible process restarts which has occurred in the timeframe between two Monit testing cycles. For example if someone changes sshd configuration and did sshd restart outside of Monit's control you will be notified that the process was replaced by a new instance: check process sshd with pidfile /var/run/sshd.pid if changed pid then alert =head2 PPID TEST Monit can test the process's parent PID (PPID) for changes. Monit will send alert in the case that the PPID changed outside of Monit control. The syntax for the ppid statement is: IF CHANGED PPID THEN action I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check process myproc with pidfile /var/run/myproc.pid if changed ppid then exec "/my/script" =head2 UPTIME TEST The uptime statement may only be used in a process and system service type context. Syntax: IF UPTIME [[operator] value [unit]] THEN action I is a choice of "<", ">", "!=", "==" in C notation, "GT", "LT", "EQ", "NE" in shell sh notation and "GREATER", "LESS", "EQUAL", "NOTEQUAL" in human readable form (if not specified, default is EQUAL). I is a uptime watermark. I is either "SECOND", "MINUTE", "HOUR" or "DAY" (it is also possible to use "SECONDS", "MINUTES", "HOURS", or "DAYS"). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example of restarting the process every three days: check process myapp with pidfile /var/run/myapp.pid start program = "/etc/init.d/myapp start" stop program = "/etc/init.d/myapp stop" if uptime > 3 days then restart =head2 SECURITY ATTRIBUTE TEST The security attribute statement may only be used in a process context. Syntax: IF FAILED SECURITY ATTRIBUTE THEN I expected security attribute value I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example for SELinux: check process ntpd matching "ntpd" if failed security attribute "system_u:system_r:ntpd_t:s0" then alert Example for AppArmor: check process ntpd matching "ntpd" if failed security attribute "/usr/sbin/ntpd (enforce)" then alert =head2 SYSTEM AND PER-PROCESS FILEDESCRIPTORS TEST Monit can test the filedescriptors usage on the system and process level. You can check either an absolute value or percentual usage of the current maximum. The per-process percentual usage can be used only if the system exposes per-process maximum. Syntax: IF FILEDESCRIPTORS [%] THEN action For process only, you can also check accumulated number for the process and all its children. Syntax: IF TOTAL FILEDESCRIPTORS THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I limit. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Examples: check system $HOST if filedescriptors >= 90% then alert check process myproc with pidfile /var/run/myproc.pid if filedescriptors >= 90% then alert if filedescriptors >= 99% then restart if total filedescriptors > 5000 then alert =head2 PROGRAM STATUS TEST You can check the exit status of a program or a script. This test may only be used within a check program service entry in the Monit control file. Syntax for testing specific exit value: IF STATUS operator value THEN action Syntax for testing any exit value change: IF CHANGED STATUS THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Example: check program myscript with path /usr/local/bin/myscript.sh if status != 0 then alert Sample script for the above example (/usr/local/bin/myscript.sh): #!/bin/sh echo test exit $? You can also send parameters with the program: check program list-files with path "/bin/ls -lrt /tmp/" if status != 0 then alert Arguments to the program or script is a sequence of whitespace separated strings. In the above example the strings '-lrt' and '/tmp/' are arguments to the program '/bin/ls'. If arguments are used, it is recommended to use quotes B<"> to enclose the string, otherwise, if no arguments are used, quotes are not needed. Notes: If the program is a script, the interpreter is required in the first line. The program or script must also be executable. If Monit is run as the super user, you can optionally run the program as a different user and/or group. In this example we run the I program as user www and as group staff: check program ls with path "/bin/ls /tmp" as uid "www" and gid "staff" if status != 0 then alert Monit will execute the program periodically and if the exit status of the program does not match the expected result, Monit can perform an action. In the example above, Monit will raise an alert if the exit value is different from 0. By convention, 0 means the program exited normally. Program checks are asynchronous. Meaning that Monit will not wait for the program to exit, but instead, Monit will start the program in the background and immediately continue checking the next service entry in I. At the next cycle, Monit will check if the program has finished and if so, collect the program's exit status. If the status indicate a failure, Monit will raise an alert message containing the program's error (stderr) output, if any. If the program has not exited after the first cycle, Monit will wait another cycle and so on. If the program is still running after 5 minutes, Monit will kill it and generate a program timeout event. It is possible to override the default timeout (see the syntax below). Multiple status tests can be used, for example: check program hwtest with path /usr/local/bin/hwtest.sh with timeout 500 seconds if status = 1 then alert if status = 3 for 5 cycles then exec "/usr/local/bin/emergency.sh" =head2 PROGRAM OUTPUT CONTENT TEST The content statement can be used to either test the content of a program by using regular expressions or check for changes in the output. Syntax: IF CONTENT THEN action IF CONTENT [NOT] CHANGED THEN action I is either a "=" for match or "!=" for no-match. I is a string containing the extended regular expression. See also regex(7). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". By default the output check is limited to 511 characters only. You can increase the limit using the L statement. Examples: check program disk0_smart with path "/usr/sbin/nvme smart-log /dev/nvme0" if content != "critical_warning[ ]+: 0" then alert check program ip_route with path "/usr/bin/ip route" if content changed then alert =head2 NETWORK INTERFACE TESTS Monit can check network interfaces for: =over 3 =item L =item L =item L =item L =item L =back =head3 Link status You can check the network link state. This test may only be used within a check network service entry in the Monit control file. Syntax: IF LINK THEN action I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". The I test will fail if the link/interface is down or link errors were detected. Mixing "link up" and "link down" in the same "check network" is not supported. Examples: check network eth0 with interface eth0 if link down then alert check network eth5 with interface eth5 if link up then exec "/usr/bin/monit start backup" In case a link failed you can add a start and stop program to automatically restart the interface which might help. (Substitute with the relevant network commands for your system) check network eth0 with interface eth0 start program = '/sbin/ipup eth0' stop program = '/sbin/ipdown eth0' if link down then restart =head3 Link capacity You can check the network link mode capacity for changes. This test may only be used within a check network service entry in the Monit control file. Syntax: IF CHANGED LINK [CAPACITY] THEN action I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". The test will match if the link mode has changed (e.g. maximum speed dropped) or if the duplex mode has changed. NOTE: not all interface types allow for capacity monitoring. Pseudo interfaces such as loopback device or VMWare interfaces does not have a speed attribute. Example: check network eth0 with interface eth0 if changed link capacity then alert =head3 Link saturation You can check the network link saturation. Monit then computes the link utilisation based on the current transfer rate vs. link capacity. This test may only be used within a check network service entry in the Monit control file. Syntax: IF SATURATION operator value% THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". NOTE: this test depends on the availability of the speed attribute and not all interface types have this attribute. See the LINK SPEED test description. Example: check network eth0 with interface eth0 if saturation > 90% then alert =head3 Link upload and download [bytes] You can check a network link upload and download bandwidth usage, current transfer speed and total data transferred in the last 24 hours. This test may only be used within a I service entry in the Monit control file. Upload speed test syntax (per second): IF UPLOAD operator value unit/S THEN action Download speed test syntax (per second): IF DOWNLOAD operator value unit/S THEN action Total upload data test syntax: IF TOTAL UPLOADED operator value unit IN LAST number time-unit THEN action Total download data test syntax: IF TOTAL DOWNLOADED operator value unit IN LAST number time-unit THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "B","KB","MB","GB" or long alternatives "byte", "kilobyte", "megabyte", "gigabyte". I is a choice of "MINUTE(S)", "HOUR(S)", "DAY". NOTE: Monit maintains a rolling count of total uploaded and downloaded bytes for the last 24 hours only. The value of time-unit can therefore not specify a range wider than one day. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Examples: check network eth0 with interface eth0 if upload > 500 kB/s then alert if total downloaded > 1 GB in last 2 hours then alert if total downloaded > 10 GB in last day then alert =head3 Link upload and download [packets] You can check the network link upload and download packets count, current transfer rate and total data transferred in last 24 hours. This test may only be used within a check network service entry in the Monit control file. Current upload bandwidth rate test syntax: IF UPLOAD operator value PACKETS/S THEN action Current download bandwidth rate test syntax: IF DOWNLOAD operator value PACKETS/S THEN action Total upload test syntax: IF TOTAL UPLOADED operator value PACKETS IN LAST number time-unit THEN action Total download test syntax: IF TOTAL DOWNLOADED operator value PACKETS IN LAST number time-unit THEN action I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I is a choice of "MINUTE(S)", "HOUR(S)", "DAY". NOTE: Monit keeps total upload/download statistics only for the last 24 hours. The time-unit value cannot therefore span more than one day. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". Examples: check network eth0 with interface eth0 if upload > 1000 packets/s then alert if total uploaded > 900000 packets in last hour then alert =head2 NETWORK PING TEST Monit can perform a network ping test by sending ICMP echo request datagram packets to a host and wait for the reply. This test can only be used within a check host statement. Monit must also run as the root user in order to be able to perform the ping test (because the ping test must use raw sockets which usually only the super user is allowed to). Syntax: IF PING[4|6] [COUNT number] [SIZE number] [RESPONSETIME operator number ] [TIMEOUT number SECONDS] [ADDRESS string] THEN action If a DNS host name was used in the I statement and the host name resolve to several addresses (either IPv4 or IPv6), Monit will ping the first available address and continue with the next address until one connection succeed or until there are no more addresses left to try. You can force Monit to only ping IPv4 or IPv6 addresses by using the PING4 or the PING6 keyword instead of PING. The B parameter specifies how many consecutive ping requests will be sent to the host in one cycle at maximum. The default value is 3. The B parameter specifies the ping request payload size. Default is 64 bytes, minimum is 8 bytes, maximum 1492 bytes. The B parameter sets the response time limit. I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). If no reply arrive within B seconds, Monit reports an error. If at least one reply was received, the ping test is considered a success. The B
parameter specifies source IP address. Monit will, by default, send up to I ping request packets in one cycle to prevent false alarm (i.e. up to 66% packet loss is tolerated). You can set the B option to a value between 1 and 20 to send more or fewer packets. If you require 100% ping success, set the count to 1 (i.e. just one request will be sent, and if the packet was lost an error will be reported). Note that many ISPs have started to filter out ping or ICMP packets now, in which case there will be no reply from the host. If a ping test is used in a check host entry, this test is run first and if the test should fail, we assume that the connection to the host is down and Monit will I continue with any subsequent port tests. Example: check host mmonit.com with address mmonit.com if failed ping then alert # IPv4 or IPv6 check host mmonit.com with address 62.109.39.247 if failed ping then alert # Address is IPv4 so IPv4 is preferred or test that the system is explicit accessible via IPv4 and IPv6: check host mmonit.com with address mmonit.com if failed ping4 then alert # IPv4 only if failed ping6 then alert # IPv6 only or with all parameters; Send five 128 byte pings to mmonit.com and wait for up to 10 seconds for a reply check host mmonit.com with address mmonit.com if failed ping count 5 size 128 with timeout 10 seconds then alert You can also watch host, that is supposed to be offline: check host offlinehost with address 192.168.100.50 if succeeded ping then alert =head2 CONNECTION TESTS Monit can perform connection testing via network ports or via Unix sockets. A connection test may only be used within a process or host service type context. If a service listens on one or more sockets, Monit can connect to the port (using TCP or UDP) and verify that the service will accept a connection and that it is possible to write and read from the socket. If a connection is not accepted or if there is a problem with socket I/O, Monit will execute a specified action. For TCP/UDP ports monit can alert on successful connection, e.g. when a service like mysql should not be publicly available. TCP/UDP port test syntax: IF [HOST string] [ADDRESS string] [IPV4 | IPV6] [TYPE ] [ [with options {...}] [CERTIFICATE CHECKSUM [MD5|SHA1] string] [CERTIFICATE VALID for number DAYS] [PROTOCOL protocol | "string",...] [RESPONSETIME operator number ] [TIMEOUT number SECONDS] [RETRY number] THEN action Unix socket test syntax: IF [TYPE ] [PROTOCOL protocol | "string",...] [RESPONSETIME operator number ] [TIMEOUT number SECONDS] [RETRY number] THEN action Examples: if failed port 80 then alert if failed port 53 type udp protocol dns then alert if succeeded host example.org port 3306 type tcp protocol mysql then alert if failed unixsocket /var/run/sophie then alert Options: I. Optionally specify the host to connect to. If the host is not given then localhost is assumed if this test is used inside a process entry. If this test is used inside a remote host entry then the entry's remote host is assumed. I. The port number to connect to I. Specifies the path to a Unix socket (local machine only). I
. The source IP address to use. I. Optionally specify the IP version Monit should use when trying to connect to the port. If not used, Monit will try to connect to the first available address (IPv4 or IPv6). If multiple addresses are available and connection to one address failed, Monit will try the next address and so on until a connection succeed or until there are no more addresses left to try. I. Optionally specify the socket type Monit should use when trying to connect to the port. The different socket types are: TCP or UDP, where TCP is a regular stream based socket, UDP, a datagram socket. The default socket type is TCP. I<[SSL | TLS] [with options {...}]>. Set SSL/TLS L and override global/default SSL options. You can set the SSL/TLS version to use, whether to verify certificates, trust self-signed certificates or set the SSL client certificates database-file for client certificate authentication. I. Verify the SSL server certificate by checking its checksum. You can use either MD5 or SHA1 checksum (if you don't specify the type, Monit will determine the digest based on the hash length). You can use the I command line tool to get the checksum value for your certificate, which you can then use in Monit's control file: openssl x509 -fingerprint -sha1 -in server.crt | head -1 | cut -f2 -d'=' Example: if failed port 443 protocol https and certificate checksum = "1ED948A6F4258ACAB964227EF4EB19FCC453B0F8" then alert I. Send an alert if the certificate will expire in the given number of days. This test is pretty useful to get a notification when it is time to renew your SSL certificate. Example: if failed port 443 protocol https and certificate valid > 30 days then alert I. Optionally specify the protocol Monit should speak when a connection is established. At the moment Monit knows how to speak: I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I If the target server's protocol is not found in this list, simply do not specify the protocol and Monit will use a default connection test. I parameter sets the response time limit. I is a choice of "<",">","!=","==" in c notation, "gt", "lt", "eq", "ne" in shell sh notation and "greater", "less", "equal", "notequal" in human readable form (if not specified, default is EQUAL). I. Optionally specifies the connect and read timeout for the connection. If Monit cannot connect to the server within this time it will assume that the connection failed and execute the specified action. The default connect timeout is 5 seconds. I. Optionally specifies the number of consecutive retries within the same testing cycle in the case that the connection failed. The default is fail on first error. I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". =head3 Specific protocol test options =head4 GENERIC (SEND/EXPECT) If Monit does not support the protocol spoken by the server, you can write your own protocol-test using I and I strings. The I statement sends a string to the server port and the I statement compares a string read from the server with the string given in the expect statement. Syntax: [ "string"]+ Monit will send a string as it is, and you B remember to include CR and LF in the string sent to the server if the protocol expects such characters to terminate a string (most text based protocols used over Internet do). Monit will by default read up to 255 bytes from the server and use this string when comparing the EXPECT string. You can override the default value using the L statement. You can use non-printable characters in a SEND string if needed. Use the hex notation, \0xHEXHEX to send any char in the range \0x00-\0xFF, that is, 0-255 in decimal. For example, to test a Quake 3 server: send "\0xFF\0xFF\0xFF\0xFFgetstatus" expect "sv_floodProtect|sv_maxPing" If your system supports POSIX regular expressions, you can use regular expressions in the EXPECT string, see regex(7) to learn more about the types of regular expressions you can use in an expect string. Since both regex and string compare operates on a zero terminated string, you cannot test for '\0' in an EXPECT buffer since this character marks the end of the buffer. However, we escape '\0' in the expect buffer as "\0" which you can test for. That is, '\' followed by the ascii value for 0. For instance, here is how to test for an expect string that starts with zero followed by any number of characters. expect "^[\\]0.*" Here is a simple SMTP protocol example: if failed port 25 and expect "^220.*" send "HELO localhost.localdomain\r\n" expect "^250.*" send "QUIT\r\n" then alert SEND/EXPECT can be used with any socket type, such as TCP sockets, UNIX sockets and UDP sockets. =head4 HTTP Syntax: PROTO(COL) HTTP [USERNAME "string"] [PASSWORD "string"] [REQUEST "string"] [METHOD ] [STATUS operator number] [CHECKSUM checksum] [HTTP HEADERS list of headers] [CONTENT < "=" | "!=" > STRING] I is an optional username for Basic authentication I is an optional password for Basic authentication I option can set an URL string specifying a document on the HTTP server. If the request statement isn't specified, the default "/" page will be requested. For example: if failed port 80 protocol http request "/data/show?a=b&c=d" then restart I set the HTTP request method. If not specified, Monit prefers the HTTP GET request method, which is more common then the HEAD method. One may want to set the method explicitly to HEAD to save the network bandwidth. I option can be used to explicitly test the HTTP status code returned by the HTTP server. If not used, the HTTP protocol test will fail if the status code returned is greater than or equal to 400. You can override this behaviour by using the I qualifier. For example to test that a page does B exist (the HTTP server should return 404 in this case): if failed port 80 protocol http request "/non/existent.php" status = 404 then alert I You can test the checksum of documents returned by a HTTP server. Either MD5 or SHA1 hash can be used. Monit will B test the checksum for a document if the server does not set the HTTP I header. A HTTP server should set this header when it server a static document (i.e. a file). There are no limitation on the document size, but keep in mind that Monit will use time to download the document over the network to compute the checksum. Example: if failed port 80 protocol http request "/page.html" checksum 8f7f419955cefa0b33a2ba316cba3659 then alert I can be used to send a list of HTTP headers when using the HTTP protocol test. For instance, the host header. If the host header is not set, Monit will use the hostname or IP-address of the host as specified in the check host statement. Specifying a host header is useful if you want to connect to and test a name-based virtual host. The syntax for setting HTTP headers is http headers [name:value, name:value,..] where each name:value pair is separated with ','. If you need to use ':' in the value string, for instance to set port number for a host header, you must enclose the value in quotes. For example, http headers [Host: "mmonit.com:443"] In a check host context, using this statement might look like check host mmonit.com with address mmonit.com if failed port 80 protocol http with http headers [Host: mmonit.com, Cache-Control: no-cache, Cookie: csrftoken=nj1bI3CnMCaiNv4beqo8ZaCfAQQvpgLH] and request /monit/ with content = "Monit [0-9.]+" then alert Setting HTTP headers is associated with the HTTP protocol test and must come before I as in the example above. The I option sets the pattern which is expected in the data returned by the server. If the pattern doesn't match, the test fails. In the example above, if the server does not return a page with the name Monit followed by a version number the test will fail. By default, at maximum 1MB of content is inspected. You can increase this limit using the L statement. For example: if failed port 80 protocol http content = "foobar [0-9.]+" then alert =head4 APACHE-STATUS The I test allows one to check server performance by examination of the status page generated by Apache's mod_status, which is expected to be at its default address of http://www.example.com/server-status. Syntax: PROTOCOL APACHE-STATUS [PATH ] [USERNAME ] [PASSWORD ] [ ]+ I is an optional path to apache status ("/server-status" by default) I is an optional username for Basic authentication I is an optional password for Basic authentication I is acronym for child status: (1) logging (loglimit) (2) closing connections (closelimit) (3) performing DNS lookups (dnslimit) (4) in keepalive with a client (keepalivelimit) (5) replying to a client (replylimit) (6) receiving a request (requestlimit) (7) initialising (startlimit) (8) waiting for incoming connections (waitlimit) (9) gracefully closing down (gracefullimit) (10) performing cleanup procedures (cleanuplimit) I is one of "<", "=", ">". I is percentile numeric limit. Each of these limits can be compared against a value relative to the total number of active Apache child processes. You can combine all of these tests into one expression or you can choose to test a certain limit only. If you combine the limits you must connect them together using the OR keyword. Example: if failed port 80 protocol apache-status loglimit > 10% or dnslimit > 50% or waitlimit < 20% then alert =head4 MQTT Syntax: PROTOCOL MQTT [USERNAME string PASSWORD string] I MQTT username I MQTT password Username and password (credentials) are B. If not used, Monit will try anonymous connect, which may trigger authorization error => credentials are recommended unless your server allows anonymous connect. Example: check process mosquitto with pidfile /var/run/mosquitto.pid start program = "/sbin/start mosquitto" stop program = "/sbin/stop mosquitto" if failed port 1883 protocol mqtt then alert =head4 MYSQL Syntax: PROTOCOL MYSQL[S] [USERNAME string PASSWORD string [RSAKEY CHECKSUM string]] I MySQL username. I MySQL password (special characters can be used, but for non-alphanumerics the password has to be quoted). I If you use unsecured connection (plain MYSQL without TLS), you can set the expected MD5 or SHA1 checksum of the server's RSA key to protect afainst man-in-the-middle attacks. Monit will check the key fingerprint before sending the password to the server. Username and password (credentials) are B and if not set, Monit will perform the test using anonymous login. This can cause an authentication error to be logged in your MySQL log, depending on your MySQL configuration. If credentials are set, Monit will try to login. Monit does not require any database privileges, it just needs the database user. You might want to create standalone user for Monit to use when testing, for example: CREATE USER 'monit'@'host_from_which_monit_performs_testing' IDENTIFIED BY 'mysecretpassword'; FLUSH PRIVILEGES; Example: check process mysql with pidfile /var/run/mysqld/mysqld.pid start program = "/sbin/start mysql" stop program = "/sbin/stop mysql" if failed port 3306 protocol mysql username "foo" password "bar" then alert or with unix-socket start/stop commands check process mysql with pidfile /var/run/mysqld/mysqld.pid start program = "/usr/local/mysql/support-files/mysql.server start" stop program = "/usr/local/mysql/support-files/mysql.server stop" if failed unixsocket /tmp/mysql.sock protocol mysql username "foo" password "bar" then alert You can enable the TLS encryption for the test by using MYSQLS as protocol name: if failed port 3306 protocol mysqls username "foo" password "bar" then alert =head4 PGSQL Syntax: PROTOCOL PGSQL [USERNAME string] [PASSWORD string] [DATABASE string]] I PostgreSQL username. I PostgreSQL password (special characters can be used, but for non-alphanumerics the password has to be quoted). I PostgreSQL database (defaults to the database that matches the username if not set). Username and password (credentials) are B and if not set, Monit will perform the test with hardcoded user=root and database=root, which may trigger errors in PostgreSQL logs. If credentials are set, Monit will try to login. You might want to create standalone user for Monit to use when testing. Monit currently supports only 'password' and 'md5' PostgreSQL authentication methods. If the server asks for authentication method that Monit doesn't support (such as 'scram-sha-256'), Monit terminates the connection and the test succeeds (although monit cannot authenticate, the server is communicating). To allow access to Monit for testing purposes, one can create an account and allow access for example like this: PostgreSQL pg_hba.conf entry example: # TYPE DATABASE USER ADDRESS METHOD host test monit 127.0.0.1/32 md5 Monit configurations example: check process postgresql with pidfile /var/run/postgresql/12-main.pid start program = "/bin/systemctl postgresql start" stop program = "/bin/systemctl postgresql stop" if failed port 5432 protocol pgsql username "monit" password "123456" database "test" then alert =head4 RADIUS Syntax: PROTOCOL RADIUS [SECRET string] I you may specify an alternative secret, default is "testing123". For example: check process radiusd with pidfile /var/run/radiusd.pid start program = "/etc/init.d/freeradius start" stop program = "/etc/init.d/freeradius stop" if failed host 127.0.0.1 port 1812 type udp protocol radius secret pingpong then alert =head4 SIP The SIP protocol is used by communication platform servers such as Asterisk and FreeSWITCH. Syntax: PROTOCOL SIP [TARGET valid@uri] [MAXFORWARD n] I you may specify an alternative recipient for the message, by adding a valid sip uri after this keyword. I Limit the number of proxies or gateways that can forward the request to the next server. It's value is an integer in the range 0-255, set by default to 70. If max-forward = 0, the next server may respond 200 OK (test succeeded) or send a 483 Too Many Hops (test failed) For example: check host openser_all with address 127.0.0.1 if failed port 5060 type udp protocol sip with target "localhost:5060" and maxforward 6 then alert =head4 SMTP Syntax: PROTOCOL SMTP[S] [USERNAME string PASSWORD string] I SMTP username. I SMTP password (special characters can be used, but for non-alphanumerics the password has to be quoted). Credentials are I and when used will perform authentication during testing so you can test that authentication also works. We recommend using I if authentication is to be used to encrypt the communication. If no credentials are set, Monit will just perform a basic protocol test. Example: check process postfix with pidfile /var/spool/postfix/pid/master.pid start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" if failed port 25 protocol smtp then alert Example using authentication and STARTTLS/SMTPS: check process postfix with pidfile /var/spool/postfix/pid/master.pid start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" if failed port 25 protocol smtps username "foo" password "bar" then alert =head4 WEBSOCKET Syntax: PROTOCOL WEBSOCKET [REQUEST string] [HOST string] [ORIGIN string] [VERSION number] I you may specify an alternative Host header I you may specify an alternative request, default is "/" I you may specify an alternative origin, default is "https://mmonit.com" I you may specify an alternative version, default is "0" For example: check host websocket.org with address "echo.websocket.org" if failed port 80 protocol websocket host "echo.websocket.org" request "/" origin 'http://websocket.com' version 13 then alert =head1 MANAGE YOUR MONIT INSTANCES L expands on Monit's capabilities and provides monitoring and management of all your Monit enabled hosts. M/Monit uses Monit as an agent. With regular intervals, Monit sends a status message to M/Monit with a snapshot of the host it is running on. M/Monit presents the collected data in charts and event logs and give you the option to view key performance data of all your hosts in a modern, clean and well designed user interface which also works on mobile devices. From M/Monit, you can also start, stop and restart services on your hosts running Monit. To send data to M/Monit, add the following statement to your Monit control file: SET MMONIT [TIMEOUT SECONDS] [REGISTER WITHOUT CREDENTIALS] [[WITH] HOSTGROUPS '[' "name", ... ']' ] Example: set mmonit https://monit:monit@192.168.1.10:8443/collector Monit will register itself in M/Monit and will start sending status and event messages to M/Monit. We recommend using I as in the example above to ensure that the communication between Monit and M/Monit is secure. The password should be URL encoded if it contains URL-significant characters like ":", "?", "@". The default timeout is 5 seconds, you can customise the timeout using the I option. When Monit registers itself in M/Monit it sends credentials that can be used to perform service actions from M/Monit. You can disable sending credentials by using I and instead manually add credentials in M/Monit. You can optionally add Monit to one or more M/Monit hostgroups. If the hostgroup doesn't exist, it'll be created automatically. Example: set mmonit https://monit:monit@192.168.1.10:8443/collector with hostgroups [ Oslo, "Mail servers" ] =head1 CONFIGURATION EXAMPLES The simplest form is just the check statement. In this example we check to see if our web server is running and raise an alert if not: check process nginx with pidfile /var/run/nginx.pid To have Monit start the server if it's not running, add a start statement: check process nginx with pidfile /var/run/nginx.pid start program = "/etc/init.d/nginx start" Here's a more advanced example for monitoring an apache web-server listening on the default port number for HTTP and HTTPS. In this example Monit will restart apache if it's not accepting connections at the port numbers. The method Monit use for restart is to first execute the stop-program, then wait (up to 30s) for the process to stop and then execute the start-program and wait (30s) for it to start. The length of start or stop wait can be overridden using the 'timeout' option. If Monit was unable to stop or start the service a failed alert message will be sent if you have requested alert messages to be sent. check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" with timeout 60 seconds stop program = "/etc/init.d/httpd stop" if failed port 80 for 2 cycles then restart if failed port 443 for 2 cycles then restart This example demonstrate how you can run a program as a specified user (uid) and with a specified group (gid). Many daemon programs can do the uid and gid switch by themselves, but for those programs that does not (e.g. Java programs), monit's ability to start a program as a certain user can be very useful. In this example we start the Tomcat Java Servlet Engine as the standard I user and group. Please note that Monit can only switch uid and gid for the program if the super-user is running Monit, otherwise Monit will simply ignore the request to change uid and gid. check process tomcat with pidfile /var/run/tomcat.pid start program = "/etc/init.d/tomcat start" as uid "nobody" and gid "nobody" stop program = "/etc/init.d/tomcat stop" # You can also use id numbers instead and write: as uid 99 and with gid 99 if failed port 8080 then alert In this example we use udp for connection testing to check if the name-server is running: check process named with pidfile /var/run/named.pid start program = "/etc/init.d/named start" stop program = "/etc/init.d/named stop" if failed port 53 use type udp protocol dns then restart The following example illustrates how to check if the service 'sophie' is answering connections on its Unix domain socket: check process sophie with pidfile /var/run/sophie.pid start program = "/etc/init.d/sophie start" stop program = "/etc/init.d/sophie stop" if failed unix /var/run/sophie then restart In this example we check an apache web-server running on localhost which answers for several IP-based virtual hosts or vhosts, hence the host statement before port: check process apache with pidfile /var/run/httpd.pid start "/etc/init.d/httpd start" stop "/etc/init.d/httpd stop" if failed host www.sol.no port 80 then alert if failed host shop.sol.no port 443 then alert if failed host chat.sol.no port 80 then alert To make sure that Monit is communicating with a HTTP server a protocol test can be added: check process apache with pidfile /var/run/httpd.pid start "/etc/init.d/httpd start" stop "/etc/init.d/httpd stop" if failed host www.sol.no port 80 protocol http then alert This example demonstrate a different way to check a web-server using the send/expect mechanism: check process apache with pidfile /var/run/httpd.pid start "/etc/init.d/httpd start" stop "/etc/init.d/httpd stop" if failed host www.sol.no port 80 and send "GET / HTTP/1.1\r\nHost: www.sol.no\r\n\r\n" expect "HTTP/[0-9\.]{3} 200.*" then alert Here we ping a remote host to check if it is up and if not, send an alert: check host www.tildeslash.com with address www.tildeslash.com if failed ping then alert In the following example we ask Monit to compute and verify the checksum for the underlying apache binary used by the start and stop programs. If the checksum test should fail, monitoring will be disabled to prevent possibly restarting a compromised binary: check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" stop program = "/etc/init.d/httpd stop" if failed host www.tildeslash.com port 80 then restart depends on apache_bin check file apache_bin with path /usr/local/apache/bin/httpd if failed checksum then unmonitor In this example we ask Monit to test a document's checksum on a remote server. If the checksum was changed we send an alert: check host mmonit.com with address mmonit.com if failed port 80 protocol http and request "/monit/dist/monit-5.7.tar.gz" with checksum f9d26b8393736b5dfad837bb13780786 then alert Here are a couple of tests for some popular communication servers, using the SIP protocol. First we test a FreeSWITCH server and then an Asterisk server check process freeswitch with pidfile /usr/local/freeswitch/log/freeswitch.pid start program = "/usr/local/freeswitch/bin/freeswitch -nc -hp" stop program = "/usr/local/freeswitch/bin/freeswitch -stop" if total memory > 1000.0 MB for 5 cycles then alert if total memory > 1500.0 MB for 5 cycles then alert if total memory > 2000.0 MB for 5 cycles then restart if cpu > 60% for 5 cycles then alert if failed port 5060 type udp protocol SIP target me@foo.bar and maxforward 10 then restart check process asterisk with pidfile /var/run/asterisk/asterisk.pid start program = "/usr/sbin/asterisk" stop program = "/usr/sbin/asterisk -r -x 'shutdown now'" if total memory > 1000.0 MB for 5 cycles then alert if total memory > 1500.0 MB for 5 cycles then alert if total memory > 2000.0 MB for 5 cycles then restart if cpu > 60% for 5 cycles then alert if failed port 5060 type udp protocol SIP and target me@foo.bar maxforward 10 then restart Some servers are slow starters, like for example Java based Application Servers. If we want to keep the poll-cycle low (i.e. < 60 seconds) but allow some services to take its time to start, the B statement is handy: check process dynamo with pidfile /etc/dynamo.pid every 2 cycles start program = "/etc/init.d/dynamo start" stop program = "/etc/init.d/dynamo stop" if failed port 8840 then alert Here is an example where we group together two database entries so you can manage them together, e.g.; 'Monit -g database start all'. The mode statement is also illustrated in the first entry and have the effect that Monit will not try to (re)start this service if it is not running: check process sybase with pidfile /var/run/sybase.pid start = "/etc/init.d/sybase start" stop = "/etc/init.d/sybase stop" mode passive group database check process oracle with pidfile /var/run/oracle.pid start program = "/etc/init.d/oracle start" stop program = "/etc/init.d/oracle stop" if failed port 9001 protocol tns then restart group database This resource checks example will send an alert if CPU usage of the Apache's HTTP daemon and its child processes goes beyond 60% for two cycles. Apache is restarted if the CPU usage is over 80% for five cycles or the memory usage is over 100Mb for five cycles: check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" stop program = "/etc/init.d/httpd stop" if cpu > 40% for 2 cycles then alert if total cpu > 60% for 2 cycles then alert if total cpu > 80% for 5 cycles then restart if mem > 100 MB for 5 cycles then stop This examples demonstrate the timestamp statement with exec and how you may restart apache if its configuration file was changed. check file httpd.conf with path /etc/httpd/httpd.conf if changed timestamp then exec "/etc/init.d/httpd graceful" In this example we demonstrate usage of the extended alert statement and a file check dependency: check process apache with pidfile /var/run/httpd.pid start = "/etc/init.d/httpd start" stop = "/etc/init.d/httpd stop" alert admin@bar on {nonexist, timeout} with mail-format { from: bofh@$HOST subject: apache $EVENT - $ACTION message: This event occurred on $HOST at $DATE. Your faithful employee, monit } if failed host www.tildeslash.com port 80 then restart depend httpd_bin group apache check file httpd_bin with path /usr/local/apache/bin/httpd alert security@bar on {checksum, timestamp, permission, uid, gid} with mail-format {subject: Alaaarrm! on $HOST} if failed checksum and expect 8f7f419955cefa0b33a2ba316cba3659 then unmonitor if failed permission 755 then unmonitor if failed uid "root" then unmonitor if failed gid "root" then unmonitor if changed timestamp then alert group apache In this example, we demonstrate usage of the depend statement. In this case, we want to start oracle and apache. However, we've set up apache to use oracle as a back end, and if oracle is restarted, apache must be restarted as well. check process apache with pidfile /var/run/httpd.pid start = "/etc/init.d/httpd start" stop = "/etc/init.d/httpd stop" depends on oracle check process oracle with pidfile /var/run/oracle.pid start = "/etc/init.d/oracle start" stop = "/etc/init.d/oracle stop" if failed port 9001 for 5 cycles then restart Next, we have 2 services, oracle-import and oracle-export that need to be restarted if oracle is restarted, but are independent of each other. check process oracle with pidfile /var/run/oracle.pid start = "/etc/init.d/oracle start" stop = "/etc/init.d/oracle stop" if failed port 9001 for 3 cycles then restart check process oracle-import with pidfile /var/run/oracle-import.pid start = "/etc/init.d/oracle-import start" stop = "/etc/init.d/oracle-import stop" depends on oracle check process oracle-export with pidfile /var/run/oracle-export.pid start = "/etc/init.d/oracle-export start" stop = "/etc/init.d/oracle-export stop" depends on oracle =head1 FILES F<~/.monitrc> Default run control file F If the control file is not found in the default location and /etc contains a F file, this file will be used instead. F<./monitrc> If the control file is not found in either of the previous two locations, and the current working directory contains a F file, this file is used instead. F<~/.monit.pid> Lock file to help prevent concurrent runs (non-root mode). F Lock file to help prevent concurrent runs (root mode, Linux systems, if /run directory is available). F Lock file to help prevent concurrent runs (root mode, Linux systems). F Lock file to help prevent concurrent runs (root mode, systems without /var/run). F<~/.monit.state> Monit saves its state to this file and utilises information found in this file to recover from a crash. This is a binary file and its content is only of interest to monit. You may set the location of this file in the Monit control file or by using the -s switch when Monit is started. F<~/.monit.id> Monit save its unique id to this file. =head1 ENVIRONMENT No environment variables are used by Monit. However, when Monit executes a start/stop/restart program or an exec action, it will set several environment variables which can be utilised by the executable to get information about the event, which triggered the action. The following environment variable is set for every program executed by monit, including I: =over 4 =item MONIT_SERVICE The name of the service (from monitrc) for which the program is executed. =back The following environment variables are only available in the service start/stop/restart program and exec action context: =over 4 =item MONIT_EVENT The event that occurred on the service =item MONIT_DESCRIPTION A description of the error condition =item MONIT_DATE The time and date (RFC 822 style) the event occurred =item MONIT_HOST The host the event occurred on =back The following environment variables are only available in the I start/stop/restart program and exec action context: =over 4 =item MONIT_PROCESS_PID The process pid. This may be 0 if the process was (re)started, =item MONIT_PROCESS_MEMORY Process memory. This may be 0 if the process was (re)started, =item MONIT_PROCESS_CHILDREN Process children. This may be 0 if the process was (re)started, =item MONIT_PROCESS_CPU_PERCENT Process cpu%. This may be 0 if the process was (re)started, =back The following environment variables are only available for I start/stop/restart program and exec action context: =over 4 =item MONIT_PROGRAM_STATUS The program status (exit value). =back The following environment variables can be used for debugging: =over 4 =item SSLKEYLOGFILE To debug the SSL/TLS connections, Monit supports the SSLKEYLOGFILE= environment variable in debug mode (with the -v option). The log file can be used with Wireshark to decrypt the SSL/TLS communication (set the path to the logfile in Wireshark's "Settings -> Protocols -> TLS -> (Pre)-Master-Secret log filename". =back =head1 SIGNALS If a Monit daemon is running, SIGUSR1 wakes it up from its sleep phase and forces a poll of all services. SIGTERM and SIGINT will gracefully terminate a Monit daemon. The SIGTERM signal is sent to a Monit daemon if Monit is started with the I action argument. Sending a SIGHUP signal to a running Monit daemon will force the daemon to reinitialise itself, specifically it will reread configuration, close and reopen log files. Running Monit in foreground while a background Monit daemon is running will wake up the daemon. =head1 NOTES This is a very silent program. Use the -v switch if you want to see what Monit is doing, and tail -f the log file. Optionally for testing purposes; you can start Monit with the -Iv switch. Monit will then print debug information to the console, to stop monit in this mode, simply press CTRL^C (i.e. SIGINT) in the same console. The syntax (and parser) of the control file was inspired by Eric S. Raymond et al.'s excellent fetchmail program. Some portions of this man page also receive inspiration from the same authors. =head1 COPYRIGHT Copyright (C) 2001-2024 by Tildeslash Ltd. All Rights Reserved. This product 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. =head1 SEE ALSO GNU text utilities; md5sum(1); sha1sum(1); openssl(1); glob(7); regex(7); I =cut monit-5.35.2/aclocal.m40000644000016400001720000012305415007061160011511 00000000000000# generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, [m4_warning([this file was generated for autoconf 2.71. 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'.])]) # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # 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". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([config/ax_check_compile_flag.m4]) m4_include([config/ax_info.m4]) monit-5.35.2/src/0000755000016400001720000000000015007061177010523 500000000000000monit-5.35.2/src/daemonize.c0000644000016400001720000000721515007061157012565 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "monit.h" /** * Transform this program into a daemon and provide methods for * managing the daemon. * * @file */ /* ------------------------------------------------------------------ Public */ /** * Transform a program into a daemon. Inspired by code from Stephen * A. Rago's book, Unix System V Network Programming. */ void daemonize(void) { pid_t pid; if ((pid = fork ()) < 0) { Log_error("Cannot fork a new process\n"); exit (1); } else if (pid != 0) { _exit(0); } // Become a session leader to lose our controlling terminal setsid(); if ((pid = fork ()) < 0) { Log_error("Cannot fork a new process\n"); exit (1); } else if (pid != 0) { _exit(0); } // Change current directory to the root so that other file systems can be unmounted while we're running if (chdir("/") < 0) { Log_error("Cannot chdir to / -- %s\n", STRERROR); exit(1); } // Redirect standard descriptors to /dev/null. Other descriptors should be closed in env.c Util_redirectStdFds(); } /** * Send signal to a daemon process * @param sig Signal to send daemon to * @return true if signal was send, otherwise false */ bool kill_daemon(int sig) { pid_t pid; if ((pid = exist_daemon()) > 0) { if (kill(pid, sig) < 0) { Log_error("Cannot signal the monit daemon process -- %s\n", STRERROR); return false; } } else { Log_info("Monit daemon is not running\n"); return true; } if (sig == SIGTERM) { fprintf(stdout, "Monit daemon with pid [%d] killed\n", (int)pid); fflush(stdout); } return true; } /** * @return true (i.e. the daemons pid) if a daemon process is running, * otherwise false (0) */ pid_t exist_daemon(void) { errno = 0; pid_t pid = Util_getPid(Run.files.pid); if (pid && (getpgid(pid) > -1 || errno == EPERM)) return pid; return 0; } monit-5.35.2/src/spawn.c0000644000016400001720000001013415007061157011734 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include "event.h" #include "alert.h" #include "monit.h" #include "engine.h" #include "spawn.h" // libmonit #include "io/File.h" #include "util/Str.h" #include "util/Fmt.h" #include "system/Time.h" #include "system/Command.h" #include "exceptions/AssertException.h" pid_t spawn(spawn_args_t args) { assert(args); assert(args->S); assert(args->cmd); pid_t status = -1; // Required Service_T S = args->S; command_t cmd = args->cmd; // Optional char *err = args->err; int errlen = args->errlen; Event_T E = args->E; // Check first if the program still exist and is executable (could have been removed/changed while Monit was up) if (! File_isExecutable(cmd->arg[0])) { if (err) snprintf(err, errlen, "'%s' no longer exist or is not executable\n", cmd->arg[0]); return -1; } Command_T C = Command_new(cmd->arg[0]); assert(C); for (int i = 1; i < cmd->length; i++) Command_appendArgument(C, cmd->arg[i]); if (cmd->has_uid) Command_setUid(C, cmd->uid); if (cmd->has_gid) Command_setGid(C, cmd->gid); // Setup the environment with special MONIT_xxx variables. The program // executed may use such variables for various purposes. Command_setEnv(C, "MONIT_DATE", Time_localStr(Time_now(), (char[26]){})); Command_setEnv(C, "MONIT_SERVICE", S->name); Command_setEnv(C, "MONIT_HOST", Run.system->name); Command_setEnv(C, "MONIT_EVENT", E ? Event_get_description(E) : cmd == S->start ? "Started" : cmd == S->stop ? "Stopped" : "No Event"); Command_setEnv(C, "MONIT_DESCRIPTION", E ? E->message : cmd == S->start ? "Started" : cmd == S->stop ? "Stopped" : "No Event"); switch (S->type) { case Service_Process: Command_vSetEnv(C, "MONIT_PROCESS_PID", "%d", S->inf.process->pid); Command_vSetEnv(C, "MONIT_PROCESS_MEMORY", "%llu", (unsigned long long)((double)S->inf.process->mem / 1024.)); Command_vSetEnv(C, "MONIT_PROCESS_CHILDREN", "%d", S->inf.process->children); Command_vSetEnv(C, "MONIT_PROCESS_CPU_PERCENT", "%.1f", S->inf.process->cpu_percent); break; case Service_Program: Command_vSetEnv(C, "MONIT_PROGRAM_STATUS", "%d", S->program->exitStatus); break; default: break; } Process_T P = Command_execute(C); if (P) { status = Process_pid(P); Process_detach(P); Process_free(&P); } else if (err) { snprintf(err, errlen, "Failed to execute '%s' -- %s", cmd->arg[0], System_lastError()); } Command_free(&C); return status; } monit-5.35.2/src/sha1.h0000644000016400001720000000271215007061157011450 00000000000000/* * Public Domain SHA-1 in C By Steve Reid * Sub-licensed with modifications under AGPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef SHA1_H #define SHA1_H #define SHA1_DIGEST_SIZE 20 typedef struct { unsigned int state[5]; unsigned int count[2]; unsigned char buffer[64]; } sha1_context_t; void sha1_init(sha1_context_t *context); void sha1_append(sha1_context_t *context, const unsigned char *data, const size_t len); void sha1_finish(sha1_context_t *context, unsigned char digest[SHA1_DIGEST_SIZE]); #endif monit-5.35.2/src/ssl/0000755000016400001720000000000015007061157011322 500000000000000monit-5.35.2/src/ssl/SslServer.h0000644000016400001720000000416315007061157013347 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef SSLSERVER_H #define SSLSERVER_H #include "config.h" #define T SslServer_T typedef struct T *T; /** * Initialize an SSL server connection * @param socket A socket * @param options SSL options * @return a new SSL server object or NULL if failed */ T SslServer_new(int socket, SslOptions_T options); /** * Delete an SSL server connection * @param S An SSL server object */ void SslServer_free(T *S); /** * Insert an SSL connection to the server connection list * @param S An SSL server object * @return a new SSL connection object or NULL if failed */ Ssl_T SslServer_newConnection(T S); /** * Close and free an accepted SSL server connection and remove it from the connection list * @param C An SSL connection object reference */ void SslServer_freeConnection(Ssl_T *C); /** * Embed an accepted socket in an existing SSL connection * @param C An SSL connection object * @param socket An accepted socket * @param timeout Milliseconds to wait for connection to be established * @return true if succeeded or false if failed */ bool SslServer_accept(Ssl_T C, int socket, int timeout); #undef T #endif monit-5.35.2/src/ssl/Ssl.c0000644000016400001720000012262615007061157012160 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_OPENSSL #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_MEMORY_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #include #include "monit.h" #include "Ssl.h" #include "SslServer.h" // libmonit #include "io/File.h" #include "system/Net.h" #include "system/Time.h" #include "exceptions/AssertException.h" #include "exceptions/IOException.h" /** * SSL implementation * * @file */ //FIXME: refactor Ssl_connect(), Ssl_write() and Ssl_read() + SslServer_accept (and the whole network layer) to be really non-blocking /* ------------------------------------------------------------- Definitions */ /** * Number of random bytes to obtain */ #define RANDOM_BYTES 1024 /** * The PRIMARY random device selected for seeding the PRNG. We use a non-blocking pseudo random device, to generate pseudo entropy. */ #define URANDOM_DEVICE "/dev/urandom" /** * If a non-blocking device is not found on the system a blocking entropy producer is tried instead. */ #define RANDOM_DEVICE "/dev/random" #define SSLERROR ERR_error_string(ERR_get_error(),NULL) #define T Ssl_T struct T { bool accepted; int socket; SslOptions_T options; SSL *handler; SSL_CTX *ctx; X509 *certificate; char error[128]; }; struct SslServer_T { int socket; SSL_CTX *ctx; SslOptions_T options; }; #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) static Mutex_T *instanceMutexTable; #endif static int session_id_context = 1; #ifdef HAVE_SSL_CTX_SET_KEYLOG_CALLBACK static FILE *keylog = NULL; static const char *keylogName = NULL; #endif /* ----------------------------------------------------------------- Private */ #ifdef HAVE_SSL_CTX_SET_KEYLOG_CALLBACK // Close the SSLKEYLOGFILE static void _keylogClose(void) { if (keylog) { if (fclose(keylog) != 0) Log_error("Cannot close the key log file -- %s\n", STRERROR); } } // If the SSLKEYLOGFILE environment variable is set, open the keylog file, to be used with Wireshark for TLS debugging static bool _keylogOpen(void) { if (keylog) { // Open already return true; } if (keylogName) { // Open the file if SSLKEYLOGFILE is set mode_t savemask = umask(0077); keylog = fopen(keylogName, "a"); umask(savemask); if (! keylog) { Log_error("Cannot open the key log file '%s' -- %s\n", keylogName, STRERROR); return false; } atexit(_keylogClose); fprintf(keylog, "# TLS material log file for Monit Wireshark debugging\n"); fflush(keylog); return true; } return false; } // Keylog callback for OpenSSL static void _keylogWrite(const SSL *ssl, const char *line) { if (ssl && keylog && STR_DEF(line)) { fprintf(keylog, "%s\n", line); fflush(keylog); } } // Enable the keylog callback static void _keylogSet(SSL_CTX *ctx) { if (Run.debug && _keylogOpen()) SSL_CTX_set_keylog_callback(ctx, _keylogWrite); } #endif static Ssl_Version _optionsVersion(int version) { return version != -1 ? version : Run.ssl.version != -1 ? Run.ssl.version : SSL_Auto; } static bool _optionsVerify(short verify) { return verify != -1 ? verify : Run.ssl.verify != -1 ? Run.ssl.verify : false; } static bool _optionsAllowSelfSigned(short allowSelfSigned) { return allowSelfSigned != -1 ? allowSelfSigned : Run.ssl.allowSelfSigned != -1 ? Run.ssl.allowSelfSigned : false; } static const char *_optionsCiphers(const char *ciphers) { return ciphers ? ciphers : Run.ssl.ciphers ? Run.ssl.ciphers: CIPHER_LIST; } static const char *_optionsCACertificateFile(const char *CACertificateFile) { return CACertificateFile ? CACertificateFile : Run.ssl.CACertificateFile ? Run.ssl.CACertificateFile: NULL; } static const char *_optionsCACertificatePath(const char *CACertificatePath) { return CACertificatePath ? CACertificatePath : Run.ssl.CACertificatePath ? Run.ssl.CACertificatePath: NULL; } static const char *_optionsServerPEMFile(const char *pemfile) { return pemfile ? pemfile : Run.ssl.pemfile ? Run.ssl.pemfile: NULL; } static const char *_optionsServerPEMChain(const char *pemchain) { return pemchain ? pemchain : Run.ssl.pemchain ? Run.ssl.pemchain: NULL; } static const char *_optionsServerPEMKey(const char *pemkey) { return pemkey ? pemkey : Run.ssl.pemkey ? Run.ssl.pemkey: NULL; } static const char *_optionsClientPEMFile(const char *clientpemfile) { return clientpemfile ? clientpemfile : Run.ssl.clientpemfile ? Run.ssl.clientpemfile: NULL; } static const char *_optionsChecksum(const char *checksum) { return STR_DEF(checksum) ? checksum : STR_DEF(Run.ssl.checksum) ? Run.ssl.checksum : NULL; } static Hash_Type _optionsChecksumType(Hash_Type checksumType) { if (checksumType) return checksumType; else if (Run.ssl.checksumType) return Run.ssl.checksumType; else return Hash_Unknown; } static bool _setVersion(SSL_CTX *ctx, SslOptions_T options) { unsigned long versionMask = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1; #if defined HAVE_TLSV1_1 versionMask |= SSL_OP_NO_TLSv1_1; #endif #if defined HAVE_TLSV1_2 versionMask |= SSL_OP_NO_TLSv1_2; #endif #if defined HAVE_TLSV1_3 versionMask |= SSL_OP_NO_TLSv1_3; #endif short versionAllowed = _optionsVersion(options->version); if (versionAllowed & SSL_V2) { #if defined OPENSSL_NO_SSL2 || ! defined HAVE_SSLV2 Log_error("SSL: SSLv2 not supported\n"); return false; #else if (Run.flags & Run_FipsEnabled) { Log_error("SSL: SSLv2 is not allowed in FIPS mode -- use TLS\n"); return false; } versionMask &= ~SSL_OP_NO_SSLv2; #endif } if (versionAllowed & SSL_V3) { #if defined OPENSSL_NO_SSL3 Log_error("SSL: SSLv3 not supported\n"); return false; #else if (Run.flags & Run_FipsEnabled) { Log_error("SSL: SSLv3 is not allowed in FIPS mode -- use TLS\n"); return false; } versionMask &= ~SSL_OP_NO_SSLv3; #endif } if (versionAllowed & SSL_TLSV1) { #if defined OPENSSL_NO_TLS1_METHOD Log_error("SSL: TLSv1.0 not supported\n"); return false; #else versionMask &= ~SSL_OP_NO_TLSv1; #endif } if (versionAllowed & SSL_TLSV11) { #if defined OPENSSL_NO_TLS1_1_METHOD || ! defined HAVE_TLSV1_1 Log_error("SSL: TLSv1.1 not supported\n"); return false; #else versionMask &= ~SSL_OP_NO_TLSv1_1; #endif } if (versionAllowed & SSL_TLSV12) { #if defined OPENSSL_NO_TLS1_2_METHOD || ! defined HAVE_TLSV1_2 Log_error("SSL: TLSv1.2 not supported\n"); return false; #else versionMask &= ~SSL_OP_NO_TLSv1_2; #endif } if (versionAllowed & SSL_TLSV13) { #if defined OPENSSL_NO_TLS1_3_METHOD || ! defined HAVE_TLSV1_3 Log_error("SSL: TLSv1.3 not supported\n"); return false; #else versionMask &= ~SSL_OP_NO_TLSv1_3; #endif } if (versionAllowed == SSL_Auto) { // Enable TLS 1.2 and 1.3 protocols by default #if ! defined OPENSSL_NO_TLS1_2_METHOD && defined HAVE_TLSV1_2 versionMask &= ~SSL_OP_NO_TLSv1_2; #endif #if ! defined OPENSSL_NO_TLS1_3_METHOD && defined HAVE_TLSV1_3 versionMask &= ~SSL_OP_NO_TLSv1_3; #endif } SSL_CTX_set_options(ctx, versionMask); return true; } static bool _retry(int socket, int *timeout, bool (*callback)(int socket, time_t milliseconds)) { long long start = Time_milli(); if (callback(socket, *timeout)) { long long stop = Time_milli(); if (stop >= start && (*timeout -= stop - start) > 0) // Reduce timeout with guard against backward clock jumps return true; } errno = ETIMEDOUT; return false; } #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) static void _threadID(CRYPTO_THREADID *id) { CRYPTO_THREADID_set_numeric(id, (unsigned long)Thread_self()); } static void _mutexLock(int mode, int n, __attribute__ ((unused)) const char *file, __attribute__ ((unused)) int line) { if (mode & CRYPTO_LOCK) Mutex_lock(instanceMutexTable[n]); else Mutex_unlock(instanceMutexTable[n]); } #endif static int _checkChecksum(T C, X509_STORE_CTX *ctx, X509 *certificate) { Hash_Type checksumType = _optionsChecksumType(C->options->checksumType); const char *checksum = _optionsChecksum(C->options->checksum); if (checksumType != Hash_Unknown && STR_DEF(checksum) && X509_STORE_CTX_get_error_depth(ctx) == 0) { const EVP_MD *hash = NULL; switch (checksumType) { case Hash_Md5: if (Run.flags & Run_FipsEnabled) { X509_STORE_CTX_set_error(ctx, X509_V_ERR_APPLICATION_VERIFICATION); snprintf(C->error, sizeof(C->error), "SSL certificate MD5 checksum is not supported in FIPS mode, please use SHA1"); return 0; } else { hash = EVP_md5(); } break; case Hash_Sha1: hash = EVP_sha1(); break; default: X509_STORE_CTX_set_error(ctx, X509_V_ERR_APPLICATION_VERIFICATION); snprintf(C->error, sizeof(C->error), "Invalid SSL certificate checksum type (0x%x)", checksumType); return 0; } unsigned int len, i = 0; unsigned char realChecksum[EVP_MAX_MD_SIZE]; X509_digest(certificate, hash, realChecksum, &len); while ((i < len) && (checksum[2 * i] != '\0') && (checksum[2 * i + 1] != '\0')) { unsigned char c = (checksum[2 * i] > 57 ? checksum[2 * i] - 87 : checksum[2 * i] - 48) * 0x10 + (checksum[2 * i + 1] > 57 ? checksum[2 * i + 1] - 87 : checksum[2 * i + 1] - 48); if (c != realChecksum[i]) { X509_STORE_CTX_set_error(ctx, X509_V_ERR_APPLICATION_VERIFICATION); snprintf(C->error, sizeof(C->error), "SSL server certificate checksum failed"); return 0; } i++; } } return 1; } static int _saveAndCheckServerCertificates(T C, X509_STORE_CTX *ctx) { if ((C->certificate = X509_STORE_CTX_get_current_cert(ctx))) { return _checkChecksum(C, ctx, C->certificate); } X509_STORE_CTX_set_error(ctx, X509_V_ERR_APPLICATION_VERIFICATION); snprintf(C->error, sizeof(C->error), "cannot get SSL server certificate"); return 0; } static int _verifyServerCertificates(int preverify_ok, X509_STORE_CTX *ctx) { T C = SSL_get_app_data(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx())); if (! C) { Log_error("SSL: cannot get application data\n"); return 0; } *C->error = 0; if (! preverify_ok && _optionsVerify(C->options->verify)) { int error = X509_STORE_CTX_get_error(ctx); switch (error) { case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: if (_optionsAllowSelfSigned(C->options->allowSelfSigned)) { X509_STORE_CTX_set_error(ctx, X509_V_OK); return _saveAndCheckServerCertificates(C, ctx); } snprintf(C->error, sizeof(C->error), "self signed certificate is not allowed, please use a trusted certificate or use the 'selfsigned: allow' SSL option"); break; default: break; } } else { return _saveAndCheckServerCertificates(C, ctx); } return 0; } static int _verifyClientCertificates(int preverify_ok, X509_STORE_CTX *ctx) { T C = SSL_get_app_data(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx())); if (! C) { Log_error("SSL: cannot get application data\n"); return 0; } if (! preverify_ok) { int error = X509_STORE_CTX_get_error(ctx); switch (error) { case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: if (! (_optionsAllowSelfSigned(C->options->allowSelfSigned))) { Log_error("SSL: self-signed certificate is not allowed\n"); return 0; } X509_STORE_CTX_set_error(ctx, X509_V_OK); // Reset error if we accept self-signed certificates break; case X509_V_ERR_INVALID_PURPOSE: break; default: Log_error("SSL: invalid certificate -- %s\n", X509_verify_cert_error_string(error)); return 0; } } #if (OPENSSL_VERSION_NUMBER < 0x10100000L) X509_OBJECT found_cert; if (X509_STORE_CTX_get_error_depth(ctx) == 0 && X509_STORE_get_by_subject(ctx, X509_LU_X509, X509_get_subject_name(X509_STORE_CTX_get_current_cert(ctx)), &found_cert) != 1) { #else X509_OBJECT *found_cert = X509_OBJECT_new(); if (X509_STORE_CTX_get_error_depth(ctx) == 0 && X509_STORE_CTX_get_by_subject(ctx, X509_LU_X509, X509_get_subject_name(X509_STORE_CTX_get_current_cert(ctx)), found_cert) != 1) { #endif Log_error("SSL: no matching certificate found -- %s\n", SSLERROR); X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_REJECTED); #if OPENSSL_VERSION_NUMBER >= 0x10100000L X509_OBJECT_free(found_cert); #endif return 0; } #if OPENSSL_VERSION_NUMBER >= 0x10100000L X509_OBJECT_free(found_cert); #endif return 1; } static bool _setServerNameIdentification(T C, const char *hostname) { #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME struct sockaddr_storage addr; // If the name is set and we use TLS protocol, enable the SNI extension (provided the hostname value is not an IP address) if (hostname && C->options->version != SSL_V2 && C->options->version != SSL_V3 && ! inet_pton(AF_INET, hostname, &(((struct sockaddr_in *)&addr)->sin_addr)) && #ifdef HAVE_IPV6 ! inet_pton(AF_INET6, hostname, &(((struct sockaddr_in6 *)&addr)->sin6_addr)) && #endif ! SSL_set_tlsext_host_name(C->handler, hostname)) { DEBUG("SSL: unable to set the SNI extension to %s\n", hostname); return false; } #endif return true; } static bool _setClientCertificate(T C, const char *file) { if (SSL_CTX_use_certificate_chain_file(C->ctx, file) != 1) { Log_error("SSL client certificate chain loading failed: %s\n", SSLERROR); return false; } if (SSL_CTX_use_PrivateKey_file(C->ctx, file, SSL_FILETYPE_PEM) != 1) { Log_error("SSL client private key loading failed: %s\n", SSLERROR); return false; } if (SSL_CTX_check_private_key(C->ctx) != 1) { Log_error("SSL client private key doesn't match the certificate: %s\n", SSLERROR); return false; } return true; } /* ------------------------------------------------------------------ Public */ void Ssl_start(void) { #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) SSL_library_init(); SSL_load_error_strings(); int locks = CRYPTO_num_locks(); instanceMutexTable = CALLOC(locks, sizeof(Mutex_T)); for (int i = 0; i < locks; i++) Mutex_init(instanceMutexTable[i]); CRYPTO_THREADID_set_callback(_threadID); CRYPTO_set_locking_callback(_mutexLock); #endif if (File_exist(URANDOM_DEVICE)) RAND_load_file(URANDOM_DEVICE, RANDOM_BYTES); else if (File_exist(RANDOM_DEVICE)) RAND_load_file(RANDOM_DEVICE, RANDOM_BYTES); else THROW(AssertException, "SSL: cannot find %s nor %s on the system", URANDOM_DEVICE, RANDOM_DEVICE); #ifdef HAVE_SSL_CTX_SET_KEYLOG_CALLBACK keylogName = getenv("SSLKEYLOGFILE"); #endif } void Ssl_stop(void) { #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) CRYPTO_THREADID_set_callback(NULL); CRYPTO_set_locking_callback(NULL); for (int i = 0; i < CRYPTO_num_locks(); i++) Mutex_destroy(instanceMutexTable[i]); FREE(instanceMutexTable); RAND_cleanup(); ERR_free_strings(); #endif Ssl_threadCleanup(); } void Ssl_threadCleanup(void) { #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) ERR_remove_thread_state(NULL); #endif } #ifdef OPENSSL_FIPS void Ssl_setFipsMode(bool enabled) { if (enabled && ! FIPS_mode() && ! FIPS_mode_set(1)) THROW(AssertException, "SSL: cannot enter FIPS mode -- %s", SSLERROR); else if (! enabled && FIPS_mode() && ! FIPS_mode_set(0)) THROW(AssertException, "SSL: cannot exit FIPS mode -- %s", SSLERROR); } #endif T Ssl_new(SslOptions_T options) { assert(options); T C; NEW(C); C->options = options; #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) const SSL_METHOD *method = SSLv23_client_method(); #else const SSL_METHOD *method = TLS_client_method(); #endif if (! method) { Log_error("SSL: client method initialization failed -- %s\n", SSLERROR); goto sslerror; } if (! (C->ctx = SSL_CTX_new(method))) { Log_error("SSL: client context initialization failed -- %s\n", SSLERROR); goto sslerror; } #ifdef HAVE_SSL_CTX_SET_KEYLOG_CALLBACK _keylogSet(C->ctx); #endif if (! _setVersion(C->ctx, options)) { goto sslerror; } SSL_CTX_set_default_verify_paths(C->ctx); const char *CACertificateFile = _optionsCACertificateFile(options->CACertificateFile); const char *CACertificatePath = _optionsCACertificatePath(options->CACertificatePath); if (CACertificateFile || CACertificatePath) { if (! SSL_CTX_load_verify_locations(C->ctx, CACertificateFile, CACertificatePath)) { Log_error("SSL: CA certificates loading failed -- %s\n", SSLERROR); goto sslerror; } } const char *ClientPEMFile = _optionsClientPEMFile(options->clientpemfile); if (ClientPEMFile && ! _setClientCertificate(C, ClientPEMFile)) goto sslerror; #ifdef SSL_OP_NO_COMPRESSION SSL_CTX_set_options(C->ctx, SSL_OP_NO_COMPRESSION); #endif const char *ciphers = _optionsCiphers(options->ciphers); if (SSL_CTX_set_cipher_list(C->ctx, ciphers) != 1) { Log_error("SSL: client cipher list [%s] error -- no valid ciphers\n", ciphers); goto sslerror; } if (! (C->handler = SSL_new(C->ctx))) { Log_error("SSL: cannot create client handler -- %s\n", SSLERROR); goto sslerror; } SSL_set_verify(C->handler, SSL_VERIFY_PEER, _verifyServerCertificates); SSL_set_mode(C->handler, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); SSL_set_app_data(C->handler, C); return C; sslerror: Ssl_free(&C); return NULL; } void Ssl_free(T *C) { assert(C && *C); if ((*C)->handler) SSL_free((*C)->handler); if ((*C)->ctx && ! (*C)->accepted) SSL_CTX_free((*C)->ctx); FREE(*C); } void Ssl_close(T C) { assert(C); bool retry = false; int timeout = Run.limits.networkTimeout; do { ERR_clear_error(); int rv = SSL_shutdown(C->handler); if (rv == 0) { // uni-directional shutdown: we sent "close notify" but didn't received peer's "close notify" yet (we're not going to wait for it) break; } else if (rv == 1) { // bi-directional shutdown finished break; } else if (rv < 0) { switch (SSL_get_error(C->handler, rv)) { case SSL_ERROR_WANT_READ: retry = _retry(C->socket, &timeout, Net_canRead); break; case SSL_ERROR_WANT_WRITE: retry = _retry(C->socket, &timeout, Net_canWrite); break; default: retry = false; break; } } } while (retry && ! (Run.flags & Run_Stopped)); Net_shutdown(C->socket, SHUT_RDWR); Net_close(C->socket); } void Ssl_connect(T C, int socket, int timeout, const char *name) { assert(C); assert(socket >= 0); C->socket = socket; SSL_set_connect_state(C->handler); SSL_set_fd(C->handler, C->socket); _setServerNameIdentification(C, name); bool retry = false; do { ERR_clear_error(); int rv = SSL_connect(C->handler); if (rv < 0) { switch (SSL_get_error(C->handler, rv)) { case SSL_ERROR_NONE: break; case SSL_ERROR_WANT_READ: retry = _retry(C->socket, &timeout, Net_canRead); break; case SSL_ERROR_WANT_WRITE: retry = _retry(C->socket, &timeout, Net_canWrite); break; default: rv = (int)SSL_get_verify_result(C->handler); if (rv != X509_V_OK) THROW(IOException, "SSL server certificate verification error: %s", *C->error ? C->error : X509_verify_cert_error_string(rv)); else THROW(IOException, "SSL connection error: %s", SSLERROR); break; } } else { break; } } while (retry && ! (Run.flags & Run_Stopped)); } int Ssl_write(T C, const void *b, int size, int timeout) { assert(C); int n = 0; if (size > 0) { bool retry = false; do { ERR_clear_error(); switch (SSL_get_error(C->handler, (n = SSL_write(C->handler, b, size)))) { case SSL_ERROR_NONE: case SSL_ERROR_ZERO_RETURN: return n; case SSL_ERROR_WANT_READ: n = 0; errno = EWOULDBLOCK; retry = _retry(C->socket, &timeout, Net_canRead); break; case SSL_ERROR_WANT_WRITE: n = 0; errno = EWOULDBLOCK; retry = _retry(C->socket, &timeout, Net_canWrite); break; case SSL_ERROR_SYSCALL: { unsigned long error = ERR_get_error(); if (error) Log_error("SSL: write error -- %s\n", ERR_error_string(error, NULL)); else if (n == 0) Log_error("SSL: write error -- EOF\n"); else if (n == -1) Log_error("SSL: write I/O error -- %s\n", STRERROR); } return -1; default: Log_error("SSL: write error -- %s\n", SSLERROR); return -1; } } while (retry && ! (Run.flags & Run_Stopped)); } return n; } int Ssl_read(T C, void *b, int size, int timeout) { assert(C); int n = 0; if (size > 0) { bool retry = false; do { ERR_clear_error(); switch (SSL_get_error(C->handler, (n = SSL_read(C->handler, b, size)))) { case SSL_ERROR_NONE: case SSL_ERROR_ZERO_RETURN: return n; case SSL_ERROR_WANT_READ: n = 0; errno = EWOULDBLOCK; retry = _retry(C->socket, &timeout, Net_canRead); break; case SSL_ERROR_WANT_WRITE: n = 0; errno = EWOULDBLOCK; retry = _retry(C->socket, &timeout, Net_canWrite); break; case SSL_ERROR_SYSCALL: { unsigned long error = ERR_get_error(); if (error) Log_error("SSL: read error -- %s\n", ERR_error_string(error, NULL)); else if (n == 0) Log_error("SSL: read error -- EOF\n"); else if (n == -1) Log_error("SSL: read I/O error -- %s\n", STRERROR); } return -1; default: Log_error("SSL: read error -- %s\n", SSLERROR); return -1; } } while (retry && ! (Run.flags & Run_Stopped)); } return n; } int Ssl_getCertificateValidDays(T C) { if (C && C->certificate) { // Certificates which expired already are caught in preverify => we don't need to handle them here volatile int deltadays = 0; ASN1_TIME *nat = NULL; #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) nat = (ASN1_TIME *)X509_get_notAfter(C->certificate); #else nat = (ASN1_TIME *)X509_get0_notAfter(C->certificate); #endif if (! nat) { THROW(IOException, "unable to get certificate notAfter field"); } #ifdef HAVE_ASN1_TIME_DIFF int deltaseconds; if (! ASN1_TIME_diff((int *)&deltadays, &deltaseconds, NULL, nat)) { THROW(IOException, "invalid time format in certificate's notAfter field"); } #else ASN1_GENERALIZEDTIME *t = ASN1_TIME_to_generalizedtime(nat, NULL); if (! t) { THROW(IOException, "invalid time format (in certificate's notAfter field)"); } TRY { deltadays = (double)(Time_toTimestamp((const char *)t->data) - Time_now()) / 86400.; } ELSE { THROW(IOException, "invalid time format in certificate's notAfter field -- %s", t->data); } FINALLY { ASN1_STRING_free(t); } END_TRY; #endif return deltadays > 0 ? deltadays : 0; } return -1; } char *Ssl_printOptions(SslOptions_T options, char *b, int size) { assert(b); assert(size > 0); *b = 0; if (options->flags) { int count = 0; if (options->version != -1) { int versions = 0; snprintf(b + strlen(b), size - strlen(b) - 1, "version: "); if (options->version & SSL_V2) snprintf(b + strlen(b), size - strlen(b) - 1, "%sSSLv2", versions++ ? " " : ""); if (options->version & SSL_V3) snprintf(b + strlen(b), size - strlen(b) - 1, "%sSSLv3", versions++ ? " " : ""); if (options->version & SSL_TLSV1) snprintf(b + strlen(b), size - strlen(b) - 1, "%sTLSv1.0", versions++ ? " " : ""); if (options->version & SSL_TLSV11) snprintf(b + strlen(b), size - strlen(b) - 1, "%sTLSv1.1", versions++ ? " " : ""); if (options->version & SSL_TLSV12) snprintf(b + strlen(b), size - strlen(b) - 1, "%sTLSv1.2", versions++ ? " " : ""); if (options->version & SSL_TLSV13) snprintf(b + strlen(b), size - strlen(b) - 1, "%sTLSv1.3", versions++ ? " " : ""); count++; } if (options->verify == true) snprintf(b + strlen(b), size - strlen(b) - 1, "%sverify: enable", count++ ? ", " : ""); if (options->allowSelfSigned == true) snprintf(b + strlen(b), size - strlen(b) - 1, "%sselfsigned: allow", count++ ? ", " : ""); if (options->pemfile) snprintf(b + strlen(b), size - strlen(b) - 1, "%spemfile: %s", count ++ ? ", " : "", options->pemfile); if (options->pemchain) snprintf(b + strlen(b), size - strlen(b) - 1, "%spemchain: %s", count ++ ? ", " : "", options->pemchain); if (options->pemkey) snprintf(b + strlen(b), size - strlen(b) - 1, "%spemkey: %s", count ++ ? ", " : "", options->pemkey); if (options->clientpemfile) snprintf(b + strlen(b), size - strlen(b) - 1, "%sclientpemfile: %s", count ++ ? ", " : "", options->clientpemfile); if (options->CACertificateFile) snprintf(b + strlen(b), size - strlen(b) - 1, "%sCACertificateFile: %s", count ++ ? ", " : "", options->CACertificateFile); if (options->CACertificatePath) snprintf(b + strlen(b), size - strlen(b) - 1, "%sCACertificatePath: %s", count ++ ? ", " : "", options->CACertificatePath); if (options->ciphers) snprintf(b + strlen(b), size - strlen(b) - 1, "%sciphers: \"%s\"", count ++ ? ", " : "", options->ciphers); } return b; } /* -------------------------------------------------------------- SSL Server */ SslServer_T SslServer_new(int socket, SslOptions_T options) { assert(socket >= 0); assert(options); SslServer_T S; NEW(S); S->socket = socket; S->options = options; #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) const SSL_METHOD *method = SSLv23_server_method(); #else const SSL_METHOD *method = TLS_server_method(); #endif if (! method) { Log_error("SSL: server method initialization failed -- %s\n", SSLERROR); goto sslerror; } if (! (S->ctx = SSL_CTX_new(method))) { Log_error("SSL: server context initialization failed -- %s\n", SSLERROR); goto sslerror; } if (! _setVersion(S->ctx, options)) { goto sslerror; } if (SSL_CTX_set_session_id_context(S->ctx, (void *)&session_id_context, sizeof(session_id_context)) != 1) { Log_error("SSL: server session id context initialization failed -- %s\n", SSLERROR); goto sslerror; } const char *ciphers = _optionsCiphers(options->ciphers); if (SSL_CTX_set_cipher_list(S->ctx, ciphers) != 1) { Log_error("SSL: server cipher list [%s] error -- no valid ciphers\n", ciphers); goto sslerror; } SSL_CTX_set_options(S->ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); #ifdef SSL_MODE_RELEASE_BUFFERS SSL_CTX_set_mode(S->ctx, SSL_MODE_RELEASE_BUFFERS); #endif #ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION SSL_CTX_set_options(S->ctx, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); #endif #ifdef SSL_OP_NO_RENEGOTIATION SSL_CTX_set_options(S->ctx, SSL_OP_NO_RENEGOTIATION); #endif #ifdef SSL_CTRL_SET_ECDH_AUTO SSL_CTX_set_options(S->ctx, SSL_OP_SINGLE_ECDH_USE); SSL_CTX_set_ecdh_auto(S->ctx, 1); #elif defined HAVE_EC_KEY SSL_CTX_set_options(S->ctx, SSL_OP_SINGLE_ECDH_USE); EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); if (key) { SSL_CTX_set_tmp_ecdh(S->ctx, key); EC_KEY_free(key); } #endif SSL_CTX_set_options(S->ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); #ifdef SSL_OP_NO_COMPRESSION SSL_CTX_set_options(S->ctx, SSL_OP_NO_COMPRESSION); #endif SSL_CTX_set_session_cache_mode(S->ctx, SSL_SESS_CACHE_OFF); const char *pemchain = _optionsServerPEMChain(options->pemchain); const char *pemkey = _optionsServerPEMKey(options->pemkey); const char *pemfile = _optionsServerPEMFile(options->pemfile); if (SSL_CTX_use_certificate_chain_file(S->ctx, pemchain ? pemchain : pemfile) != 1) { Log_error("SSL: server certificate chain loading failed -- %s\n", SSLERROR); goto sslerror; } if (SSL_CTX_use_PrivateKey_file(S->ctx, pemkey ? pemkey : pemfile, SSL_FILETYPE_PEM) != 1) { Log_error("SSL: server private key loading failed -- %s\n", SSLERROR); goto sslerror; } if (SSL_CTX_check_private_key(S->ctx) != 1) { Log_error("SSL: server private key do not match the certificate -- %s\n", SSLERROR); goto sslerror; } const char *clientpemfile = _optionsClientPEMFile(options->clientpemfile); if (clientpemfile) { struct stat sb; if (stat(clientpemfile, &sb) == -1) { Log_error("SSL: client PEM file %s error -- %s\n", clientpemfile, STRERROR); goto sslerror; } if (! S_ISREG(sb.st_mode)) { Log_error("SSL: client PEM file %s is not a file\n", clientpemfile); goto sslerror; } if (! SSL_CTX_load_verify_locations(S->ctx, clientpemfile, NULL)) { Log_error("SSL: client PEM file CA certificates %s loading failed -- %s\n", clientpemfile, SSLERROR); goto sslerror; } SSL_CTX_set_client_CA_list(S->ctx, SSL_load_client_CA_file(clientpemfile)); if (! SSL_CTX_load_verify_locations(S->ctx, pemfile, NULL)) { Log_error("SSL: server certificate CA certificates %s loading failed -- %s\n", pemfile, SSLERROR); goto sslerror; } SSL_CTX_set_verify(S->ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, _verifyClientCertificates); } else { SSL_CTX_set_verify(S->ctx, SSL_VERIFY_NONE, NULL); } return S; sslerror: SslServer_free(&S); return NULL; } void SslServer_free(SslServer_T *S) { assert(S && *S); if ((*S)->ctx) SSL_CTX_free((*S)->ctx); FREE(*S); } T SslServer_newConnection(SslServer_T S) { assert(S); T C; NEW(C); C->accepted = true; C->ctx = S->ctx; if (! (C->handler = SSL_new(C->ctx))) { Log_error("SSL: server cannot create handler -- %s\n", SSLERROR); Ssl_free(&C); return NULL; } SSL_set_mode(C->handler, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); C->options = S->options; return C; } void SslServer_freeConnection(T *C) { assert(C && *C); Ssl_close(*C); Ssl_free(C); } bool SslServer_accept(T C, int socket, int timeout) { assert(C); assert(socket >= 0); C->socket = socket; SSL_set_accept_state(C->handler); SSL_set_fd(C->handler, C->socket); bool retry = false; do { ERR_clear_error(); int rv = SSL_accept(C->handler); if (rv < 0) { switch (SSL_get_error(C->handler, rv)) { case SSL_ERROR_NONE: break; case SSL_ERROR_WANT_READ: retry = _retry(C->socket, &timeout, Net_canRead); break; case SSL_ERROR_WANT_WRITE: retry = _retry(C->socket, &timeout, Net_canWrite); break; default: rv = (int)SSL_get_verify_result(C->handler); if (rv != X509_V_OK) Log_error("SSL client certificate verification error: %s\n", *C->error ? C->error : X509_verify_cert_error_string(rv)); else Log_error("SSL accept error: %s\n", SSLERROR); return false; } } else { break; } } while (retry && ! (Run.flags & Run_Stopped)); return true; } #endif monit-5.35.2/src/ssl/Ssl.h0000644000016400001720000001235715007061157012164 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef SSL_H #define SSL_H #include "config.h" typedef enum { SSL_Disabled = 0, SSL_Enabled, SSL_StartTLS } Ssl_Flags; typedef enum { SSL_Auto = 0x0, SSL_V2 = 0x1, SSL_V3 = 0x2, SSL_TLSV1 = 0x4, SSL_TLSV11 = 0x8, SSL_TLSV12 = 0x10, SSL_TLSV13 = 0x20 } Ssl_Version; typedef struct SslOptions_T { Ssl_Flags flags; /**< SSL flags */ short version; /**< The list of allowed SSL versions */ short verify; /**< true if certificate verification is enabled */ short allowSelfSigned; /**< true if self signed certificate is allowed */ short checksumType; /**< Checksum type */ char *checksum; /**< The expected checksum of the server's certificate */ char *pemfile; /**< Optional server certificate */ char *pemchain; /**< Optional alternative server certificate chain */ char *pemkey; /**< Optional alternative server private key */ char *clientpemfile; /**< Optional client certificate */ char *ciphers; /**< Allowed SSL ciphers list */ char *CACertificateFile; /**< Path to CA certificates PEM file */ char *CACertificatePath; /**< Path to CA certificates directory */ } *SslOptions_T; #define T Ssl_T typedef struct T *T; /* * The list of all ciphers suites in order of strength except those containing anonymous DH ciphers, low bit-size ciphers, export-crippled ciphersm the MD5 hash algorithm and weak DES, RC4 and 3DES ciphers. */ #define CIPHER_LIST "ALL:!DES:!RC4:!aNULL:!LOW:!EXP:!IDEA:!MD5:!3DES:@STRENGTH" /** * Prepare for the beginning of active use of the OpenSSL library */ void Ssl_start(void); /** * Gracefully terminate the active use of the OpenSSL library */ void Ssl_stop(void); /** * Cleanup thread's error queue. */ void Ssl_threadCleanup(void); #ifdef OPENSSL_FIPS /** * Enable or disable FIPS-140 mode * @param enabled true to enable FIPS-140 mode */ void Ssl_setFipsMode(bool enabled); #endif /** * Create a new SSL connection object * @param options SSL options * @return a new SSL connection object or NULL if failed */ T Ssl_new(SslOptions_T options); /** * Free an SSL connection object * @param C A reference to SSL connection object */ void Ssl_free(T *C); /** * Connect a socket using SSL. If name is set and TLS is used, * the Server Name Indication (SNI) TLS extension is enabled. * @param C An SSL connection object * @param socket A socket * @param timeout Milliseconds to wait for connection to be established * @param name A server name string (optional) * @exception IOException or AssertException if failed */ void Ssl_connect(T C, int socket, int timeout, const char *name); /** * Close an SSL connection * @param C An SSL connection object */ void Ssl_close(T C); /** * Write size bytes from b to an encrypted channel * @param C An SSL connection object * @param b The data to be written * @param size Number of bytes in b * @param timeout Milliseconds to wait for data to be written * @return Number of bytes written or -1 if failed */ int Ssl_write(T C, const void *b, int size, int timeout); /** * Read size bytes to b from an encrypted channel * @param C An SSL connection object * @param b A byte buffer * @param size The size of the buffer b * @param timeout Milliseconds to wait for data to be read * @return Number of bytes read or -1 if failed */ int Ssl_read(T C, void *b, int size, int timeout); /** * Get days the certificate remains valid. * @param C An SSL connection object * @return Number of valid days * @exception IOException if failed */ int Ssl_getCertificateValidDays(T C); /** * Print SSL options string representation to the given buffer. * @param options SSL options object * @param b A string buffer * @param size The size of the buffer b * @return Buffer with string representation of SSL options */ char *Ssl_printOptions(SslOptions_T options, char *b, int size); #undef T #endif monit-5.35.2/src/statistics/0000755000016400001720000000000015007061157012713 500000000000000monit-5.35.2/src/statistics/Statistics.h0000644000016400001720000000522115007061157015136 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef STATISTICS_INCLUDED #define STATISTICS_INCLUDED /** * Statistics * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define T Statistics_T typedef struct T { bool initialized; #ifndef __LP64__ unsigned long long raw; #endif struct { unsigned long long time; unsigned long long value; } last; struct { unsigned long long time; unsigned long long value; } current; } *T; /** * Save the counter value and update Statistics object. The update method * handles 32-bit counter wraps. * @param S A Statistics object * @param timestamp A value timestamp [ms] * @param value A raw value to which the object should be set */ void Statistics_update(T S, unsigned long long time, unsigned long long value); /** * Reset Statistics object * @param S A Statistics object */ void Statistics_reset(T S); /** * Return true if the counter was initialized, otherwise false * @param S A Statistics object * @return true if the counter was initialized, otherwise false */ bool Statistics_initialized(T S); /** * Return the last raw value * @param S A Statistics object * @return last raw value */ unsigned long long Statistics_raw(T S); /** * Return the delta between last two updates * @param S A Statistics object * @return delta */ unsigned long long Statistics_delta(T S); /** * Return the delta of value between last two updates normalized to per-second rate * @param S A Statistics object * @return normalized delta [value per second] */ double Statistics_deltaNormalize(T S); #undef T #endif monit-5.35.2/src/statistics/Statistics.c0000644000016400001720000000533315007061157015135 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "monit.h" /** * Statistics * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ------------------------------------------------------------- Definitions */ #define T Statistics_T /* ---------------------------------------------------------------- Public */ void Statistics_update(T S, unsigned long long time, unsigned long long value) { unsigned long long _value = value; #ifndef __LP64__ if (value < S->raw) _value = S->current.value + ULONG_MAX + 1ULL - S->raw + value; // Counter wrapped else _value = S->current.value + value - S->raw; S->raw = value; #endif S->last.time = S->current.time; S->last.value = S->current.value; S->current.time = time; S->current.value = _value; S->initialized = true; } void Statistics_reset(T S) { #ifndef __LP64__ S->raw = 0ULL; #endif S->last.time = S->current.time = S->last.value = S->current.value = 0ULL; S->initialized = false; } bool Statistics_initialized(T S) { return S->initialized; } unsigned long long Statistics_raw(T S) { return S->current.value; } unsigned long long Statistics_delta(T S) { if (S->last.value > 0 && S->current.value > S->last.value) return S->current.value - S->last.value; return 0ULL; } double Statistics_deltaNormalize(T S) { if (S->last.time > 0 && S->current.time > S->last.time) if (S->last.value > 0 && S->current.value > S->last.value) return ((double)(S->current.value - S->last.value) * 1000. / (double)(S->current.time - S->last.time)); return 0.; } monit-5.35.2/src/checksum.h0000644000016400001720000001055315007061157012420 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_CHECKSUM_H #define MONIT_CHECKSUM_H #include "monit.h" /** * This class implements the checksum processing. * * @file */ #define T ChecksumContext_T typedef struct T { bool finished; Hash_Type type; MD_T hash; union { md5_context_t md5; sha1_context_t sha1; } data; } *T; /** * Initialize the checksum context * @param context The checksum context * @param type Type of hash to initialize * @exception AssertException if context is NULL or hash type not MD5 not SHA1 */ void Checksum_init(T context, Hash_Type type); /** * Finish the checksum and store the resut in the hash buffer * @param context The checksum context * @return hash * @exception AssertException if context or hash is NULL */ unsigned char *Checksum_finish(T context); /** * Finish the checksum and store the resut in the hash buffer * @param context The checksum context * @param input The data to be checksummed * @param inputLength The length of data to be checksummed * @exception AssertException if context or input NULL */ void Checksum_append(T context, const char *input, int inputLength); /** * Compare the checksum with a string * @param context The checksum context * @param checksum The checksum string to compare * @exception AssertException if context or checksum is NULL */ void Checksum_verify(T context, const char *checksum); /** * Convert a digest buffer to a char string * @param digest buffer containing a MD digest * @param mdlen digest length * @param result buffer to write the result to. Must be at least 41 bytes long. * @return pointer to result buffer */ char *Checksum_digest2Bytes(unsigned char *digest, int mdlen, MD_T result); /** * Compute SHA1 and MD5 message digests simultaneously for bytes read * from STREAM (suitable for stdin, which is not always rewindable). * The resulting message digest numbers will be written into the first * bytes of resblock buffers. * @param stream The stream from where the digests are computed * @param sha_resblock The buffer to write the SHA1 result to or NULL to skip the SHA1 * @param md5_resblock The buffer to write the MD5 result to or NULL to skip the MD5 * @return false if failed, otherwise true */ bool Checksum_getStreamDigests(FILE *stream, void *sha_resblock, void *md5_resblock); /** * Print MD5 and SHA1 hashes to standard output for given file or standard input * @param file The file for which the hashes will be printed or NULL for stdin */ void Checksum_printHash(char *file); /** * Store the checksum of given file in supplied buffer * @param file The file for which to compute the checksum * @param hashtype The hash type (Hash_Md5 or Hash_Sha1) * @param buf The buffer where the result will be stored * @param bufsize The size of the buffer * @return false if failed, otherwise true */ bool Checksum_getChecksum(char *file, Hash_Type hashtype, char *buf, unsigned long bufsize); /** * Get the HMAC-MD5 signature * @param data The data to sign * @param datalen The length of the data to sign * @param key The key used for the signature * @param keylen The length of the key * @param digest Buffer containing a signature. Must be at least 16 bytes long. */ void Checksum_hmacMD5(const unsigned char *data, int datalen, const unsigned char *key, int keylen, unsigned char *digest); #undef T #endif monit-5.35.2/src/env.c0000644000016400001720000000577215007061157011410 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_PWD_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_CRT_EXTERNS_H #include #endif #include "monit.h" // libmonit #include "io/Dir.h" #include "exceptions/AssertException.h" /** * Initialize the program environment * * @see https://bitbucket.org/tildeslash/monit/commits/cd545838378517f84bdb0989cadf461a19d8ba11 */ void init_env(void) { Util_closeFds(); // Ensure that std descriptors (0, 1 and 2) are open int devnull = open("/dev/null", O_RDWR); if (devnull == -1) { THROW(AssertException, "Cannot open /dev/null -- %s", STRERROR); } for (int i = 0; i < 3; i++) { struct stat st; if (fstat(i, &st) == -1) { if (dup2(devnull, i) < 0) { close(devnull); THROW(AssertException, "dup2 failed -- %s", STRERROR); } } } close(devnull); // Get password struct with user info char buf[4096]; struct passwd pw, *result = NULL; if (getpwuid_r(geteuid(), &pw, buf, sizeof(buf), &result) != 0 || ! result) THROW(AssertException, "getpwuid_r failed -- %s", STRERROR); Run.Env.home = Str_dup(pw.pw_dir); Run.Env.user = Str_dup(pw.pw_name); // Get CWD char t[PATH_MAX]; if (! Dir_cwd(t, PATH_MAX)) THROW(AssertException, "Monit: Cannot read current directory -- %s", STRERROR); Run.Env.cwd = Str_dup(t); } monit-5.35.2/src/control.c0000644000016400001720000005265115007061157012276 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "event.h" #include "util.h" #include "system/Time.h" // libmonit #include "util/Fmt.h" #include "exceptions/AssertException.h" /** * Methods for controlling services managed by monit. * * @file */ /* ------------------------------------------------------------- Definitions */ typedef enum { Process_Stopped = 0, Process_Started } Process_Status; #define RETRY_INTERVAL 100000LL // 100ms in microseconds // TODO: Consider using Time_backoff instead for retry for simplification and clamped timeout /* ----------------------------------------------------------------- Private */ static int _getOutput(InputStream_T in, char *buf, int buflen) { InputStream_setTimeout(in, 0); return InputStream_readBytes(in, buf, buflen - 1); } static int _commandExecute(Service_T S, command_t c, char *msg, int msglen, long long *usec_timeout) { assert(S); assert(c); assert(msg); msg[0] = 0; volatile int status = -1; Command_T C = NULL; TRY { // May throw exception if the program doesn't exist (was removed while Monit was up) C = Command_new(c->arg[0]); } ELSE { snprintf(msg, msglen, "Program %s failed: %s", c->arg[0], Exception_frame.message); } END_TRY; if (C) { long long _timeoutMilli = *usec_timeout / 1000.; for (int i = 1; i < c->length; i++) Command_appendArgument(C, c->arg[i]); if (c->has_uid) Command_setUid(C, c->uid); if (c->has_gid) Command_setGid(C, c->gid); Command_setEnv(C, "MONIT_DATE", Time_localStr(Time_now(), (char[26]){})); Command_setEnv(C, "MONIT_SERVICE", S->name); Command_setEnv(C, "MONIT_HOST", Run.system->name); Command_setEnv(C, "MONIT_EVENT", c == S->start ? "Started" : c == S->stop ? "Stopped" : "Restarted"); Command_setEnv(C, "MONIT_DESCRIPTION", c == S->start ? "Started" : c == S->stop ? "Stopped" : "Restarted"); switch (S->type) { case Service_Process: Command_vSetEnv(C, "MONIT_PROCESS_PID", "%d", S->inf.process->pid); Command_vSetEnv(C, "MONIT_PROCESS_MEMORY", "%llu", (unsigned long long)((double)S->inf.process->mem / 1024.)); Command_vSetEnv(C, "MONIT_PROCESS_CHILDREN", "%d", S->inf.process->children); Command_vSetEnv(C, "MONIT_PROCESS_CPU_PERCENT", "%.1f", S->inf.process->cpu_percent); break; case Service_Program: Command_vSetEnv(C, "MONIT_PROGRAM_STATUS", "%d", S->program->exitStatus); break; default: break; } Process_T P = Command_execute(C); if (P) { do { Time_usleep(RETRY_INTERVAL); *usec_timeout -= RETRY_INTERVAL; } while ((status = Process_exitStatus(P)) < 0 && *usec_timeout > 0 && ! (Run.flags & Run_Stopped)); if (*usec_timeout <= 0) snprintf(msg, msglen, "Program '%s' timed out after %s", Util_commandDescription(c, (char[STRLEN]){}), Fmt_time2str(_timeoutMilli, (char[11]){})); int n, total = 0; char buf[STRLEN]; do { if ((n = _getOutput(Process_errorStream(P), buf, sizeof(buf))) <= 0) n = _getOutput(Process_inputStream(P), buf, sizeof(buf)); if (n > 0) { buf[n] = 0; DEBUG("%s", buf); // Report the first message (override existing plain timeout message if some program output is available) if (! total) snprintf(msg, msglen, "'%s': %s%s", Util_commandDescription(c, (char[STRLEN]){}), *usec_timeout <= 0 ? "Program timed out -- " : "", buf); total += n; } } while (n > 0 && Run.debug && total < 2048); // Limit the debug output (if the program will have endless output, such as 'yes' utility, we have to stop at some point to not spin here forever) Process_detach(P); Process_free(&P); } else { snprintf(msg, msglen, "Program %s failed: %s", c->arg[0], System_lastError()); } Command_free(&C); } return status; } static Process_Status _waitProcessStart(Service_T s, long long *usec_timeout) { long long usec_wait = RETRY_INTERVAL; do { Time_usleep(usec_wait); pid_t pid = ProcessTree_findProcess(s); if (pid) { ProcessTree_init(ProcessEngine_None); ProcessTree_updateProcess(s, pid); return Process_Started; } *usec_timeout -= usec_wait; usec_wait = usec_wait < 1000000 ? usec_wait * 2 : 1000000; // double the wait during each cycle until 1s is reached (ProcessTree_findProcess can be heavy and we don't want to drain power every 100ms on mobile devices) } while (*usec_timeout > 0 && ! (Run.flags & Run_Stopped)); return Process_Stopped; } static Process_Status _waitProcessStop(int pid, long long *usec_timeout) { do { Time_usleep(RETRY_INTERVAL); if (! pid || (getpgid(pid) == -1 && errno != EPERM)) return Process_Stopped; *usec_timeout -= RETRY_INTERVAL; } while (*usec_timeout > 0 && ! (Run.flags & Run_Stopped)); return Process_Started; } static State_Type _check(Service_T s) { assert(s); State_Type rv = State_Succeeded; // The check is performed in passive mode - we want to just check, nested start/stop/restart action is unwanted (alerts are allowed so the user will get feedback what's wrong) Monitor_Mode original = s->mode; s->mode = Monitor_Passive; rv = s->check(s); if (s->type == Service_Program && s->program->P) { // check program executes the program and needs to be called again to collect the exit value and evaluate the status long long usec_timeout = s->program->timeout * USEC_PER_MSEC; do { Time_usleep(RETRY_INTERVAL); usec_timeout -= RETRY_INTERVAL; } while (Process_exitStatus(s->program->P) < 0 && usec_timeout > 0LL && ! (Run.flags & Run_Stopped)); rv = s->check(s); } s->mode = original; return rv; } /* * This is a post-fix recursive function for starting every service * that s depends on before starting s. * @param s A Service_T object * @return true if the service was started otherwise false */ static bool _doStart(Service_T s) { assert(s); bool rv = true; StringBuffer_T sb = StringBuffer_create(64); for (Dependant_T d = s->dependantlist; d; d = d->next ) { Service_T parent = Util_getService(d->dependant); assert(parent); if (parent->monitor != Monitor_Yes || parent->error) { if (_doStart(parent)) { State_Type state = _check(parent); if (state != State_Failed && state != State_Init) continue; } rv = false; StringBuffer_append(sb, "%s%s", StringBuffer_length(sb) ? ", " : "", parent->name); } } if (rv) { if (s->start) { if (s->type != Service_Process || ! ProcessTree_findProcess(s)) { Log_info("'%s' start: '%s'\n", s->name, Util_commandDescription(s->start, (char[STRLEN]){})); char msg[1024]; long long usec_timeout = s->start->timeout * USEC_PER_MSEC; int status = _commandExecute(s, s->start, msg, sizeof(msg), &usec_timeout); if (status < 0 || (s->type == Service_Process && _waitProcessStart(s, &usec_timeout) != Process_Started)) { Event_post(s, Event_Exec, State_Failed, s->action_EXEC, "failed to start (exit status %d) -- %s", status, *msg ? msg : "no output"); rv = false; } else { Event_post(s, Event_Exec, State_Succeeded, s->action_EXEC, "started"); } } } else { Log_debug("'%s' start method not defined\n", s->name); Event_post(s, Event_Exec, State_Succeeded, s->action_EXEC, "monitoring enabled"); } } else { Event_post(s, Event_Exec, State_Failed, s->action_EXEC, "failed to start -- could not start required services: '%s'", StringBuffer_toString(sb)); s->doaction = Action_Start; // Retry the start next cycle } Util_monitorSet(s); StringBuffer_free(&sb); return rv; } static int _executeStop(Service_T s, char *msg, int msglen, long long *usec_timeout) { Log_info("'%s' stop: '%s'\n", s->name, Util_commandDescription(s->stop, (char[STRLEN]){})); return _commandExecute(s, s->stop, msg, msglen, usec_timeout); } static void _evaluateStop(Service_T s, bool succeeded, int exitStatus, char *msg) { if (succeeded) Event_post(s, Event_Exec, State_Succeeded, s->action_EXEC, "stopped"); else Event_post(s, Event_Exec, State_Failed, s->action_EXEC, "failed to stop (exit status %d) -- %s", exitStatus, *msg ? msg : "no output"); } /* * This function simply stops the service s. * @param s A Service_T object * @param unmonitor true if the monitoring should be disabled or false if monitoring should continue (when stop is part of restart) * @return true if the service was stopped otherwise false */ static bool _doStop(Service_T s, bool unmonitor) { assert(s); bool rv = true; if (s->stop) { if (s->monitor != Monitor_Not) { int exitStatus; char msg[1024]; long long usec_timeout = s->stop->timeout * USEC_PER_MSEC; if (s->type == Service_Process) { int pid = ProcessTree_findProcess(s); if (pid) { exitStatus = _executeStop(s, msg, sizeof(msg), &usec_timeout); rv = _waitProcessStop(pid, &usec_timeout) == Process_Stopped ? true : false; _evaluateStop(s, rv, exitStatus, msg); } } else { exitStatus = _executeStop(s, msg, sizeof(msg), &usec_timeout); rv = exitStatus >= 0 ? true : false; _evaluateStop(s, rv, exitStatus, msg); } } } else { Log_debug("'%s' stop skipped -- method not defined\n", s->name); } if (unmonitor) { Util_monitorUnset(s); } else { Util_resetInfo(s); s->monitor = Monitor_Init; } return rv; } /* * This function simply restarts the service s. * @param s A Service_T object */ static bool _doRestart(Service_T s) { assert(s); bool rv = true; if (s->restart) { Log_info("'%s' restart: '%s'\n", s->name, Util_commandDescription(s->restart, (char[STRLEN]){})); Util_resetInfo(s); char msg[1024]; long long usec_timeout = s->restart->timeout * USEC_PER_MSEC; int status = _commandExecute(s, s->restart, msg, sizeof(msg), &usec_timeout); if (status < 0 || (s->type == Service_Process && _waitProcessStart(s, &usec_timeout) != Process_Started)) { rv = false; Event_post(s, Event_Exec, State_Failed, s->action_EXEC, "failed to restart (exit status %d) -- %s", status, msg); } else { Event_post(s, Event_Exec, State_Succeeded, s->action_EXEC, "restarted"); } } else { Log_debug("'%s' restart skipped -- method not defined\n", s->name); } Util_monitorSet(s); return rv; } /* * This is a post- fix recursive function for enabling monitoring every service * that s depends on before monitor s. * @param s A Service_T object */ static void _doMonitor(Service_T s) { assert(s); for (Dependant_T d = s->dependantlist; d; d = d->next ) { Service_T parent = Util_getService(d->dependant); assert(parent); _doMonitor(parent); } Util_monitorSet(s); } /* * This is a function for disabling monitoring * @param s A Service_T object */ static void _doUnmonitor(Service_T s) { assert(s); Util_monitorUnset(s); } /* * This is an in-fix recursive function for control of services that depend on s * @param s A Service_T object * @param action An action for the dependant services * @param unmonitor Disable service monitoring: used for stop action only to differentiate hard/soft stop - see _doStop() * @return true if all depending services were started/stopped otherwise false */ static bool _doDepend(Service_T s, Action_Type action, bool unmonitor) { assert(s); bool rv = true; for (Service_T child = Service_List; child; child = child->next) { for (Dependant_T d = child->dependantlist; d; d = d->next) { if (IS(d->dependant, s->name)) { if (action == Action_Start) { // (re)start children only if it's monitoring is enabled (we keep monitoring flag during restart, allowing to restore original pre-restart configuration) if (child->monitor != Monitor_Not && ! _doStart(child)) rv = false; } else if (action == Action_Monitor) { _doMonitor(child); } // We can start children of current child (2nd+ dependency level) only if the child itself started if (rv) { if (! _doDepend(child, action, unmonitor)) { rv = false; } else { // Stop this service only if all children stopped if (action == Action_Stop && child->monitor != Monitor_Not) { if (! _doStop(child, unmonitor)) rv = false; } else if (action == Action_Unmonitor) { _doUnmonitor(child); } } } if (child->doaction == action) { child->doaction = Action_Ignored; } break; } } } return rv; } /* ------------------------------------------------------------------ Public */ /** * Apply given action to the services list. * @param services A services list * @param action A string describing the action to execute * @return number of errors */ bool control_service_string(List_T services, const char *action) { assert(services); assert(action); Action_Type a = Util_getAction(action); if (a == Action_Ignored) { Log_error("invalid action %s\n", action); return 1; } int errors = 0; for (_list_t s = services->head; s; s = s->next) if (control_service(s->e, a) == false) errors++; return errors; } /** * Check to see if we should try to start/stop service * @param S A service name as stated in the config file * @param A An action id describing the action to execute * @return false for error, otherwise true */ bool control_service(const char *S, Action_Type A) { Service_T s = NULL; bool rv = true; assert(S); if (! (s = Util_getService(S))) { Log_error("Service '%s' -- doesn't exist\n", S); return false; } switch (A) { case Action_Start: rv = _doStart(s); break; case Action_Stop: // Stop this service only if all children which depend on it were stopped if (_doDepend(s, Action_Stop, true)) rv = _doStop(s, true); break; case Action_Restart: Log_info("'%s' trying to restart\n", s->name); // Restart this service only if all children that depend on it were stopped if (_doDepend(s, Action_Stop, false)) { if (s->restart) { if ((rv = _doRestart(s))) _doDepend(s, Action_Start, false); // Start children only if we successfully restarted } else { if (_doStop(s, false)) { if ((rv = _doStart(s))) // Only start if we successfully stopped _doDepend(s, Action_Start, false); // Start children only if we successfully started } else { /* enable monitoring of this service again to allow the restart retry in the next cycle up to timeout limit */ Util_monitorSet(s); } } } break; case Action_Monitor: /* We only enable monitoring of this service and all prerequisite services. Chain of services which depends on this service keeps its state */ _doMonitor(s); break; case Action_Unmonitor: /* We disable monitoring of this service and all services which depends on it */ _doDepend(s, Action_Unmonitor, false); _doUnmonitor(s); break; default: Log_error("Service '%s' -- invalid action %d\n", S, A); rv = false; } if (s->doaction == A) { s->doaction = Action_Ignored; } return rv; } monit-5.35.2/src/notification/0000755000016400001720000000000015007061157013207 500000000000000monit-5.35.2/src/notification/MMonit.c0000644000016400001720000001516215007061157014503 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include "monit.h" #include "event.h" #include "MMonit.h" /** * Connect to a data collector servlet and send the event or status message. * * @file */ /* ------------------------------------------------------------- Definitions */ #define MMONIT_SERVER_HEADER "Server: mmonit/" /* ----------------------------------------------------------------- Private */ /** * Send message to the server * @param C An mmonit object * @param D Data to send * @return true if the message sending succeeded otherwise false */ static bool _send(Socket_T socket, Mmonit_T C, StringBuffer_T sb) { char *auth = Util_getBasicAuthHeader(C->url->user, C->url->password); const void *body = NULL; size_t bodyLength = 0; if (C->compress == MmonitCompress_Yes && StringBuffer_length(sb) > 0) { body = StringBuffer_toCompressed(sb, 6, &bodyLength); } else { body = StringBuffer_toString(sb); bodyLength = StringBuffer_length(sb); } int rv = Socket_print(socket, "POST %s HTTP/1.1\r\n" "Host: %s%s%s:%d\r\n" "Content-Type: text/xml\r\n" "Content-Length: %zu\r\n" "Pragma: no-cache\r\n" "Accept: */*\r\n" "User-Agent: Monit/%s\r\n" "%s" "%s" "\r\n", C->url->path, C->url->ipv6 ? "[" : "", C->url->hostname, C->url->ipv6 ? "]" : "", C->url->port, bodyLength, VERSION, C->compress == MmonitCompress_Yes ? "Content-Encoding: gzip\r\n" : "", auth ? auth : ""); FREE(auth); if (rv < 0 || Socket_write(socket, body, bodyLength) < 0) { Log_error("M/Monit: error sending data to %s -- %s\n", C->url->url, STRERROR); return false; } return true; } /** * Check that the server returns a valid HTTP response * @param C An mmonit object * @return true if the response is valid otherwise false */ static bool _receive(Socket_T socket, Mmonit_T C) { int status; char buf[STRLEN]; if (! Socket_readLine(socket, buf, sizeof(buf))) { Log_error("M/Monit: error receiving data from %s -- %s\n", C->url->url, STRERROR); return false; } Str_chomp(buf); int n = sscanf(buf, "%*s %d", &status); if (n != 1 || (status >= 400)) { Log_error("M/Monit: failed to send message to %s -- %s\n", C->url->url, buf); return false; } if (C->compress == MmonitCompress_Init) { C->compress = MmonitCompress_No; #ifdef HAVE_LIBZ while (Socket_readLine(socket, buf, sizeof(buf))) { if ((buf[0] == '\r' && buf[1] == '\n') || (buf[0] == '\n')) break; Str_chomp(buf); if (Str_startsWith(buf, MMONIT_SERVER_HEADER)) { char *version = buf + strlen(MMONIT_SERVER_HEADER); if (*version) { int major, minor; if (sscanf(version, "%d.%d", &major, &minor) == 2 && (major > 3 || (major == 3 && minor >= 6))) C->compress = MmonitCompress_Yes; } break; } } #endif } return true; } /* ------------------------------------------------------------------ Public */ Handler_Type MMonit_send(Event_T E) { Handler_Type rv = Handler_Mmonit; /* The event is sent to mmonit just once - only in the case that the state changed */ if (! Run.mmonits || (E && ! E->state_changed)) return Handler_Succeeded; StringBuffer_T sb = StringBuffer_create(256); for (Mmonit_T C = Run.mmonits; C; C = C->next) { Socket_T socket = Socket_create(C->url->hostname, C->url->port, Socket_Tcp, Socket_Ip, &(C->ssl), C->timeout); if (! socket) { Log_error("M/Monit: cannot open a connection to %s\n", C->url->url); goto error; } status_xml(sb, E, 2, Socket_getLocalHost(socket, (char[STRLEN]){}, STRLEN), C); if (! _send(socket, C, sb)) { Log_error("M/Monit: cannot send %s message to %s\n", E ? "event" : "status", C->url->url); goto error; } StringBuffer_clear(sb); if (! _receive(socket, C)) { Log_error("M/Monit: %s message to %s failed\n", E ? "event" : "status", C->url->url); goto error; } rv = Handler_Succeeded; // Return success if at least one M/Monit succeeded DEBUG("M/Monit: %s message sent to %s\n", E ? "event" : "status", C->url->url); error: if (socket) Socket_free(&socket); } StringBuffer_free(&sb); return rv; } monit-5.35.2/src/notification/MMonit.h0000644000016400001720000000252015007061157014502 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_MMONIT_H #define MONIT_MMONIT_H /** * M/Monit data collector interface * * @file */ /** * Post event or status message to M/Monit * @param E An event object or NULL for status * @return If failed, return Handler_Mmonit flag or Handler_Succeeded flag if succeeded */ Handler_Type MMonit_send(Event_T); #endif monit-5.35.2/src/notification/SMTP.c0000644000016400001720000002105215007061157014056 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "monit.h" #include "base64.h" #include "SMTP.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Implementation of the SMTP interface. * * RFCs: * https://tools.ietf.org/html/rfc3207 * https://tools.ietf.org/html/rfc4616 * https://tools.ietf.org/html/rfc4954 * https://tools.ietf.org/html/rfc5321 * https://tools.ietf.org/html/rfc6409 * * @file */ /* ------------------------------------------------------------- Definitions */ typedef enum { MTA_None = 0x0, MTA_StartTLS = 0x1, MTA_AuthPlain = 0x2, MTA_AuthLogin = 0x4 } MTA_Flags; typedef enum { SMTP_Init = 0, SMTP_Greeting, SMTP_Helo, SMTP_StartTLS, SMTP_Auth, SMTP_MailFrom, SMTP_RcptTo, SMTP_DataBegin, SMTP_DataCommit, SMTP_Quit } SMTP_State; #define T SMTP_T struct T { MTA_Flags flags; SMTP_State state; Socket_T socket; const char *name; }; /* ----------------------------------------------------------------- Private */ // Note: we parse currently only flags for which we have some use static void _parseFlags(T S, const char *line) { const char *flag = line + 4; if (Str_startsWith(flag, "STARTTLS")) { S->flags |= MTA_StartTLS; } else if (Str_startsWith(flag, "AUTH")) { if (Str_sub(flag, " PLAIN")) S->flags |= MTA_AuthPlain; if (Str_sub(flag, " LOGIN")) S->flags |= MTA_AuthLogin; } } __attribute__((format (printf, 2, 3))) static void _send(T S, const char *data, ...) { va_list ap; va_start(ap, data); char *msg = Str_vcat(data, ap); va_end(ap); DEBUG("SMTP -> %s\n", msg); int rv = Socket_write(S->socket, msg, strlen(msg)); FREE(msg); if (rv <= 0) THROW(IOException, "Error sending data to the mailserver -- %s", STRERROR); } static void _receive(T S, int code, void (*callback)(T S, const char *line)) { int status = 0; char line[STRLEN]; do { if (! Socket_readLine(S->socket, line, sizeof(line))) THROW(IOException, "Error receiving data from the mailserver -- %s", STRERROR); Str_chomp(line); DEBUG("SMTP <- %s\n", line); if (strlen(line) < 4 || sscanf(line, "%d", &status) != 1 || status != code) THROW(ProtocolException, "Mailserver response error -- %s", line); if (callback) callback(S, line); } while (line[3] == '-'); // multi-line response } /* ------------------------------------------------------------------ Public */ T SMTP_new(Socket_T socket) { assert(socket); T S; NEW(S); S->socket = socket; return S; } void SMTP_free(T *S) { assert(S && *S); TRY { if ((*S)->state != SMTP_Quit && (*S)->state > SMTP_Init) SMTP_quit(*S); } ELSE { Log_error("SMTP: %s\n", Exception_frame.message); } FINALLY { FREE(*S); } END_TRY; } void SMTP_greeting(T S) { assert(S); _receive(S, 220, NULL); S->state = SMTP_Greeting; } void SMTP_helo(T S, const char *name) { assert(S); S->name = name; _send(S, "EHLO %s\r\n", name); TRY { _receive(S, 250, _parseFlags); } ELSE { // If EHLO failed, fallback to HELO, but if it fails too, let the exception bubble up _send(S, "HELO %s\r\n", name); _receive(S, 250, NULL); } END_TRY; S->state = SMTP_Helo; } void SMTP_starttls(T S, SslOptions_T options) { assert(S); if (S->flags & MTA_StartTLS) { _send(S, "STARTTLS\r\n"); _receive(S, 220, NULL); // Switch to TLS Socket_enableSsl(S->socket, options, NULL); // Reset state and flags and send EHLO again (see RFC 3207 section 4.2) S->flags = MTA_None; S->state = SMTP_Greeting; SMTP_helo(S, S->name); } else { THROW(ProtocolException, "STARTTLS required but the mail server doesn't support it"); } S->state = SMTP_StartTLS; } void SMTP_auth(T S, const char *username, const char *password) { assert(S); assert(username); assert(password); char buffer[STRLEN] = {}; // PLAIN has precedence if (S->flags & MTA_AuthPlain) { int len = snprintf(buffer, STRLEN, "%c%s%c%s", '\0', username, '\0', password); char *b64 = encode_base64(len, (unsigned char *)buffer); TRY { _send(S, "AUTH PLAIN %s\r\n", b64); _receive(S, 235, NULL); } FINALLY { FREE(b64); } END_TRY; } else if (S->flags & MTA_AuthLogin) { _send(S, "AUTH LOGIN\r\n"); _receive(S, 334, NULL); strncpy(buffer, username, sizeof(buffer) - 1); char *username_b64 = encode_base64(strlen(buffer), (unsigned char *)buffer); TRY { _send(S, "%s\r\n", username_b64); _receive(S, 334, NULL); } FINALLY { FREE(username_b64); } END_TRY; strncpy(buffer, password, sizeof(buffer) - 1); char *password_b64 = encode_base64(strlen(buffer), (unsigned char *)buffer); TRY { _send(S, "%s\r\n", password_b64); _receive(S, 235, NULL); } FINALLY { FREE(password_b64); } END_TRY; } else { THROW(ProtocolException, "Authentication failed -- no supported authentication methods found"); } S->state = SMTP_Auth; } void SMTP_from(T S, const char *from) { assert(S); assert(from); _send(S, "MAIL FROM: <%s>\r\n", from); _receive(S, 250, NULL); S->state = SMTP_MailFrom; } void SMTP_to(T S, const char *to) { assert(S); assert(to); _send(S, "RCPT TO: <%s>\r\n", to); _receive(S, 250, NULL); S->state = SMTP_RcptTo; } void SMTP_dataBegin(T S) { assert(S); _send(S, "DATA\r\n"); _receive(S, 354, NULL); S->state = SMTP_DataBegin; } void SMTP_dataCommit(T S) { assert(S); _send(S, "\r\n.\r\n"); _receive(S, 250, NULL); S->state = SMTP_DataCommit; } void SMTP_quit(T S) { _send(S, "QUIT\r\n"); _receive(S, 221, NULL); S->state = SMTP_Quit; } monit-5.35.2/src/notification/Address.c0000644000016400001720000000331015007061157014655 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "monit.h" /** * Implementation of the Address class. * * @file */ /* ------------------------------------------------------------- Definitions */ #define T Address_T /* ------------------------------------------------------------------ Public */ T Address_new(void) { Address_T A; NEW(A); return A; } void Address_free(T *A) { assert(A && *A); FREE((*A)->name); FREE((*A)->address); FREE(*A); } T Address_copy(T A) { assert(A); Address_T C = Address_new(); C->name = A->name ? Str_dup(A->name) : NULL; C->address = A->address ? Str_dup(A->address) : NULL; return C; } monit-5.35.2/src/notification/Address.h0000644000016400001720000000311015007061157014660 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_ADDRESS_H #define MONIT_ADDRESS_H #define T Address_T typedef struct T { char *name; char *address; } *T; /** * Create a new Address object * @return Address object */ T Address_new(void); /** * Destroy the Address object * @param A A reference to the Address object * @exception AssertException if reference is NULL */ void Address_free(T *A); /** * Copy address object. * @param A An Address object to copy * @return An Address object copy * @exception AssertException if reference is NULL */ T Address_copy(T A); #undef T #endif monit-5.35.2/src/notification/SMTP.h0000644000016400001720000001104715007061157014066 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_NOTIFICATION_SMTP_H #define MONIT_NOTIFICATION_SMTP_H #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SETJMP_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "monit.h" #include "base64.h" // libmonit #include "system/Time.h" #include "exceptions/IOException.h" /** * SMTP interface * * RFCs: * https://www.ietf.org/rfc/rfc3207.txt * https://www.ietf.org/rfc/rfc5321.txt * * @file */ #define T SMTP_T typedef struct T *T; /** * Create a new SMTP protocol object. * @param socket A socket connected to an SMTP server * @return SMTP object * @exception AssertException if socket is NULL */ T SMTP_new(Socket_T socket); /** * Destroy the SMTP protocol object. * @param S A reference to the SMTP protocol object * @exception AssertException if reference is NULL */ void SMTP_free(T *S); /** * Read an SMTP server greeting and check for status code 220 in * response. * @param S The SMTP protocol object * @exception AssertException if S is NULL, IOException if failed */ void SMTP_greeting(T S); /** * Send an EHLO command to the SMTP server (fallback to HELO if not * supported) and check for status code 250 in response. * @param S The SMTP protocol object * @param name A name to send in the EHLO/HELO command * @exception AssertException if S is NULL, IOException if failed */ void SMTP_helo(T S, const char *name); /** * Send an STARTTLS command to the SMTP server and check for status * code 220 in response. * @param S The SMTP protocol object * @param options The SSL options. * @exception AssertException if S is NULL, IOException if failed */ void SMTP_starttls(T S, SslOptions_T options); /** * Perform a SMTP authentication (using either PLAIN or LOGIN). * @param S The SMTP protocol object * @param username A username to use. * @param password A password to use. * @exception AssertException if S, username or password is NULL, * IOException if failed */ void SMTP_auth(T S, const char *username, const char *password); /** * Send a MAIL FROM command to the SMTP server and check for status * code 250 in response. * @param S The SMTP protocol object * @param from A sender address * @exception AssertException if S or from is NULL, IOException if failed */ void SMTP_from(T S, const char *from); /** * Send a RCPT TO command to the SMTP server and check for status * code 250 in response. * @param S The SMTP protocol object * @param to A recipient address * @exception AssertException if S or to is NULL, IOException if failed */ void SMTP_to(T S, const char *to); /** * Send a DATA command to the SMTP server and check for status * code 354 in response. * @param S The SMTP protocol object * @exception AssertException if S is NULL, IOException if failed */ void SMTP_dataBegin(T S); /** * Commit SMTP DATA and check for status code 250 in response. * @param S The SMTP protocol object * @exception AssertException if S is NULL, IOException if failed */ void SMTP_dataCommit(T S); /** * Send a QUIT command to the SMTP server and check for status * code 221 in response. * @param S The SMTP protocol object * @exception AssertException if S is NULL, IOException if failed */ void SMTP_quit(T S); #undef T #endif monit-5.35.2/src/sha1.c0000644000016400001720000001535515007061157011452 00000000000000/* * Public Domain SHA-1 in C By Steve Reid * Sub-licensed with modifications under AGPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #include "sha1.h" #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ #ifdef WORDS_BIGENDIAN #define blk0(i) block->l[i] #else #define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) | (rol(block->l[i],8)&0x00FF00FF)) #endif #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] ^block->l[(i+2)&15]^block->l[i&15],1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); /* Hash a single 512-bit block. This is the core of the algorithm. */ #if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 12 __attribute__((no_sanitize("unsigned-integer-overflow", "unsigned-shift-base"))) #elif defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 4 __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif static void sha1_transform(unsigned int state[5], const unsigned char buffer[64]) { unsigned int a, b, c, d, e; typedef union { unsigned char c[64]; unsigned int l[16]; } CHAR64LONG16; CHAR64LONG16 block[1]; memcpy(block, buffer, 64); /* Copy context->state[] to working vars */ a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; /* 4 rounds of 20 operations each. Loop unrolled. */ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); /* Add the working vars back into context.state[] */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; } /* Initialize new context */ void sha1_init(sha1_context_t *context) { /* SHA1 initialization constants */ context->state[0] = 0x67452301; context->state[1] = 0xEFCDAB89; context->state[2] = 0x98BADCFE; context->state[3] = 0x10325476; context->state[4] = 0xC3D2E1F0; context->count[0] = context->count[1] = 0; } /* Run your data through this. */ void sha1_append(sha1_context_t *context, const unsigned char * data, const size_t len) { size_t i, j; j = (context->count[0] >> 3) & 63; if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; context->count[1] += (len >> 29); if ((j + len) > 63) { memcpy(&context->buffer[j], data, (i = 64-j)); sha1_transform(context->state, context->buffer); for ( ; i + 63 < len; i += 64) sha1_transform(context->state, data + i); j = 0; } else { i = 0; } memcpy(&context->buffer[j], &data[i], len - i); } /* Add padding and return the message digest. */ void sha1_finish(sha1_context_t *context, unsigned char digest[SHA1_DIGEST_SIZE]) { unsigned int i; unsigned char finalcount[8]; for (i = 0; i < 8; i++) finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ sha1_append(context, (const unsigned char *)"\200", 1); while ((context->count[0] & 504) != 448) sha1_append(context, (const unsigned char *)"\0", 1); sha1_append(context, finalcount, 8); /* Should cause a sha1_transform() */ for (i = 0; i < SHA1_DIGEST_SIZE; i++) digest[i] = (unsigned char)((context->state[i >> 2] >> ((3-(i & 3)) * 8) ) & 255); /* Wipe variables */ memset(context->buffer, 0, 64); memset(context->state, 0, 20); memset(context->count, 0, 8); memset(finalcount, 0, 8); } monit-5.35.2/src/file.h0000644000016400001720000000737615007061157011546 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_FILE_H #define MONIT_FILE_H /** * Utilities used for managing files used by monit. * * @file */ /** * Initialize the programs file variables */ void file_init(void); /** * Finalize and remove temporary files */ void file_finalize(void); /** * Search the system for the monit control file. Try first ~/.monitrc, * if that fails try /etc/monitrc, then /usr/local/etc/monitrc and * finally ./monitrc. Exit the application if the control file was * not found. * @return The location of monits control file (monitrc) */ char *file_findControlFile(void); /** * Create a program's pidfile - Such a file is created when in daemon * mode. * @param pidfile The name of the pidfile to create * @return true if the file was created, otherwise false. */ bool file_createPidFile(const char *pidfile); /** * Security check for files. The files must have the same uid as the * REAL uid of this process, it must have permissions no greater than * "maxpermission" and it must not be a symbolic link. We check these * conditions here. * @param filename The filename of the checked file * @param description The description of the checked file * @param permmask The permission mask for the file * @return true if the test succeeded otherwise false */ bool file_checkStat(const char *filename, const char *description, mode_t permmask); /** * Check whether the specified directory exist or create it using * specified mode. * @param path The fully qualified path to the directory * @return true if the succeeded otherwise false */ bool file_checkQueueDirectory(const char *path); /** * Check the queue size limit. * @param path The fully qualified path to the directory * @param mode The queue limit * @return true if the succeeded otherwise false */ bool file_checkQueueLimit(const char *path, int limit); /** * Write data to the queue file * @param file Filedescriptor to write to * @param data Data to be written * @param size Size of the data to be written * @return true if the succeeded otherwise false */ bool file_writeQueue(FILE *file, const void *data, size_t size); /** * Read the data from the queue file's actual position * @param file Filedescriptor to read from * @param size Size of the data read * @return The data read if any or NULL. The size parameter is set * appropriately. */ void *file_readQueue(FILE *file, size_t *size); /** * Reads an proc filesystem object * @param buf buffer to write to * @param buf_size size of buf * @param name name of proc object * @param pid number of the process or < 0 if main directory * @param bytes_read number of bytes read to buffer * @return true if succeeded otherwise false. */ bool file_readProc(char *buf, int buf_size, const char *name, int pid, int *bytes_read); #endif monit-5.35.2/src/util.h0000644000016400001720000002216415007061157011574 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_UTIL_H #define MONIT_UTIL_H /** * General purpose utility methods. * * @file */ /** * Replace all occurrences of the sub-string old in the string src * with the sub-string new. The method is case sensitive for the * sub-strings new and old. The string parameter src must be an * allocated string, not a character array. * @param src An allocated string reference (e.g. &string) * @param old The old sub-string * @param new The new sub-string * @return src where all occurrences of the old sub-string are * replaced with the new sub-string. */ char *Util_replaceString(char **src, const char *old, const char *new); /** * Count the number the sub-string word occurs in s. * @param s The String to search for word in * @param word The sub-string to count in s */ size_t Util_countWords(const char *s, const char *word); /** * Exchanges \escape sequences in a string * @param buf A string * @return String, or NULL if unbalanced escape sequence was found */ char *Util_handleEscapes(char *buf); /** * Variant of Util_handleEscapes() which only handle \0x00 escape sequences * in a string * @param buf A string * @return The new length of buf */ int Util_handle0Escapes(char *buf); /** * @param name A service name as stated in the config file * @return the named service or NULL if not found */ Service_T Util_getService(const char *name); /** * @param name A service name as stated in the config file * @return true if the service name exist in the * servicelist, otherwise false */ bool Util_existService(const char *name); /** * Get the length of the service list, that is; the number of services * managed by monit * @return The number of services monitored */ int Util_getNumberOfServices(void); /** * Print the Runtime object */ void Util_printRunList(void); /** * Print a service object * @param p A Service_T object */ void Util_printService(Service_T s); /** * Print all the services in the servicelist */ void Util_printServiceList(void); /** * Get a random token * @param token buffer to store the MD digest * @return pointer to token buffer */ char *Util_getToken(MD_T token); /** * Open and read the id from the given idfile. If the idfile doesn't exist, * generate new id and store it in the id file. * @param idfile An idfile with full path * @return the id or NULL */ char *Util_monitId(char *idfile); /** * Open and read the pid from the given pidfile. * @param pidfile A pidfile with full path * @return the pid or -1 if the pid could * not be read from the file */ pid_t Util_getPid(char *pidfile); /** * Returns true if url contains url safe characters otherwise false * @param url an url string to test * @return true if url is url safe otherwise false */ bool Util_isurlsafe(const char *url); /** * Escape an url string converting unsafe characters to a hex (%xx) * representation. The caller must free the returned string. * @param string a string to encode * @param isParameterValue true if the string is url parameter value * @return the escaped string */ char *Util_urlEncode(const char *string, bool isParameterValue); /** * Unescape an url string. The url parameter is modified * by this method. * @param url an escaped url string * @return A pointer to the unescaped urlstring */ char *Util_urlDecode(char *url); /** * @return a Basic Authentication Authorization string (RFC 2617), * NULL if username is not defined. */ char *Util_getBasicAuthHeader(char *username, char *password); /** * Redirect the standard file descriptors to /dev/null and route any * error messages to the log file. */ void Util_redirectStdFds(void); /* * Close all filedescriptors except standard. */ void Util_closeFds(void); /* * Check if monit does have credentials for this user. If successful * a pointer to the password is returned. */ Auth_T Util_getUserCredentials(char *uname); /** * Check if the given password match the registered password for the * given username. * @param uname Username * @param outside The password to test * @return true if the passwords match for the given uname otherwise * false */ bool Util_checkCredentials(char *uname, char *outside); /** * Reset the service information structure * @param s A Service_T object */ void Util_resetInfo(Service_T s); /** * Are service status data available? * @param s The service to test * @return true if available otherwise false */ bool Util_hasServiceStatus(Service_T s); /** * Construct a HTTP/1.1 Host header utilizing information from the * socket. The returned hostBuf is set to "hostname:port" or to the * empty string if information is not available or not applicable. * @param s A connected socket * @param hostBuf the buffer to write the host-header to * @param len Length of the hostBuf * @return the hostBuffer */ char *Util_getHTTPHostHeader(Socket_T s, char *hostBuf, int len); /** * Evaluate a qualification expression. * @param operator The qualification operator * @param left Expression lval * @param rightExpression rval * @return the boolean value of the expression */ bool Util_evalQExpression(Operator_Type operator, long long left, long long right); /** * Evaluate a qualification expression. * @param operator The qualification operator * @param left Expression lval * @param rightExpression rval * @return the boolean value of the expression */ bool Util_evalDoubleQExpression(Operator_Type operator, double left, double right); /* * This will enable service monitoring in the case that it was disabled. * @param s A Service_T object */ void Util_monitorSet(Service_T s); /* * This will disable service monitoring in the case that it is enabled * @param s A Service_T object */ void Util_monitorUnset(Service_T s); /* * Return appropriate action id for string * @param action A action string * @return the action id */ int Util_getAction(const char *action); /* * Append full action description to given string buffer * @param action An action object * @param buf StringBuffer * @return StringBuffer reference */ StringBuffer_T Util_printAction(Action_T action, StringBuffer_T buf); /** * Append event ratio needed to trigger the action to given string buffer * @param action A action string * @param buf StringBuffer * @return StringBuffer reference */ StringBuffer_T Util_printEventratio(Action_T action, StringBuffer_T buf); /** * Append a rule description to the given StringBuffer. The description * consists of the formatted string given by the rule argument and constant * part which describes rule actions based on the action argument. * @param inverse Inverse test flag * @param buf StringBuffer * @param action An EventAction object * @param rule Rule description * @return StringBuffer reference */ StringBuffer_T Util_printRule(bool inverse, StringBuffer_T buf, EventAction_T action, const char *rule, ...) __attribute__((format (printf, 4, 5))); /** * Print port IP version description * @param p A port structure * @return the socket IP version description */ const char *Util_portIpDescription(Port_T p); /** * Print port type description * @param p A port structure * @return the socket type description */ const char *Util_portTypeDescription(Port_T p); /** * Print port request description * @param p A port structure * @return the request description */ const char *Util_portRequestDescription(Port_T p); /** * Print full port description \[\]:[request][ via TCP|TCPSSL|UDP] * @param p A port structure * @param buf Buffer * @param bufsize Buffer size * @return the buffer */ char *Util_portDescription(Port_T p, char *buf, int bufsize); /** * Print a command description * @param command Command object * @param s A result buffer, must be large enough to hold STRLEN chars * @return A pointer to s */ char *Util_commandDescription(command_t command, char s[STRLEN]); /** * Return string presentation of TIME_* unit * @param time The TIME_* unit (see monit.h) * @return string */ const char *Util_timestr(int time); /** * Swap previous and current filesystem flags in the ringbuffer * @flags Filesystem flags */ void Util_swapFilesystemFlags(FilesystemFlags_T flags); #endif monit-5.35.2/src/spawn.h0000644000016400001720000000444615007061157011752 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef SPAWN_INCLUDED #define SPAWN_INCLUDED typedef struct spawn_args_t { /// Required: The Service_T object that request the new process Service_T S; /// Required: The command_t object containing the command to execute command_t cmd; /// Optional: The event associated with the Servvice. Used to set /// environment description Event_T E; /// Optional: Write any error to this buffer. If not set, the /// caller is expected to use errno to report the error char *err; // Optional: Required: if err is non-null int errlen; } *spawn_args_t; /// Create Service related processes' such as those given in a 'check process' /// start, stop and restart statement or by any associated 'exec' statements. /// The Process created from the 'start' program is special as it represents /// the Service and the pid saved in a Service's pid-file. Processes created /// by this method are created detached. /// @param args A struct with information on how to create the process. /// @return If creating the process failed, -1 is returned and errno set to /// indicate the error that occured. On success the process identification /// number (pid) of the new process is returned. pid_t spawn(spawn_args_t args); #endif /* spawn_h */ monit-5.35.2/src/y.tab.c0000644000016400001720000150031215007061176011625 00000000000000/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ #define YYBISON 30802 /* Bison version string. */ #define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* First part of user prologue. */ #line 26 "src/p.y" /* Turn off unreachable code warnings for the entire generated parser */ #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunreachable-code" #endif /* * DESCRIPTION * Simple context-free grammar for parsing the control file. * */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_PWD_H #include #endif #ifdef HAVE_GRP_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ASM_PARAM_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_SYSLOG_H #include #endif #ifdef HAVE_NETINET_IN_SYSTM_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_NETINET_IP_H #include #endif #ifdef HAVE_NETINET_IP_ICMP_H #include #endif #ifdef HAVE_REGEX_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_OPENSSL #include #endif #include "monit.h" #include "protocol.h" #include "engine.h" #include "alert.h" #include "device.h" #include "processor.h" #include "md5.h" #include "sha1.h" #include "checksum.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" #include "io/File.h" #include "util/Str.h" #include "thread/Thread.h" /* ------------------------------------------------------------- Definitions */ struct precedence_t { bool daemon; bool logfile; bool pidfile; bool idfile; bool statefile; }; struct rate_t { unsigned int count; unsigned int cycles; }; /* yacc interface */ void yyerror(const char *,...) __attribute__((format (printf, 1, 2))); void yyerror2(const char *,...) __attribute__((format (printf, 1, 2))); void yywarning(const char *,...) __attribute__((format (printf, 1, 2))); void yywarning2(const char *,...) __attribute__((format (printf, 1, 2))); /* lexer interface */ int yylex(void); extern FILE *yyin; extern int lineno; extern int arglineno; extern char *yytext; extern char *argyytext; extern char *currentfile; extern char *argcurrentfile; extern int buffer_stack_ptr; /* Local variables */ static int cfg_errflag = 0; static Service_T tail = NULL; static Service_T current = NULL; static Request_T urlrequest = NULL; static command_t command = NULL; static command_t command1 = NULL; static command_t command2 = NULL; static Service_T depend_list = NULL; static struct Uid_T uidset = {}; static struct Gid_T gidset = {}; static struct Pid_T pidset = {}; static struct Pid_T ppidset = {}; static struct FsFlag_T fsflagset = {}; static struct NonExist_T nonexistset = {}; static struct Exist_T existset = {}; static struct Status_T statusset = {}; static struct Perm_T permset = {}; static struct Size_T sizeset = {}; static struct NLink_T nlinkset = {}; static struct Uptime_T uptimeset = {}; static struct ResponseTime_T responsetimeset = {}; static struct LinkStatus_T linkstatusset = {}; static struct LinkSpeed_T linkspeedset = {}; static struct LinkSaturation_T linksaturationset = {}; static struct Bandwidth_T bandwidthset = {}; static struct Match_T matchset = {}; static struct Icmp_T icmpset = {}; static struct Mail_T mailset = {}; static struct SslOptions_T sslset = {}; static struct Port_T portset = {}; static struct MailServer_T mailserverset = {}; static struct Mmonit_T mmonitset = {}; static struct FileSystem_T filesystemset = {}; static struct Resource_T resourceset = {}; static struct Checksum_T checksumset = {}; static struct Timestamp_T timestampset = {}; static struct ActionRate_T actionrateset = {}; static struct precedence_t ihp = {false, false, false, false, false}; static struct rate_t rate = {1, 1}; static struct rate_t rate1 = {1, 1}; static struct rate_t rate2 = {1, 1}; static char * htpasswd_file = NULL; static unsigned int repeat = 0; static unsigned int repeat1 = 0; static unsigned int repeat2 = 0; static unsigned int timeout = 0; static Digest_Type digesttype = Digest_Cleartext; #define BITMAP_MAX (sizeof(long long) * 8) /* -------------------------------------------------------------- Prototypes */ static void preparse(void); static void postparse(void); static bool _parseOutgoingAddress(char *ip, Outgoing_T *outgoing); static void addmail(char *, Mail_T, Mail_T *); static Service_T createservice(Service_Type, char *, char *, State_Type (*)(Service_T)); static void addservice(Service_T); static void adddependant(char *); static void addservicegroup(char *); static void addhostgroup(char *name); static void addport(Port_T *, Port_T); static void addhttpheader(Port_T, char *); static void addresource(Resource_T); static void addtimestamp(Timestamp_T); static void addactionrate(ActionRate_T); static void addsize(Size_T); static void addnlink(NLink_T); static void adduptime(Uptime_T); static void addpid(Pid_T); static void addppid(Pid_T); static void addfsflag(FsFlag_T); static void addnonexist(NonExist_T); static void addexist(Exist_T); static void addlinkstatus(Service_T, LinkStatus_T); static void addlinkspeed(Service_T, LinkSpeed_T); static void addlinksaturation(Service_T, LinkSaturation_T); static void addbandwidth(Bandwidth_T *, Bandwidth_T); static void addfilesystem(FileSystem_T); static void addicmp(Icmp_T); static void addgeneric(Port_T, char*, char*); static void addcommand(int, unsigned); static void addargument(char *); static void addmmonit(Mmonit_T); static void addmailserver(MailServer_T); static bool addcredentials(char *, char *, Digest_Type, bool); #ifdef HAVE_LIBPAM static void addpamauth(char *, int); #endif static void addhtpasswdentry(char *, char *, Digest_Type); static uid_t get_uid(char *, uid_t); static gid_t get_gid(char *, gid_t); static void addchecksum(Checksum_T); static void addperm(Perm_T); static void addmatch(Match_T, int, int); static void addmatchpath(Match_T, Action_Type); static void addoutputchange(bool, Action_Type, Action_Type); static void addstatus(Status_T); static Uid_T adduid(Uid_T); static Gid_T addgid(Gid_T); static void addeuid(uid_t); static void addegid(gid_t); static void addeventaction(EventAction_T *, Action_Type, Action_Type); static void prepare_urlrequest(URL_T U); static void seturlrequest(int, char *); static void setlogfile(char *); static void setpidfile(char *); static void setidfile(char *); static void setstatefile(char *); static void reset_sslset(void); static void reset_mailset(void); static void reset_mailserverset(void); static void reset_mmonitset(void); static void reset_portset(void); static void reset_resourceset(void); static void reset_timestampset(void); static void reset_actionrateset(void); static void reset_sizeset(void); static void reset_nlinkset(void); static void reset_uptimeset(void); static void reset_responsetimeset(void); static void reset_pidset(void); static void reset_ppidset(void); static void reset_fsflagset(void); static void reset_nonexistset(void); static void reset_existset(void); static void reset_linkstatusset(void); static void reset_linkspeedset(void); static void reset_linksaturationset(void); static void reset_bandwidthset(void); static void reset_checksumset(void); static void reset_permset(void); static void reset_uidset(void); static void reset_gidset(void); static void reset_statusset(void); static void reset_filesystemset(void); static void reset_icmpset(void); static void reset_rateset(struct rate_t *); static void check_name(char *); static int check_perm(int); static void check_exec(char *); static int cleanup_hash_string(char *); static void check_depend(void); static void setsyslog(char *); static command_t copycommand(command_t); static int verifyMaxForward(int); static void _setPEM(char **store, char *path, const char *description, bool isFile); static void _setSSLOptions(SslOptions_T options); #ifdef HAVE_OPENSSL static void _setSSLVersion(short version); #endif static void _unsetSSLVersion(short version); static void addsecurityattribute(char *, Action_Type, Action_Type); static void addfiledescriptors(Operator_Type, bool, long long, float, Action_Type, Action_Type); static void _sanityCheckEveryStatement(Service_T s); #line 386 "src/y.tab.c" # ifndef YY_CAST # ifdef __cplusplus # define YY_CAST(Type, Val) static_cast (Val) # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) # else # define YY_CAST(Type, Val) ((Type) (Val)) # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) # endif # endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # else # define YY_NULLPTR ((void*)0) # endif # endif #include "y.tab.h" /* Symbol kind. */ enum yysymbol_kind_t { YYSYMBOL_YYEMPTY = -2, YYSYMBOL_YYEOF = 0, /* "end of file" */ YYSYMBOL_YYerror = 1, /* error */ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ YYSYMBOL_IF = 3, /* IF */ YYSYMBOL_ELSE = 4, /* ELSE */ YYSYMBOL_THEN = 5, /* THEN */ YYSYMBOL_FAILED = 6, /* FAILED */ YYSYMBOL_SET = 7, /* SET */ YYSYMBOL_LOGFILE = 8, /* LOGFILE */ YYSYMBOL_FACILITY = 9, /* FACILITY */ YYSYMBOL_DAEMON = 10, /* DAEMON */ YYSYMBOL_SYSLOG = 11, /* SYSLOG */ YYSYMBOL_MAILSERVER = 12, /* MAILSERVER */ YYSYMBOL_HTTPD = 13, /* HTTPD */ YYSYMBOL_ALLOW = 14, /* ALLOW */ YYSYMBOL_REJECTOPT = 15, /* REJECTOPT */ YYSYMBOL_ADDRESS = 16, /* ADDRESS */ YYSYMBOL_INIT = 17, /* INIT */ YYSYMBOL_TERMINAL = 18, /* TERMINAL */ YYSYMBOL_BATCH = 19, /* BATCH */ YYSYMBOL_READONLY = 20, /* READONLY */ YYSYMBOL_CLEARTEXT = 21, /* CLEARTEXT */ YYSYMBOL_MD5HASH = 22, /* MD5HASH */ YYSYMBOL_SHA1HASH = 23, /* SHA1HASH */ YYSYMBOL_CRYPT = 24, /* CRYPT */ YYSYMBOL_DELAY = 25, /* DELAY */ YYSYMBOL_PEMFILE = 26, /* PEMFILE */ YYSYMBOL_PEMKEY = 27, /* PEMKEY */ YYSYMBOL_PEMCHAIN = 28, /* PEMCHAIN */ YYSYMBOL_ENABLE = 29, /* ENABLE */ YYSYMBOL_DISABLE = 30, /* DISABLE */ YYSYMBOL_SSLTOKEN = 31, /* SSLTOKEN */ YYSYMBOL_CIPHER = 32, /* CIPHER */ YYSYMBOL_CLIENTPEMFILE = 33, /* CLIENTPEMFILE */ YYSYMBOL_ALLOWSELFCERTIFICATION = 34, /* ALLOWSELFCERTIFICATION */ YYSYMBOL_SELFSIGNED = 35, /* SELFSIGNED */ YYSYMBOL_VERIFY = 36, /* VERIFY */ YYSYMBOL_CERTIFICATE = 37, /* CERTIFICATE */ YYSYMBOL_CACERTIFICATEFILE = 38, /* CACERTIFICATEFILE */ YYSYMBOL_CACERTIFICATEPATH = 39, /* CACERTIFICATEPATH */ YYSYMBOL_VALID = 40, /* VALID */ YYSYMBOL_INTERFACE = 41, /* INTERFACE */ YYSYMBOL_LINK = 42, /* LINK */ YYSYMBOL_PACKET = 43, /* PACKET */ YYSYMBOL_BYTEIN = 44, /* BYTEIN */ YYSYMBOL_BYTEOUT = 45, /* BYTEOUT */ YYSYMBOL_PACKETIN = 46, /* PACKETIN */ YYSYMBOL_PACKETOUT = 47, /* PACKETOUT */ YYSYMBOL_SPEED = 48, /* SPEED */ YYSYMBOL_SATURATION = 49, /* SATURATION */ YYSYMBOL_UPLOAD = 50, /* UPLOAD */ YYSYMBOL_DOWNLOAD = 51, /* DOWNLOAD */ YYSYMBOL_TOTAL = 52, /* TOTAL */ YYSYMBOL_UP = 53, /* UP */ YYSYMBOL_DOWN = 54, /* DOWN */ YYSYMBOL_IDFILE = 55, /* IDFILE */ YYSYMBOL_STATEFILE = 56, /* STATEFILE */ YYSYMBOL_SEND = 57, /* SEND */ YYSYMBOL_EXPECT = 58, /* EXPECT */ YYSYMBOL_CYCLE = 59, /* CYCLE */ YYSYMBOL_COUNT = 60, /* COUNT */ YYSYMBOL_REMINDER = 61, /* REMINDER */ YYSYMBOL_REPEAT = 62, /* REPEAT */ YYSYMBOL_LIMITS = 63, /* LIMITS */ YYSYMBOL_SENDEXPECTBUFFER = 64, /* SENDEXPECTBUFFER */ YYSYMBOL_EXPECTBUFFER = 65, /* EXPECTBUFFER */ YYSYMBOL_FILECONTENTBUFFER = 66, /* FILECONTENTBUFFER */ YYSYMBOL_HTTPCONTENTBUFFER = 67, /* HTTPCONTENTBUFFER */ YYSYMBOL_PROGRAMOUTPUT = 68, /* PROGRAMOUTPUT */ YYSYMBOL_NETWORKTIMEOUT = 69, /* NETWORKTIMEOUT */ YYSYMBOL_PROGRAMTIMEOUT = 70, /* PROGRAMTIMEOUT */ YYSYMBOL_STARTTIMEOUT = 71, /* STARTTIMEOUT */ YYSYMBOL_STOPTIMEOUT = 72, /* STOPTIMEOUT */ YYSYMBOL_RESTARTTIMEOUT = 73, /* RESTARTTIMEOUT */ YYSYMBOL_EXECTIMEOUT = 74, /* EXECTIMEOUT */ YYSYMBOL_PIDFILE = 75, /* PIDFILE */ YYSYMBOL_START = 76, /* START */ YYSYMBOL_STOP = 77, /* STOP */ YYSYMBOL_PATHTOK = 78, /* PATHTOK */ YYSYMBOL_RSAKEY = 79, /* RSAKEY */ YYSYMBOL_HOST = 80, /* HOST */ YYSYMBOL_HOSTNAME = 81, /* HOSTNAME */ YYSYMBOL_PORT = 82, /* PORT */ YYSYMBOL_IPV4 = 83, /* IPV4 */ YYSYMBOL_IPV6 = 84, /* IPV6 */ YYSYMBOL_TYPE = 85, /* TYPE */ YYSYMBOL_UDP = 86, /* UDP */ YYSYMBOL_TCP = 87, /* TCP */ YYSYMBOL_TCPSSL = 88, /* TCPSSL */ YYSYMBOL_PROTOCOL = 89, /* PROTOCOL */ YYSYMBOL_CONNECTION = 90, /* CONNECTION */ YYSYMBOL_ALERT = 91, /* ALERT */ YYSYMBOL_NOALERT = 92, /* NOALERT */ YYSYMBOL_MAILFORMAT = 93, /* MAILFORMAT */ YYSYMBOL_UNIXSOCKET = 94, /* UNIXSOCKET */ YYSYMBOL_SIGNATURE = 95, /* SIGNATURE */ YYSYMBOL_TIMEOUT = 96, /* TIMEOUT */ YYSYMBOL_RETRY = 97, /* RETRY */ YYSYMBOL_RESTART = 98, /* RESTART */ YYSYMBOL_CHECKSUM = 99, /* CHECKSUM */ YYSYMBOL_EVERY = 100, /* EVERY */ YYSYMBOL_NOTEVERY = 101, /* NOTEVERY */ YYSYMBOL_DEFAULT = 102, /* DEFAULT */ YYSYMBOL_HTTP = 103, /* HTTP */ YYSYMBOL_HTTPS = 104, /* HTTPS */ YYSYMBOL_APACHESTATUS = 105, /* APACHESTATUS */ YYSYMBOL_FTP = 106, /* FTP */ YYSYMBOL_SMTP = 107, /* SMTP */ YYSYMBOL_SMTPS = 108, /* SMTPS */ YYSYMBOL_POP = 109, /* POP */ YYSYMBOL_POPS = 110, /* POPS */ YYSYMBOL_IMAP = 111, /* IMAP */ YYSYMBOL_IMAPS = 112, /* IMAPS */ YYSYMBOL_CLAMAV = 113, /* CLAMAV */ YYSYMBOL_NNTP = 114, /* NNTP */ YYSYMBOL_NTP3 = 115, /* NTP3 */ YYSYMBOL_MYSQL = 116, /* MYSQL */ YYSYMBOL_MYSQLS = 117, /* MYSQLS */ YYSYMBOL_DNS = 118, /* DNS */ YYSYMBOL_WEBSOCKET = 119, /* WEBSOCKET */ YYSYMBOL_MQTT = 120, /* MQTT */ YYSYMBOL_SSH = 121, /* SSH */ YYSYMBOL_DWP = 122, /* DWP */ YYSYMBOL_LDAP2 = 123, /* LDAP2 */ YYSYMBOL_LDAP3 = 124, /* LDAP3 */ YYSYMBOL_RDATE = 125, /* RDATE */ YYSYMBOL_RSYNC = 126, /* RSYNC */ YYSYMBOL_TNS = 127, /* TNS */ YYSYMBOL_PGSQL = 128, /* PGSQL */ YYSYMBOL_POSTFIXPOLICY = 129, /* POSTFIXPOLICY */ YYSYMBOL_SIP = 130, /* SIP */ YYSYMBOL_LMTP = 131, /* LMTP */ YYSYMBOL_GPS = 132, /* GPS */ YYSYMBOL_RADIUS = 133, /* RADIUS */ YYSYMBOL_MEMCACHE = 134, /* MEMCACHE */ YYSYMBOL_REDIS = 135, /* REDIS */ YYSYMBOL_MONGODB = 136, /* MONGODB */ YYSYMBOL_SIEVE = 137, /* SIEVE */ YYSYMBOL_SPAMASSASSIN = 138, /* SPAMASSASSIN */ YYSYMBOL_FAIL2BAN = 139, /* FAIL2BAN */ YYSYMBOL_STRING = 140, /* STRING */ YYSYMBOL_PATH = 141, /* PATH */ YYSYMBOL_MAILADDR = 142, /* MAILADDR */ YYSYMBOL_MAILFROM = 143, /* MAILFROM */ YYSYMBOL_MAILREPLYTO = 144, /* MAILREPLYTO */ YYSYMBOL_MAILSUBJECT = 145, /* MAILSUBJECT */ YYSYMBOL_MAILBODY = 146, /* MAILBODY */ YYSYMBOL_SERVICENAME = 147, /* SERVICENAME */ YYSYMBOL_STRINGNAME = 148, /* STRINGNAME */ YYSYMBOL_HOSTGROUPNAME = 149, /* HOSTGROUPNAME */ YYSYMBOL_NUMBER = 150, /* NUMBER */ YYSYMBOL_PERCENT = 151, /* PERCENT */ YYSYMBOL_LOGLIMIT = 152, /* LOGLIMIT */ YYSYMBOL_CLOSELIMIT = 153, /* CLOSELIMIT */ YYSYMBOL_DNSLIMIT = 154, /* DNSLIMIT */ YYSYMBOL_KEEPALIVELIMIT = 155, /* KEEPALIVELIMIT */ YYSYMBOL_REPLYLIMIT = 156, /* REPLYLIMIT */ YYSYMBOL_REQUESTLIMIT = 157, /* REQUESTLIMIT */ YYSYMBOL_STARTLIMIT = 158, /* STARTLIMIT */ YYSYMBOL_WAITLIMIT = 159, /* WAITLIMIT */ YYSYMBOL_GRACEFULLIMIT = 160, /* GRACEFULLIMIT */ YYSYMBOL_CLEANUPLIMIT = 161, /* CLEANUPLIMIT */ YYSYMBOL_REAL = 162, /* REAL */ YYSYMBOL_CHECKPROC = 163, /* CHECKPROC */ YYSYMBOL_CHECKFILESYS = 164, /* CHECKFILESYS */ YYSYMBOL_CHECKFILE = 165, /* CHECKFILE */ YYSYMBOL_CHECKDIR = 166, /* CHECKDIR */ YYSYMBOL_CHECKHOST = 167, /* CHECKHOST */ YYSYMBOL_CHECKSYSTEM = 168, /* CHECKSYSTEM */ YYSYMBOL_CHECKFIFO = 169, /* CHECKFIFO */ YYSYMBOL_CHECKPROGRAM = 170, /* CHECKPROGRAM */ YYSYMBOL_CHECKNET = 171, /* CHECKNET */ YYSYMBOL_THREADS = 172, /* THREADS */ YYSYMBOL_CHILDREN = 173, /* CHILDREN */ YYSYMBOL_METHOD = 174, /* METHOD */ YYSYMBOL_GET = 175, /* GET */ YYSYMBOL_HEAD = 176, /* HEAD */ YYSYMBOL_STATUS = 177, /* STATUS */ YYSYMBOL_ORIGIN = 178, /* ORIGIN */ YYSYMBOL_VERSIONOPT = 179, /* VERSIONOPT */ YYSYMBOL_READ = 180, /* READ */ YYSYMBOL_WRITE = 181, /* WRITE */ YYSYMBOL_OPERATION = 182, /* OPERATION */ YYSYMBOL_SERVICETIME = 183, /* SERVICETIME */ YYSYMBOL_DISK = 184, /* DISK */ YYSYMBOL_RESOURCE = 185, /* RESOURCE */ YYSYMBOL_MEMORY = 186, /* MEMORY */ YYSYMBOL_TOTALMEMORY = 187, /* TOTALMEMORY */ YYSYMBOL_LOADAVG1 = 188, /* LOADAVG1 */ YYSYMBOL_LOADAVG5 = 189, /* LOADAVG5 */ YYSYMBOL_LOADAVG15 = 190, /* LOADAVG15 */ YYSYMBOL_SWAP = 191, /* SWAP */ YYSYMBOL_MODE = 192, /* MODE */ YYSYMBOL_ACTIVE = 193, /* ACTIVE */ YYSYMBOL_PASSIVE = 194, /* PASSIVE */ YYSYMBOL_MANUAL = 195, /* MANUAL */ YYSYMBOL_ONREBOOT = 196, /* ONREBOOT */ YYSYMBOL_NOSTART = 197, /* NOSTART */ YYSYMBOL_LASTSTATE = 198, /* LASTSTATE */ YYSYMBOL_CORE = 199, /* CORE */ YYSYMBOL_CPU = 200, /* CPU */ YYSYMBOL_TOTALCPU = 201, /* TOTALCPU */ YYSYMBOL_CPUUSER = 202, /* CPUUSER */ YYSYMBOL_CPUSYSTEM = 203, /* CPUSYSTEM */ YYSYMBOL_CPUWAIT = 204, /* CPUWAIT */ YYSYMBOL_CPUNICE = 205, /* CPUNICE */ YYSYMBOL_CPUHARDIRQ = 206, /* CPUHARDIRQ */ YYSYMBOL_CPUSOFTIRQ = 207, /* CPUSOFTIRQ */ YYSYMBOL_CPUSTEAL = 208, /* CPUSTEAL */ YYSYMBOL_CPUGUEST = 209, /* CPUGUEST */ YYSYMBOL_CPUGUESTNICE = 210, /* CPUGUESTNICE */ YYSYMBOL_GROUP = 211, /* GROUP */ YYSYMBOL_REQUEST = 212, /* REQUEST */ YYSYMBOL_DEPENDS = 213, /* DEPENDS */ YYSYMBOL_BASEDIR = 214, /* BASEDIR */ YYSYMBOL_SLOT = 215, /* SLOT */ YYSYMBOL_EVENTQUEUE = 216, /* EVENTQUEUE */ YYSYMBOL_SECRET = 217, /* SECRET */ YYSYMBOL_HOSTHEADER = 218, /* HOSTHEADER */ YYSYMBOL_UID = 219, /* UID */ YYSYMBOL_EUID = 220, /* EUID */ YYSYMBOL_GID = 221, /* GID */ YYSYMBOL_MMONIT = 222, /* MMONIT */ YYSYMBOL_INSTANCE = 223, /* INSTANCE */ YYSYMBOL_USERNAME = 224, /* USERNAME */ YYSYMBOL_PASSWORD = 225, /* PASSWORD */ YYSYMBOL_DATABASE = 226, /* DATABASE */ YYSYMBOL_TIME = 227, /* TIME */ YYSYMBOL_ATIME = 228, /* ATIME */ YYSYMBOL_CTIME = 229, /* CTIME */ YYSYMBOL_MTIME = 230, /* MTIME */ YYSYMBOL_CHANGED = 231, /* CHANGED */ YYSYMBOL_MILLISECOND = 232, /* MILLISECOND */ YYSYMBOL_SECOND = 233, /* SECOND */ YYSYMBOL_MINUTE = 234, /* MINUTE */ YYSYMBOL_HOUR = 235, /* HOUR */ YYSYMBOL_DAY = 236, /* DAY */ YYSYMBOL_MONTH = 237, /* MONTH */ YYSYMBOL_SSLV2 = 238, /* SSLV2 */ YYSYMBOL_SSLV3 = 239, /* SSLV3 */ YYSYMBOL_TLSV1 = 240, /* TLSV1 */ YYSYMBOL_TLSV11 = 241, /* TLSV11 */ YYSYMBOL_TLSV12 = 242, /* TLSV12 */ YYSYMBOL_TLSV13 = 243, /* TLSV13 */ YYSYMBOL_CERTMD5 = 244, /* CERTMD5 */ YYSYMBOL_AUTO = 245, /* AUTO */ YYSYMBOL_NOSSLV2 = 246, /* NOSSLV2 */ YYSYMBOL_NOSSLV3 = 247, /* NOSSLV3 */ YYSYMBOL_NOTLSV1 = 248, /* NOTLSV1 */ YYSYMBOL_NOTLSV11 = 249, /* NOTLSV11 */ YYSYMBOL_NOTLSV12 = 250, /* NOTLSV12 */ YYSYMBOL_NOTLSV13 = 251, /* NOTLSV13 */ YYSYMBOL_BYTE = 252, /* BYTE */ YYSYMBOL_KILOBYTE = 253, /* KILOBYTE */ YYSYMBOL_MEGABYTE = 254, /* MEGABYTE */ YYSYMBOL_GIGABYTE = 255, /* GIGABYTE */ YYSYMBOL_INODE = 256, /* INODE */ YYSYMBOL_SPACE = 257, /* SPACE */ YYSYMBOL_TFREE = 258, /* TFREE */ YYSYMBOL_PERMISSION = 259, /* PERMISSION */ YYSYMBOL_SIZE = 260, /* SIZE */ YYSYMBOL_MATCH = 261, /* MATCH */ YYSYMBOL_NOT = 262, /* NOT */ YYSYMBOL_IGNORE = 263, /* IGNORE */ YYSYMBOL_ACTION = 264, /* ACTION */ YYSYMBOL_UPTIME = 265, /* UPTIME */ YYSYMBOL_RESPONSETIME = 266, /* RESPONSETIME */ YYSYMBOL_EXEC = 267, /* EXEC */ YYSYMBOL_UNMONITOR = 268, /* UNMONITOR */ YYSYMBOL_PING = 269, /* PING */ YYSYMBOL_PING4 = 270, /* PING4 */ YYSYMBOL_PING6 = 271, /* PING6 */ YYSYMBOL_ICMP = 272, /* ICMP */ YYSYMBOL_ICMPECHO = 273, /* ICMPECHO */ YYSYMBOL_NONEXIST = 274, /* NONEXIST */ YYSYMBOL_EXIST = 275, /* EXIST */ YYSYMBOL_INVALID = 276, /* INVALID */ YYSYMBOL_DATA = 277, /* DATA */ YYSYMBOL_RECOVERED = 278, /* RECOVERED */ YYSYMBOL_PASSED = 279, /* PASSED */ YYSYMBOL_SUCCEEDED = 280, /* SUCCEEDED */ YYSYMBOL_URL = 281, /* URL */ YYSYMBOL_CONTENT = 282, /* CONTENT */ YYSYMBOL_PID = 283, /* PID */ YYSYMBOL_PPID = 284, /* PPID */ YYSYMBOL_FSFLAG = 285, /* FSFLAG */ YYSYMBOL_REGISTER = 286, /* REGISTER */ YYSYMBOL_CREDENTIALS = 287, /* CREDENTIALS */ YYSYMBOL_URLOBJECT = 288, /* URLOBJECT */ YYSYMBOL_ADDRESSOBJECT = 289, /* ADDRESSOBJECT */ YYSYMBOL_TARGET = 290, /* TARGET */ YYSYMBOL_TIMESPEC = 291, /* TIMESPEC */ YYSYMBOL_HTTPHEADER = 292, /* HTTPHEADER */ YYSYMBOL_MAXFORWARD = 293, /* MAXFORWARD */ YYSYMBOL_FIPS = 294, /* FIPS */ YYSYMBOL_SECURITY = 295, /* SECURITY */ YYSYMBOL_ATTRIBUTE = 296, /* ATTRIBUTE */ YYSYMBOL_FILEDESCRIPTORS = 297, /* FILEDESCRIPTORS */ YYSYMBOL_HARDLINK = 298, /* HARDLINK */ YYSYMBOL_GREATER = 299, /* GREATER */ YYSYMBOL_GREATEROREQUAL = 300, /* GREATEROREQUAL */ YYSYMBOL_LESS = 301, /* LESS */ YYSYMBOL_LESSOREQUAL = 302, /* LESSOREQUAL */ YYSYMBOL_EQUAL = 303, /* EQUAL */ YYSYMBOL_NOTEQUAL = 304, /* NOTEQUAL */ YYSYMBOL_305_ = 305, /* '{' */ YYSYMBOL_306_ = 306, /* '}' */ YYSYMBOL_307_ = 307, /* ':' */ YYSYMBOL_308_ = 308, /* '[' */ YYSYMBOL_309_ = 309, /* ']' */ YYSYMBOL_310_ = 310, /* '@' */ YYSYMBOL_YYACCEPT = 311, /* $accept */ YYSYMBOL_cfgfile = 312, /* cfgfile */ YYSYMBOL_statement_list = 313, /* statement_list */ YYSYMBOL_statement = 314, /* statement */ YYSYMBOL_optproclist = 315, /* optproclist */ YYSYMBOL_optproc = 316, /* optproc */ YYSYMBOL_optfilelist = 317, /* optfilelist */ YYSYMBOL_optfile = 318, /* optfile */ YYSYMBOL_optfilesyslist = 319, /* optfilesyslist */ YYSYMBOL_optfilesys = 320, /* optfilesys */ YYSYMBOL_optdirlist = 321, /* optdirlist */ YYSYMBOL_optdir = 322, /* optdir */ YYSYMBOL_opthostlist = 323, /* opthostlist */ YYSYMBOL_opthost = 324, /* opthost */ YYSYMBOL_optnetlist = 325, /* optnetlist */ YYSYMBOL_optnet = 326, /* optnet */ YYSYMBOL_optsystemlist = 327, /* optsystemlist */ YYSYMBOL_optsystem = 328, /* optsystem */ YYSYMBOL_optfifolist = 329, /* optfifolist */ YYSYMBOL_optfifo = 330, /* optfifo */ YYSYMBOL_optprogramlist = 331, /* optprogramlist */ YYSYMBOL_optprogram = 332, /* optprogram */ YYSYMBOL_setalert = 333, /* setalert */ YYSYMBOL_setdaemon = 334, /* setdaemon */ YYSYMBOL_setterminal = 335, /* setterminal */ YYSYMBOL_startdelay = 336, /* startdelay */ YYSYMBOL_setinit = 337, /* setinit */ YYSYMBOL_setonreboot = 338, /* setonreboot */ YYSYMBOL_setexpectbuffer = 339, /* setexpectbuffer */ YYSYMBOL_setlimits = 340, /* setlimits */ YYSYMBOL_limitlist = 341, /* limitlist */ YYSYMBOL_limit = 342, /* limit */ YYSYMBOL_setfips = 343, /* setfips */ YYSYMBOL_setlog = 344, /* setlog */ YYSYMBOL_seteventqueue = 345, /* seteventqueue */ YYSYMBOL_setidfile = 346, /* setidfile */ YYSYMBOL_setstatefile = 347, /* setstatefile */ YYSYMBOL_setpid = 348, /* setpid */ YYSYMBOL_setmmonits = 349, /* setmmonits */ YYSYMBOL_mmonitlist = 350, /* mmonitlist */ YYSYMBOL_mmonit = 351, /* mmonit */ YYSYMBOL_mmonitoptlist = 352, /* mmonitoptlist */ YYSYMBOL_mmonitopt = 353, /* mmonitopt */ YYSYMBOL_credentials = 354, /* credentials */ YYSYMBOL_setssl = 355, /* setssl */ YYSYMBOL_ssl = 356, /* ssl */ YYSYMBOL_ssloptionlist = 357, /* ssloptionlist */ YYSYMBOL_ssloption = 358, /* ssloption */ YYSYMBOL_sslexpire = 359, /* sslexpire */ YYSYMBOL_expireoperator = 360, /* expireoperator */ YYSYMBOL_sslchecksum = 361, /* sslchecksum */ YYSYMBOL_checksumoperator = 362, /* checksumoperator */ YYSYMBOL_sslversionlist = 363, /* sslversionlist */ YYSYMBOL_sslversion = 364, /* sslversion */ YYSYMBOL_certmd5 = 365, /* certmd5 */ YYSYMBOL_setmailservers = 366, /* setmailservers */ YYSYMBOL_setmailformat = 367, /* setmailformat */ YYSYMBOL_mailserverlist = 368, /* mailserverlist */ YYSYMBOL_mailserver = 369, /* mailserver */ YYSYMBOL_mailserveroptlist = 370, /* mailserveroptlist */ YYSYMBOL_mailserveropt = 371, /* mailserveropt */ YYSYMBOL_sethttpd = 372, /* sethttpd */ YYSYMBOL_httpdlist = 373, /* httpdlist */ YYSYMBOL_httpdoption = 374, /* httpdoption */ YYSYMBOL_pemfile = 375, /* pemfile */ YYSYMBOL_clientpemfile = 376, /* clientpemfile */ YYSYMBOL_allowselfcert = 377, /* allowselfcert */ YYSYMBOL_httpdport = 378, /* httpdport */ YYSYMBOL_httpdsocket = 379, /* httpdsocket */ YYSYMBOL_httpdsocketoptionlist = 380, /* httpdsocketoptionlist */ YYSYMBOL_httpdsocketoption = 381, /* httpdsocketoption */ YYSYMBOL_sigenable = 382, /* sigenable */ YYSYMBOL_sigdisable = 383, /* sigdisable */ YYSYMBOL_signature = 384, /* signature */ YYSYMBOL_bindaddress = 385, /* bindaddress */ YYSYMBOL_allow = 386, /* allow */ YYSYMBOL_387_1 = 387, /* $@1 */ YYSYMBOL_388_2 = 388, /* $@2 */ YYSYMBOL_389_3 = 389, /* $@3 */ YYSYMBOL_390_4 = 390, /* $@4 */ YYSYMBOL_allowuserlist = 391, /* allowuserlist */ YYSYMBOL_allowuser = 392, /* allowuser */ YYSYMBOL_readonly = 393, /* readonly */ YYSYMBOL_checkproc = 394, /* checkproc */ YYSYMBOL_checkfile = 395, /* checkfile */ YYSYMBOL_checkfilesys = 396, /* checkfilesys */ YYSYMBOL_checkdir = 397, /* checkdir */ YYSYMBOL_checkhost = 398, /* checkhost */ YYSYMBOL_checknet = 399, /* checknet */ YYSYMBOL_checksystem = 400, /* checksystem */ YYSYMBOL_checkfifo = 401, /* checkfifo */ YYSYMBOL_checkprogram = 402, /* checkprogram */ YYSYMBOL_start = 403, /* start */ YYSYMBOL_stop = 404, /* stop */ YYSYMBOL_restart = 405, /* restart */ YYSYMBOL_argumentlist = 406, /* argumentlist */ YYSYMBOL_useroptionlist = 407, /* useroptionlist */ YYSYMBOL_argument = 408, /* argument */ YYSYMBOL_useroption = 409, /* useroption */ YYSYMBOL_username = 410, /* username */ YYSYMBOL_password = 411, /* password */ YYSYMBOL_database = 412, /* database */ YYSYMBOL_hostname = 413, /* hostname */ YYSYMBOL_connection = 414, /* connection */ YYSYMBOL_connectionoptlist = 415, /* connectionoptlist */ YYSYMBOL_connectionopt = 416, /* connectionopt */ YYSYMBOL_connectionurl = 417, /* connectionurl */ YYSYMBOL_connectionurloptlist = 418, /* connectionurloptlist */ YYSYMBOL_connectionurlopt = 419, /* connectionurlopt */ YYSYMBOL_connectionunix = 420, /* connectionunix */ YYSYMBOL_connectionuxoptlist = 421, /* connectionuxoptlist */ YYSYMBOL_connectionuxopt = 422, /* connectionuxopt */ YYSYMBOL_icmp = 423, /* icmp */ YYSYMBOL_icmpoptlist = 424, /* icmpoptlist */ YYSYMBOL_icmpopt = 425, /* icmpopt */ YYSYMBOL_host = 426, /* host */ YYSYMBOL_port = 427, /* port */ YYSYMBOL_unixsocket = 428, /* unixsocket */ YYSYMBOL_ip = 429, /* ip */ YYSYMBOL_type = 430, /* type */ YYSYMBOL_typeoptlist = 431, /* typeoptlist */ YYSYMBOL_typeopt = 432, /* typeopt */ YYSYMBOL_outgoing = 433, /* outgoing */ YYSYMBOL_protocol = 434, /* protocol */ YYSYMBOL_sendexpect = 435, /* sendexpect */ YYSYMBOL_websocketlist = 436, /* websocketlist */ YYSYMBOL_websocket = 437, /* websocket */ YYSYMBOL_smtplist = 438, /* smtplist */ YYSYMBOL_smtp = 439, /* smtp */ YYSYMBOL_mqttlist = 440, /* mqttlist */ YYSYMBOL_mqtt = 441, /* mqtt */ YYSYMBOL_mysqllist = 442, /* mysqllist */ YYSYMBOL_mysql = 443, /* mysql */ YYSYMBOL_postgresqllist = 444, /* postgresqllist */ YYSYMBOL_postgresql = 445, /* postgresql */ YYSYMBOL_target = 446, /* target */ YYSYMBOL_maxforward = 447, /* maxforward */ YYSYMBOL_siplist = 448, /* siplist */ YYSYMBOL_sip = 449, /* sip */ YYSYMBOL_httplist = 450, /* httplist */ YYSYMBOL_http = 451, /* http */ YYSYMBOL_status = 452, /* status */ YYSYMBOL_method = 453, /* method */ YYSYMBOL_request = 454, /* request */ YYSYMBOL_responsesum = 455, /* responsesum */ YYSYMBOL_hostheader = 456, /* hostheader */ YYSYMBOL_httpheaderlist = 457, /* httpheaderlist */ YYSYMBOL_secret = 458, /* secret */ YYSYMBOL_radiuslist = 459, /* radiuslist */ YYSYMBOL_radius = 460, /* radius */ YYSYMBOL_apache_stat_list = 461, /* apache_stat_list */ YYSYMBOL_apache_stat = 462, /* apache_stat */ YYSYMBOL_exist = 463, /* exist */ YYSYMBOL_pid = 464, /* pid */ YYSYMBOL_ppid = 465, /* ppid */ YYSYMBOL_uptime = 466, /* uptime */ YYSYMBOL_responsetime = 467, /* responsetime */ YYSYMBOL_icmpcount = 468, /* icmpcount */ YYSYMBOL_icmpsize = 469, /* icmpsize */ YYSYMBOL_icmptimeout = 470, /* icmptimeout */ YYSYMBOL_icmpoutgoing = 471, /* icmpoutgoing */ YYSYMBOL_stoptimeout = 472, /* stoptimeout */ YYSYMBOL_starttimeout = 473, /* starttimeout */ YYSYMBOL_restarttimeout = 474, /* restarttimeout */ YYSYMBOL_programtimeout = 475, /* programtimeout */ YYSYMBOL_nettimeout = 476, /* nettimeout */ YYSYMBOL_connectiontimeout = 477, /* connectiontimeout */ YYSYMBOL_retry = 478, /* retry */ YYSYMBOL_actionrate = 479, /* actionrate */ YYSYMBOL_urloption = 480, /* urloption */ YYSYMBOL_urloperator = 481, /* urloperator */ YYSYMBOL_alert = 482, /* alert */ YYSYMBOL_alertmail = 483, /* alertmail */ YYSYMBOL_noalertmail = 484, /* noalertmail */ YYSYMBOL_eventoptionlist = 485, /* eventoptionlist */ YYSYMBOL_eventoption = 486, /* eventoption */ YYSYMBOL_formatlist = 487, /* formatlist */ YYSYMBOL_formatoptionlist = 488, /* formatoptionlist */ YYSYMBOL_formatoption = 489, /* formatoption */ YYSYMBOL_every = 490, /* every */ YYSYMBOL_mode = 491, /* mode */ YYSYMBOL_onreboot = 492, /* onreboot */ YYSYMBOL_group = 493, /* group */ YYSYMBOL_hostgrouplist = 494, /* hostgrouplist */ YYSYMBOL_depend = 495, /* depend */ YYSYMBOL_dependlist = 496, /* dependlist */ YYSYMBOL_dependant = 497, /* dependant */ YYSYMBOL_statusvalue = 498, /* statusvalue */ YYSYMBOL_resourceprocess = 499, /* resourceprocess */ YYSYMBOL_resourceprocesslist = 500, /* resourceprocesslist */ YYSYMBOL_resourceprocessopt = 501, /* resourceprocessopt */ YYSYMBOL_resourcesystem = 502, /* resourcesystem */ YYSYMBOL_resourcesystemlist = 503, /* resourcesystemlist */ YYSYMBOL_resourcesystemopt = 504, /* resourcesystemopt */ YYSYMBOL_resourcecpuproc = 505, /* resourcecpuproc */ YYSYMBOL_resourcecpu = 506, /* resourcecpu */ YYSYMBOL_resourcecpuid = 507, /* resourcecpuid */ YYSYMBOL_resourcemem = 508, /* resourcemem */ YYSYMBOL_resourcememproc = 509, /* resourcememproc */ YYSYMBOL_resourceswap = 510, /* resourceswap */ YYSYMBOL_resourcethreads = 511, /* resourcethreads */ YYSYMBOL_resourcechild = 512, /* resourcechild */ YYSYMBOL_resourceload = 513, /* resourceload */ YYSYMBOL_resourceloadavg = 514, /* resourceloadavg */ YYSYMBOL_coremultiplier = 515, /* coremultiplier */ YYSYMBOL_resourceread = 516, /* resourceread */ YYSYMBOL_resourcewrite = 517, /* resourcewrite */ YYSYMBOL_value = 518, /* value */ YYSYMBOL_timestamptype = 519, /* timestamptype */ YYSYMBOL_timestamp = 520, /* timestamp */ YYSYMBOL_operator = 521, /* operator */ YYSYMBOL_time = 522, /* time */ YYSYMBOL_totaltime = 523, /* totaltime */ YYSYMBOL_currenttime = 524, /* currenttime */ YYSYMBOL_exectimeout = 525, /* exectimeout */ YYSYMBOL_repeat = 526, /* repeat */ YYSYMBOL_action = 527, /* action */ YYSYMBOL_action1 = 528, /* action1 */ YYSYMBOL_action2 = 529, /* action2 */ YYSYMBOL_rateXcycles = 530, /* rateXcycles */ YYSYMBOL_rateXYcycles = 531, /* rateXYcycles */ YYSYMBOL_rate1 = 532, /* rate1 */ YYSYMBOL_rate2 = 533, /* rate2 */ YYSYMBOL_recovery_success = 534, /* recovery_success */ YYSYMBOL_recovery_failure = 535, /* recovery_failure */ YYSYMBOL_checksum = 536, /* checksum */ YYSYMBOL_hashtype = 537, /* hashtype */ YYSYMBOL_inode = 538, /* inode */ YYSYMBOL_space = 539, /* space */ YYSYMBOL_read = 540, /* read */ YYSYMBOL_write = 541, /* write */ YYSYMBOL_servicetime = 542, /* servicetime */ YYSYMBOL_fsflag = 543, /* fsflag */ YYSYMBOL_unit = 544, /* unit */ YYSYMBOL_permission = 545, /* permission */ YYSYMBOL_programmatch = 546, /* programmatch */ YYSYMBOL_match = 547, /* match */ YYSYMBOL_matchflagnot = 548, /* matchflagnot */ YYSYMBOL_size = 549, /* size */ YYSYMBOL_hardlink = 550, /* hardlink */ YYSYMBOL_uid = 551, /* uid */ YYSYMBOL_euid = 552, /* euid */ YYSYMBOL_secattr = 553, /* secattr */ YYSYMBOL_filedescriptorssystem = 554, /* filedescriptorssystem */ YYSYMBOL_filedescriptorsprocess = 555, /* filedescriptorsprocess */ YYSYMBOL_filedescriptorsprocesstotal = 556, /* filedescriptorsprocesstotal */ YYSYMBOL_gid = 557, /* gid */ YYSYMBOL_linkstatus = 558, /* linkstatus */ YYSYMBOL_linkspeed = 559, /* linkspeed */ YYSYMBOL_linksaturation = 560, /* linksaturation */ YYSYMBOL_upload = 561, /* upload */ YYSYMBOL_download = 562, /* download */ YYSYMBOL_icmptype = 563, /* icmptype */ YYSYMBOL_reminder = 564 /* reminder */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; #ifdef short # undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure and (if available) are included so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ # include /* INFRINGES ON USER NAME SPACE */ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YY_STDINT_H # endif #endif /* Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic. */ #ifdef __INT_LEAST8_MAX__ typedef __INT_LEAST8_TYPE__ yytype_int8; #elif defined YY_STDINT_H typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef __INT_LEAST16_MAX__ typedef __INT_LEAST16_TYPE__ yytype_int16; #elif defined YY_STDINT_H typedef int_least16_t yytype_int16; #else typedef short yytype_int16; #endif /* Work around bug in HP-UX 11.23, which defines these macros incorrectly for preprocessor constants. This workaround can likely be removed in 2023, as HPE has promised support for HP-UX 11.23 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of . */ #ifdef __hpux # undef UINT_LEAST8_MAX # undef UINT_LEAST16_MAX # define UINT_LEAST8_MAX 255 # define UINT_LEAST16_MAX 65535 #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; #else typedef short yytype_uint8; #endif #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; #else typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ # define YYPTRDIFF_T __PTRDIFF_TYPE__ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ # elif defined PTRDIFF_MAX # ifndef ptrdiff_t # include /* INFRINGES ON USER NAME SPACE */ # endif # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX # else # define YYPTRDIFF_T long # define YYPTRDIFF_MAXIMUM LONG_MAX # endif #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM \ YY_CAST (YYPTRDIFF_T, \ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ ? YYPTRDIFF_MAXIMUM \ : YY_CAST (YYSIZE_T, -1))) #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) /* Stored state numbers (used for stacks). */ typedef yytype_int16 yy_state_t; /* State numbers in computations. */ typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define YY_ATTRIBUTE_PURE # endif #endif #ifndef YY_ATTRIBUTE_UNUSED # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else # define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YY_USE(E) ((void) (E)) #else # define YY_USE(E) /* empty */ #endif /* Suppress an incorrect diagnostic about yylval being uninitialized. */ #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") # else # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ # define YY_IGNORE_USELESS_CAST_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") # define YY_IGNORE_USELESS_CAST_END \ _Pragma ("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_END #endif #define YY_ASSERT(E) ((void) (0 && (E))) #if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* !defined yyoverflow */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 69 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2038 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 311 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 254 /* YYNRULES -- Number of rules. */ #define YYNRULES 854 /* YYNSTATES -- Number of states. */ #define YYNSTATES 1667 /* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 559 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ (0 <= (YYX) && (YYX) <= YYMAXUTOK \ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ static const yytype_int16 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 307, 2, 2, 2, 2, 2, 310, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 308, 2, 309, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 305, 2, 306, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 397, 397, 398, 401, 402, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 434, 435, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 464, 465, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 489, 490, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 515, 516, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 537, 538, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 556, 557, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 577, 578, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 596, 597, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 618, 619, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 636, 640, 643, 649, 663, 668, 671, 676, 681, 684, 687, 692, 698, 701, 702, 705, 716, 723, 734, 745, 751, 757, 763, 769, 775, 781, 787, 793, 799, 805, 811, 819, 824, 834, 837, 842, 845, 849, 855, 865, 875, 885, 888, 889, 892, 898, 899, 902, 908, 909, 910, 911, 912, 915, 916, 921, 926, 929, 932, 933, 936, 940, 944, 948, 952, 955, 959, 962, 965, 968, 971, 974, 979, 985, 986, 989, 1003, 1010, 1019, 1020, 1023, 1024, 1027, 1034, 1037, 1044, 1047, 1054, 1057, 1064, 1067, 1074, 1077, 1084, 1087, 1098, 1107, 1113, 1128, 1129, 1132, 1141, 1152, 1153, 1156, 1159, 1162, 1163, 1164, 1165, 1168, 1195, 1196, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1211, 1217, 1223, 1229, 1236, 1242, 1243, 1246, 1251, 1256, 1260, 1264, 1268, 1273, 1274, 1277, 1278, 1281, 1284, 1289, 1298, 1301, 1309, 1313, 1317, 1321, 1325, 1325, 1332, 1332, 1339, 1339, 1346, 1346, 1353, 1360, 1361, 1364, 1370, 1373, 1378, 1381, 1384, 1391, 1400, 1405, 1408, 1413, 1418, 1423, 1431, 1437, 1452, 1457, 1463, 1471, 1474, 1479, 1482, 1488, 1491, 1496, 1497, 1500, 1501, 1504, 1507, 1512, 1516, 1520, 1523, 1528, 1531, 1536, 1541, 1546, 1549, 1554, 1564, 1574, 1575, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1592, 1600, 1610, 1611, 1614, 1615, 1616, 1617, 1618, 1619, 1622, 1629, 1638, 1639, 1642, 1643, 1644, 1645, 1646, 1647, 1650, 1659, 1667, 1675, 1683, 1692, 1700, 1708, 1718, 1719, 1722, 1723, 1724, 1725, 1726, 1729, 1732, 1737, 1742, 1748, 1751, 1756, 1759, 1763, 1768, 1769, 1772, 1773, 1776, 1781, 1784, 1787, 1790, 1793, 1796, 1799, 1802, 1805, 1808, 1813, 1816, 1821, 1824, 1827, 1830, 1833, 1836, 1839, 1842, 1846, 1849, 1853, 1856, 1859, 1864, 1867, 1870, 1873, 1876, 1879, 1882, 1885, 1888, 1893, 1896, 1899, 1902, 1907, 1915, 1925, 1926, 1929, 1932, 1935, 1938, 1943, 1944, 1947, 1950, 1955, 1956, 1959, 1962, 1967, 1968, 1971, 1974, 1977, 1990, 1996, 2004, 2005, 2008, 2011, 2014, 2019, 2022, 2027, 2032, 2033, 2036, 2039, 2044, 2045, 2048, 2051, 2054, 2055, 2056, 2057, 2058, 2059, 2062, 2072, 2075, 2080, 2084, 2090, 2095, 2101, 2102, 2107, 2112, 2113, 2116, 2121, 2122, 2125, 2128, 2131, 2134, 2138, 2142, 2146, 2150, 2154, 2158, 2162, 2166, 2170, 2176, 2180, 2187, 2193, 2199, 2207, 2211, 2217, 2222, 2232, 2240, 2245, 2248, 2256, 2259, 2267, 2270, 2278, 2281, 2289, 2292, 2300, 2308, 2313, 2319, 2327, 2333, 2334, 2337, 2341, 2344, 2348, 2353, 2356, 2359, 2360, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2395, 2396, 2399, 2400, 2403, 2404, 2405, 2406, 2409, 2414, 2421, 2430, 2433, 2436, 2442, 2445, 2449, 2454, 2460, 2461, 2467, 2470, 2471, 2474, 2477, 2484, 2493, 2499, 2500, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2512, 2518, 2519, 2522, 2523, 2524, 2525, 2528, 2533, 2540, 2547, 2553, 2559, 2565, 2571, 2577, 2583, 2589, 2595, 2601, 2606, 2611, 2618, 2623, 2628, 2633, 2640, 2645, 2652, 2659, 2666, 2686, 2687, 2688, 2691, 2692, 2696, 2701, 2706, 2713, 2718, 2723, 2730, 2731, 2734, 2735, 2736, 2737, 2740, 2747, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2765, 2766, 2767, 2768, 2769, 2770, 2773, 2774, 2775, 2777, 2778, 2781, 2784, 2792, 2795, 2798, 2806, 2809, 2812, 2816, 2819, 2822, 2825, 2828, 2833, 2846, 2859, 2869, 2881, 2882, 2887, 2894, 2895, 2900, 2907, 2910, 2913, 2916, 2919, 2924, 2927, 2930, 2935, 2939, 2946, 2952, 2953, 2954, 2957, 2964, 2971, 2978, 2987, 2994, 3001, 3008, 3017, 3024, 3033, 3040, 3049, 3056, 3065, 3071, 3072, 3073, 3074, 3075, 3078, 3083, 3090, 3097, 3100, 3105, 3113, 3120, 3128, 3136, 3143, 3149, 3156, 3164, 3167, 3173, 3179, 3186, 3192, 3200, 3206, 3213, 3219, 3226, 3229, 3234, 3240, 3248, 3254, 3262, 3270, 3276, 3283, 3287, 3292, 3299, 3304, 3312, 3320, 3328, 3336, 3344, 3352, 3362, 3370, 3378, 3386, 3394, 3402, 3412, 3415, 3416, 3417 }; #endif /** Accessing symbol of state STATE. */ #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) #if YYDEBUG || 0 /* The user-facing name of the symbol whose (internal) number is YYSYMBOL. No bounds checking. */ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "\"end of file\"", "error", "\"invalid token\"", "IF", "ELSE", "THEN", "FAILED", "SET", "LOGFILE", "FACILITY", "DAEMON", "SYSLOG", "MAILSERVER", "HTTPD", "ALLOW", "REJECTOPT", "ADDRESS", "INIT", "TERMINAL", "BATCH", "READONLY", "CLEARTEXT", "MD5HASH", "SHA1HASH", "CRYPT", "DELAY", "PEMFILE", "PEMKEY", "PEMCHAIN", "ENABLE", "DISABLE", "SSLTOKEN", "CIPHER", "CLIENTPEMFILE", "ALLOWSELFCERTIFICATION", "SELFSIGNED", "VERIFY", "CERTIFICATE", "CACERTIFICATEFILE", "CACERTIFICATEPATH", "VALID", "INTERFACE", "LINK", "PACKET", "BYTEIN", "BYTEOUT", "PACKETIN", "PACKETOUT", "SPEED", "SATURATION", "UPLOAD", "DOWNLOAD", "TOTAL", "UP", "DOWN", "IDFILE", "STATEFILE", "SEND", "EXPECT", "CYCLE", "COUNT", "REMINDER", "REPEAT", "LIMITS", "SENDEXPECTBUFFER", "EXPECTBUFFER", "FILECONTENTBUFFER", "HTTPCONTENTBUFFER", "PROGRAMOUTPUT", "NETWORKTIMEOUT", "PROGRAMTIMEOUT", "STARTTIMEOUT", "STOPTIMEOUT", "RESTARTTIMEOUT", "EXECTIMEOUT", "PIDFILE", "START", "STOP", "PATHTOK", "RSAKEY", "HOST", "HOSTNAME", "PORT", "IPV4", "IPV6", "TYPE", "UDP", "TCP", "TCPSSL", "PROTOCOL", "CONNECTION", "ALERT", "NOALERT", "MAILFORMAT", "UNIXSOCKET", "SIGNATURE", "TIMEOUT", "RETRY", "RESTART", "CHECKSUM", "EVERY", "NOTEVERY", "DEFAULT", "HTTP", "HTTPS", "APACHESTATUS", "FTP", "SMTP", "SMTPS", "POP", "POPS", "IMAP", "IMAPS", "CLAMAV", "NNTP", "NTP3", "MYSQL", "MYSQLS", "DNS", "WEBSOCKET", "MQTT", "SSH", "DWP", "LDAP2", "LDAP3", "RDATE", "RSYNC", "TNS", "PGSQL", "POSTFIXPOLICY", "SIP", "LMTP", "GPS", "RADIUS", "MEMCACHE", "REDIS", "MONGODB", "SIEVE", "SPAMASSASSIN", "FAIL2BAN", "STRING", "PATH", "MAILADDR", "MAILFROM", "MAILREPLYTO", "MAILSUBJECT", "MAILBODY", "SERVICENAME", "STRINGNAME", "HOSTGROUPNAME", "NUMBER", "PERCENT", "LOGLIMIT", "CLOSELIMIT", "DNSLIMIT", "KEEPALIVELIMIT", "REPLYLIMIT", "REQUESTLIMIT", "STARTLIMIT", "WAITLIMIT", "GRACEFULLIMIT", "CLEANUPLIMIT", "REAL", "CHECKPROC", "CHECKFILESYS", "CHECKFILE", "CHECKDIR", "CHECKHOST", "CHECKSYSTEM", "CHECKFIFO", "CHECKPROGRAM", "CHECKNET", "THREADS", "CHILDREN", "METHOD", "GET", "HEAD", "STATUS", "ORIGIN", "VERSIONOPT", "READ", "WRITE", "OPERATION", "SERVICETIME", "DISK", "RESOURCE", "MEMORY", "TOTALMEMORY", "LOADAVG1", "LOADAVG5", "LOADAVG15", "SWAP", "MODE", "ACTIVE", "PASSIVE", "MANUAL", "ONREBOOT", "NOSTART", "LASTSTATE", "CORE", "CPU", "TOTALCPU", "CPUUSER", "CPUSYSTEM", "CPUWAIT", "CPUNICE", "CPUHARDIRQ", "CPUSOFTIRQ", "CPUSTEAL", "CPUGUEST", "CPUGUESTNICE", "GROUP", "REQUEST", "DEPENDS", "BASEDIR", "SLOT", "EVENTQUEUE", "SECRET", "HOSTHEADER", "UID", "EUID", "GID", "MMONIT", "INSTANCE", "USERNAME", "PASSWORD", "DATABASE", "TIME", "ATIME", "CTIME", "MTIME", "CHANGED", "MILLISECOND", "SECOND", "MINUTE", "HOUR", "DAY", "MONTH", "SSLV2", "SSLV3", "TLSV1", "TLSV11", "TLSV12", "TLSV13", "CERTMD5", "AUTO", "NOSSLV2", "NOSSLV3", "NOTLSV1", "NOTLSV11", "NOTLSV12", "NOTLSV13", "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE", "INODE", "SPACE", "TFREE", "PERMISSION", "SIZE", "MATCH", "NOT", "IGNORE", "ACTION", "UPTIME", "RESPONSETIME", "EXEC", "UNMONITOR", "PING", "PING4", "PING6", "ICMP", "ICMPECHO", "NONEXIST", "EXIST", "INVALID", "DATA", "RECOVERED", "PASSED", "SUCCEEDED", "URL", "CONTENT", "PID", "PPID", "FSFLAG", "REGISTER", "CREDENTIALS", "URLOBJECT", "ADDRESSOBJECT", "TARGET", "TIMESPEC", "HTTPHEADER", "MAXFORWARD", "FIPS", "SECURITY", "ATTRIBUTE", "FILEDESCRIPTORS", "HARDLINK", "GREATER", "GREATEROREQUAL", "LESS", "LESSOREQUAL", "EQUAL", "NOTEQUAL", "'{'", "'}'", "':'", "'['", "']'", "'@'", "$accept", "cfgfile", "statement_list", "statement", "optproclist", "optproc", "optfilelist", "optfile", "optfilesyslist", "optfilesys", "optdirlist", "optdir", "opthostlist", "opthost", "optnetlist", "optnet", "optsystemlist", "optsystem", "optfifolist", "optfifo", "optprogramlist", "optprogram", "setalert", "setdaemon", "setterminal", "startdelay", "setinit", "setonreboot", "setexpectbuffer", "setlimits", "limitlist", "limit", "setfips", "setlog", "seteventqueue", "setidfile", "setstatefile", "setpid", "setmmonits", "mmonitlist", "mmonit", "mmonitoptlist", "mmonitopt", "credentials", "setssl", "ssl", "ssloptionlist", "ssloption", "sslexpire", "expireoperator", "sslchecksum", "checksumoperator", "sslversionlist", "sslversion", "certmd5", "setmailservers", "setmailformat", "mailserverlist", "mailserver", "mailserveroptlist", "mailserveropt", "sethttpd", "httpdlist", "httpdoption", "pemfile", "clientpemfile", "allowselfcert", "httpdport", "httpdsocket", "httpdsocketoptionlist", "httpdsocketoption", "sigenable", "sigdisable", "signature", "bindaddress", "allow", "$@1", "$@2", "$@3", "$@4", "allowuserlist", "allowuser", "readonly", "checkproc", "checkfile", "checkfilesys", "checkdir", "checkhost", "checknet", "checksystem", "checkfifo", "checkprogram", "start", "stop", "restart", "argumentlist", "useroptionlist", "argument", "useroption", "username", "password", "database", "hostname", "connection", "connectionoptlist", "connectionopt", "connectionurl", "connectionurloptlist", "connectionurlopt", "connectionunix", "connectionuxoptlist", "connectionuxopt", "icmp", "icmpoptlist", "icmpopt", "host", "port", "unixsocket", "ip", "type", "typeoptlist", "typeopt", "outgoing", "protocol", "sendexpect", "websocketlist", "websocket", "smtplist", "smtp", "mqttlist", "mqtt", "mysqllist", "mysql", "postgresqllist", "postgresql", "target", "maxforward", "siplist", "sip", "httplist", "http", "status", "method", "request", "responsesum", "hostheader", "httpheaderlist", "secret", "radiuslist", "radius", "apache_stat_list", "apache_stat", "exist", "pid", "ppid", "uptime", "responsetime", "icmpcount", "icmpsize", "icmptimeout", "icmpoutgoing", "stoptimeout", "starttimeout", "restarttimeout", "programtimeout", "nettimeout", "connectiontimeout", "retry", "actionrate", "urloption", "urloperator", "alert", "alertmail", "noalertmail", "eventoptionlist", "eventoption", "formatlist", "formatoptionlist", "formatoption", "every", "mode", "onreboot", "group", "hostgrouplist", "depend", "dependlist", "dependant", "statusvalue", "resourceprocess", "resourceprocesslist", "resourceprocessopt", "resourcesystem", "resourcesystemlist", "resourcesystemopt", "resourcecpuproc", "resourcecpu", "resourcecpuid", "resourcemem", "resourcememproc", "resourceswap", "resourcethreads", "resourcechild", "resourceload", "resourceloadavg", "coremultiplier", "resourceread", "resourcewrite", "value", "timestamptype", "timestamp", "operator", "time", "totaltime", "currenttime", "exectimeout", "repeat", "action", "action1", "action2", "rateXcycles", "rateXYcycles", "rate1", "rate2", "recovery_success", "recovery_failure", "checksum", "hashtype", "inode", "space", "read", "write", "servicetime", "fsflag", "unit", "permission", "programmatch", "match", "matchflagnot", "size", "hardlink", "uid", "euid", "secattr", "filedescriptorssystem", "filedescriptorsprocess", "filedescriptorsprocesstotal", "gid", "linkstatus", "linkspeed", "linksaturation", "upload", "download", "icmptype", "reminder", YY_NULLPTR }; static const char * yysymbol_name (yysymbol_kind_t yysymbol) { return yytname[yysymbol]; } #endif #define YYPACT_NINF (-1331) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-763) #define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 804, 98, -52, 15, 19, 35, 148, 200, 208, 252, 286, 65, 804, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 40, -32, 68, -1331, -1331, 305, -86, 307, 319, 162, 321, 359, 383, 171, -10, -89, 241, -1331, -29, 21, 455, 480, 506, 603, -1331, 543, 550, 61, -1331, -1331, 849, 343, 1146, 1270, 1297, 1467, 1643, 1270, 1683, 596, -1331, 561, 572, 27, -1331, 1229, -1331, -1331, -1331, -1331, -1331, 538, -1331, -1331, 934, -1331, -1331, -1331, 502, 511, -1331, 241, 389, 354, 385, 1628, 627, 576, 583, 89, 192, 612, 623, 582, 632, 590, 609, 640, 492, 590, 590, 658, 590, -67, 539, 145, 159, 637, 696, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -26, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 25, -194, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 256, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 36, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 46, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 70, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1296, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 6, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 729, 846, -1331, 754, 460, 757, -1331, 814, 8, 769, 772, 823, 832, 626, 797, -1331, 795, 817, 638, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 104, 498, -1331, -1331, -1331, -1331, -1331, 672, 674, -1331, -1331, 235, -1331, 750, -1331, 121, 389, 692, -1331, 934, 1628, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 809, -1331, 831, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -47, -1331, -1331, -1331, 589, 686, 887, 896, 896, 896, 896, 607, 896, 896, -1331, -1331, -1331, 896, 896, 534, 715, 896, 869, 47, 896, 1680, -1331, -1331, -1331, -1331, -1331, -1331, 843, -1331, -1331, 181, 203, -1331, 396, 972, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 696, -1331, 741, 1628, 627, 38, -1331, -1331, -1331, -1331, 157, 896, 715, 509, 896, 896, 793, -1331, 509, 800, 290, 896, 896, 896, -161, 749, 1026, 774, -30, -1, 1016, 829, 896, 896, 896, 850, 1021, 896, 896, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 896, 1728, -1331, -1331, 896, -1331, -1331, -1331, 896, 890, 111, -1331, 921, -1331, 976, 314, 942, -1331, -1331, -1331, -1331, -1331, -1331, 950, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 864, 959, -1331, 966, 977, 983, 822, 971, 997, -1331, -1331, -1331, -1331, -1331, -1331, 1127, -1331, -1331, -1331, 854, 855, 856, 857, 858, 860, 861, 863, 867, 868, -1331, -1331, 880, 882, 883, 885, 894, 895, 897, 898, 903, 905, -1331, -1331, -1331, -1331, -1331, -1331, 1000, 1038, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 320, 1360, 1083, -1331, 1135, 1070, 45, 278, -43, -1331, -1331, -1331, 1081, 1084, 334, 335, 470, 936, 930, 1145, -1331, 896, 1078, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1079, 1080, 288, 288, 896, 896, 288, 288, 288, 288, 869, 869, 869, 1085, -12, -1331, -1331, 1234, 946, 1145, -1331, 331, -1331, 1235, -1331, 896, 1091, -7, -1331, 1092, 298, -1331, 1098, 313, -1331, -1331, -1331, 1628, 1431, -1331, -1331, -1331, 1101, 1153, 869, 869, 869, 869, 1154, 1104, -1331, -1331, 775, 1115, 1116, 783, 794, 802, 380, 393, 435, 869, 896, 445, 896, 288, -1331, -1331, -1331, 1182, -1331, -1331, -1331, 1182, 869, 869, 869, 1118, 1119, 1121, 896, 896, 869, 288, 288, 488, -1331, 1269, 288, 1125, 869, 869, 1046, 1142, -1331, 460, 16, -1331, -1331, -1331, -1331, -1331, -1331, 1147, 1148, 1150, 1151, 1152, 1127, 166, -1331, -1331, 13, 1144, 1157, 1158, 1162, 1163, 941, 958, 1164, 1165, -1331, 1136, 1143, 1168, 1169, 1170, 1171, 1172, 1181, 1183, 1184, -1331, 1074, -112, -1331, 1083, 627, -1331, 1082, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 869, 869, 869, 869, 869, 869, -1331, 886, 1186, -1331, 566, 1190, 1244, -1331, -1331, -1331, -1331, 538, 538, 491, 494, 474, 485, 1161, 1192, 1308, 1309, 1327, 777, -1331, 1285, 643, -1331, -1331, 566, 73, 1194, 643, 288, 1117, -1331, 1123, -1331, 1130, -1331, 1527, 1083, 869, 0, 1343, 1344, 1346, 1353, 869, 538, 869, 869, 869, 777, 869, 869, -1331, -1331, -1331, -1331, 1178, 538, 1185, 538, 1132, 1133, 1370, 571, 73, 1214, 288, 581, 75, 75, 75, 1103, -1331, 75, 75, 75, -1331, 1373, 1375, 1377, 1233, 122, 250, 1236, 1237, 1380, 585, 699, 73, 1239, 643, 1240, 869, 1387, 1388, 869, 869, 1093, 1093, -1331, 1254, 1152, 1152, 1152, 1127, -1331, 1152, -1331, -1331, -1331, -1331, 575, 595, 1249, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1739, 538, 538, 538, 538, 806, 881, 884, 888, 901, 908, -1331, -1331, -1331, 627, -1331, -1331, 1395, 1396, 1398, 1405, 1406, 1407, 72, 869, 869, -1331, 431, 1273, 1274, 608, 1837, 1265, 1271, 896, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1414, 869, 1418, 1193, 1193, 1243, 538, 1245, 538, -1331, -1331, -1331, -1331, -1331, -1331, 643, 643, 643, -1331, -1331, -1331, -1331, -1331, 869, -1331, -1331, -1331, -1331, -1331, -1331, 590, -1331, -1331, 1424, 72, 431, 1425, 1426, 869, 1424, -1331, -1331, -1331, -1331, 1083, 627, 1427, 1294, 1432, 643, 643, 643, 643, 1434, 869, 1438, 1442, 1446, 869, 1447, 1449, 869, 1193, 869, 1193, 869, 869, 643, 73, 1293, 1450, 869, 745, 869, 869, 1317, 1311, 1313, 1314, -1331, -1331, -1331, -1331, -1331, -1331, 1453, 1460, 1462, -1331, 75, 1463, 1464, 1466, 75, 643, 643, 643, 869, 1193, 1193, 1193, 1193, 269, 348, 643, -1331, -1331, -1331, -1331, 1483, 869, 1424, -1331, 1485, 643, 643, 1486, 1487, 1332, 1354, -1331, 1152, 1152, 1152, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 643, 643, 643, 643, 643, 643, 52, 509, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1490, 1492, 1502, 1369, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1515, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1025, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 37, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1289, -1331, 1374, 643, 1521, 403, -1331, -1331, -1331, -1331, 1193, -1331, 1193, -1331, -1331, 1424, 1523, 493, 130, -1331, 1528, 1529, 643, 643, 1530, -1331, 627, -1331, 643, 869, 643, 1424, -1331, -1331, -1331, 643, 1531, 643, 643, 643, 1533, 643, 643, 1549, 869, 1550, 869, 1551, 1552, -1331, 1555, 869, 643, 1557, 869, 869, 1558, 1559, -1331, -1331, 1333, -1331, 643, 643, 643, 1565, 643, 643, 643, 1572, 1424, 1574, 1424, 1575, 869, 869, 869, 869, 154, 177, 527, 625, 1424, 643, 1577, -1331, 643, -1331, 1424, 643, 643, -1331, -1331, 1424, 1424, 1424, 1424, 1424, 1424, 1286, 1444, 643, 643, 643, -1331, 643, 1576, 948, 948, 1448, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, -1331, -1331, 1025, -1331, 810, 810, 91, 91, 1451, 1454, 1445, 1455, 37, -1331, 810, 621, 481, 1381, -1331, 910, 1424, 643, -1331, -1331, -1331, -1331, -1331, 643, 1452, 373, 1535, 584, -1331, -1331, 643, 643, 1574, 1424, 643, -1331, 1424, 1594, 1424, -1331, -1331, 643, -1331, -1331, 1424, 643, -1331, -1331, 643, 1595, 643, 1599, 643, 643, 643, 1601, 1424, 643, 1604, 1605, 643, 643, -1331, 1424, 1424, 1424, 643, 1574, 1574, 1574, 643, -1331, 215, -1331, -1331, 643, 1606, 1607, 1608, 1609, 639, -1331, -1331, -1331, 869, 639, 869, 639, 869, 639, 869, -1331, 1424, 643, 1424, -1331, 1424, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1465, -1331, 1424, 1424, 1424, 1424, -1331, -1331, -1331, 1478, 970, 896, 1018, 1481, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1472, 1479, 1480, 1488, 1489, 1491, 1497, 1498, 1499, 1501, -1331, -1331, -1331, -1331, 1532, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1493, -1331, -1331, -1331, -1331, 440, 1503, -1331, -1331, -1331, 1500, -1331, -1331, -1331, -1331, -1331, 1424, 1424, 1422, 1535, 1556, -1331, 869, 869, 869, 1574, 1574, -1331, -1331, 1424, -1331, 643, -1331, 1424, -1331, 1424, 1424, 643, 1424, 643, 1424, 1424, 1424, 643, -1331, 1424, 643, 643, 1424, 1424, -1331, -1331, -1331, 1424, -1331, -1331, -1331, 1574, 1622, -1331, 1424, 643, 643, 643, 643, 869, 1652, 869, 1655, 869, 1656, 869, 1657, -1331, 1424, -1331, -1331, 1428, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1517, -1331, -1331, -1331, -132, 1514, 1518, 1520, 1534, 1536, 1537, 1538, 1541, 1542, 1543, 22, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -3, -1331, -1331, 1663, 1674, 1676, -1331, -1331, -1331, 1424, -1331, -1331, -1331, 1424, -1331, 1424, -1331, -1331, -1331, 1424, -1331, 1424, 1424, -1331, -1331, -1331, -1331, 869, -1331, 1424, 1424, 1424, 1424, 1677, 643, 1678, 643, 1679, 643, 1692, 643, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1093, 1093, 1560, -1331, 1640, 643, 643, 643, -1331, -1331, -1331, -1331, -1331, -1331, 1696, -1331, -1331, -1331, -1331, 643, 1424, 643, 1424, 643, 1424, 643, 1424, 1562, 1569, -1331, -1331, -1331, -1331, -1331, 643, 1424, -1331, 1424, -1331, 1424, -1331, 1424, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_int16 yydefact[] = { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 6, 8, 9, 20, 22, 19, 21, 23, 10, 11, 17, 18, 16, 12, 7, 13, 14, 15, 33, 59, 80, 102, 120, 135, 152, 167, 185, 0, 0, 0, 310, 206, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, 640, 0, 0, 0, 0, 0, 372, 0, 0, 0, 1, 5, 24, 25, 26, 27, 28, 32, 29, 30, 31, 232, 231, 204, 301, 593, 297, 309, 203, 257, 237, 238, 212, 797, 239, 606, 0, 207, 208, 209, 0, 0, 244, 240, 252, 0, 0, 0, 852, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 36, 37, 48, 49, 50, 38, 39, 40, 47, 51, 52, 640, 605, 53, 54, 55, 56, 57, 58, 41, 42, 43, 44, 45, 46, 815, 815, 60, 61, 62, 63, 64, 66, 68, 67, 76, 77, 78, 79, 65, 72, 69, 75, 73, 74, 70, 71, 0, 81, 82, 83, 84, 85, 86, 88, 87, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 89, 90, 91, 0, 103, 104, 105, 106, 107, 109, 111, 110, 116, 117, 118, 119, 108, 112, 115, 113, 114, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 0, 136, 137, 138, 139, 145, 149, 146, 147, 148, 150, 151, 140, 141, 142, 143, 144, 0, 153, 154, 155, 156, 165, 157, 158, 159, 160, 161, 162, 163, 164, 166, 168, 169, 170, 171, 172, 174, 176, 175, 181, 182, 183, 184, 173, 177, 180, 178, 179, 0, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 0, 0, 202, 0, 299, 0, 298, 396, 0, 0, 0, 0, 0, 255, 0, 323, 0, 0, 0, 312, 311, 313, 314, 315, 319, 320, 338, 339, 316, 317, 318, 0, 0, 798, 799, 800, 801, 210, 0, 0, 646, 647, 0, 642, 234, 236, 243, 252, 0, 241, 0, 0, 624, 611, 612, 626, 627, 634, 632, 614, 636, 613, 635, 631, 638, 620, 622, 637, 628, 633, 610, 639, 617, 621, 625, 618, 623, 616, 615, 629, 630, 619, 0, 608, 0, 199, 361, 362, 363, 364, 367, 366, 365, 368, 369, 373, 386, 387, 591, 382, 370, 371, 449, 0, 0, 726, 726, 726, 726, 0, 726, 726, 707, 708, 709, 726, 726, 0, 0, 726, 762, 449, 726, 762, 667, 669, 670, 671, 672, 673, 710, 674, 675, 587, 585, 607, 589, 0, 649, 650, 651, 652, 653, 654, 655, 656, 657, 663, 660, 661, 0, 0, 852, 779, 720, 721, 722, 723, 779, 726, 816, 0, 726, 726, 0, 816, 0, 0, 0, 726, 726, 726, 0, 726, 726, 0, 449, 449, 0, 0, 726, 726, 726, 0, 0, 726, 726, 695, 686, 687, 688, 689, 690, 691, 692, 693, 694, 726, 762, 677, 682, 726, 680, 681, 679, 726, 0, 0, 233, 0, 301, 0, 0, 0, 281, 283, 285, 287, 289, 291, 0, 293, 282, 284, 286, 288, 290, 292, 305, 306, 307, 308, 302, 303, 304, 0, 0, 295, 0, 0, 0, 355, 343, 0, 340, 321, 335, 337, 257, 322, 359, 326, 334, 336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 211, 213, 644, 645, 296, 643, 0, 0, 658, 245, 247, 248, 249, 250, 242, 253, 0, 0, 640, 609, 853, 0, 0, 0, 591, 383, 384, 374, 0, 0, 0, 0, 0, 0, 0, 0, 426, 726, 0, 733, 727, 728, 729, 730, 731, 732, 0, 0, 0, 0, 726, 726, 0, 0, 0, 0, 762, 762, 762, 0, 0, 763, 764, 0, 0, 0, 426, 0, 668, 0, 711, 726, 0, 587, 376, 0, 585, 378, 0, 589, 380, 648, 662, 0, 0, 602, 780, 781, 0, 0, 762, 762, 762, 762, 0, 0, 600, 601, 0, 0, 0, 0, 0, 0, 0, 0, 0, 762, 726, 0, 726, 0, 442, 442, 442, 0, 442, 442, 442, 0, 762, 762, 762, 0, 0, 0, 726, 726, 762, 0, 0, 0, 678, 0, 0, 0, 762, 762, 0, 0, 205, 300, 277, 393, 392, 394, 294, 594, 397, 344, 345, 346, 0, 0, 359, 0, 360, 324, 325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 279, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 235, 0, 0, 641, 640, 852, 854, 0, 388, 390, 389, 391, 385, 375, 450, 452, 762, 762, 762, 762, 762, 762, 416, 0, 0, 400, 762, 0, 0, 704, 705, 719, 718, 797, 797, 0, 0, 797, 797, 0, 0, 0, 0, 0, 734, 760, 0, 0, 416, 400, 762, 719, 0, 0, 0, 0, 377, 0, 379, 0, 381, 0, 640, 762, 762, 0, 0, 0, 0, 762, 797, 762, 762, 762, 734, 762, 762, 810, 809, 814, 813, 719, 797, 719, 797, 719, 0, 0, 0, 719, 0, 0, 797, 762, 762, 762, 0, 442, 762, 762, 762, 442, 0, 0, 0, 0, 797, 797, 0, 0, 0, 797, 797, 719, 0, 0, 0, 762, 0, 0, 762, 762, 277, 277, 278, 0, 0, 0, 0, 359, 358, 348, 356, 342, 256, 333, 0, 0, 0, 327, 265, 267, 266, 264, 268, 261, 262, 259, 260, 269, 270, 263, 797, 797, 797, 797, 0, 0, 0, 0, 0, 0, 246, 659, 251, 852, 200, 592, 0, 0, 0, 0, 0, 0, 762, 762, 762, 451, 762, 0, 0, 0, 0, 0, 0, 726, 427, 428, 429, 430, 432, 431, 433, 0, 762, 0, 743, 743, 719, 797, 719, 797, 699, 698, 701, 700, 683, 684, 0, 0, 0, 735, 736, 737, 738, 739, 762, 761, 755, 756, 750, 754, 753, 0, 757, 758, 768, 762, 762, 0, 0, 762, 768, 706, 588, 586, 590, 640, 852, 0, 0, 0, 0, 0, 0, 0, 0, 762, 0, 0, 0, 762, 0, 0, 762, 743, 762, 743, 762, 762, 0, 719, 0, 0, 762, 797, 762, 762, 0, 0, 0, 0, 443, 448, 444, 445, 446, 447, 0, 0, 0, 851, 762, 0, 0, 0, 762, 0, 0, 0, 762, 743, 743, 743, 743, 797, 797, 0, 697, 696, 703, 702, 0, 762, 768, 685, 0, 0, 0, 0, 0, 0, 0, 274, 350, 352, 354, 341, 357, 328, 330, 329, 331, 332, 280, 214, 215, 216, 217, 218, 219, 220, 221, 224, 225, 222, 223, 226, 227, 228, 229, 201, 0, 0, 0, 0, 0, 0, 0, 0, 421, 423, 422, 417, 419, 420, 418, 0, 0, 0, 0, 453, 454, 411, 413, 412, 401, 402, 403, 409, 404, 405, 408, 407, 410, 406, 0, 501, 502, 457, 455, 458, 465, 536, 536, 0, 469, 509, 509, 486, 487, 473, 474, 464, 483, 484, 517, 517, 466, 0, 513, 498, 467, 475, 476, 490, 492, 499, 524, 488, 532, 477, 470, 556, 478, 491, 479, 493, 497, 468, 0, 596, 0, 0, 0, 0, 744, 712, 715, 714, 743, 717, 743, 576, 577, 768, 0, 745, 0, 575, 0, 0, 0, 0, 0, 666, 852, 603, 0, 762, 0, 768, 818, 820, 725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 762, 0, 762, 0, 0, 796, 0, 762, 0, 0, 762, 762, 0, 0, 584, 581, 0, 582, 0, 0, 0, 0, 0, 0, 0, 0, 768, 773, 768, 0, 762, 762, 762, 762, 0, 0, 0, 0, 768, 0, 0, 676, 0, 665, 768, 0, 0, 275, 276, 768, 768, 768, 768, 768, 768, 272, 0, 0, 0, 0, 462, 0, 456, 471, 472, 0, 726, 726, 726, 726, 726, 726, 726, 726, 726, 726, 561, 562, 463, 559, 495, 496, 481, 482, 0, 0, 0, 0, 500, 503, 480, 485, 494, 489, 595, 0, 768, 0, 598, 597, 713, 716, 574, 0, 0, 745, 747, 0, 759, 769, 0, 0, 773, 768, 0, 604, 768, 0, 768, 803, 778, 0, 808, 807, 768, 0, 812, 811, 0, 0, 0, 0, 0, 0, 0, 0, 768, 0, 0, 0, 0, 0, 583, 768, 768, 768, 0, 773, 773, 773, 0, 834, 0, 836, 835, 0, 0, 0, 0, 0, 0, 740, 741, 742, 762, 0, 762, 0, 762, 0, 762, 837, 768, 0, 768, 805, 768, 804, 821, 822, 823, 824, 832, 833, 273, 0, 599, 768, 768, 768, 768, 460, 461, 459, 0, 0, 726, 0, 0, 553, 538, 539, 537, 542, 543, 540, 541, 544, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 560, 511, 512, 510, 0, 519, 520, 518, 507, 505, 508, 506, 504, 515, 516, 514, 0, 526, 527, 528, 525, 0, 0, 534, 535, 533, 0, 558, 557, 579, 580, 424, 768, 768, 0, 747, 0, 751, 765, 765, 765, 773, 773, 425, 829, 768, 802, 0, 776, 768, 819, 768, 768, 0, 768, 0, 768, 768, 768, 0, 782, 768, 0, 0, 768, 768, 435, 436, 437, 768, 439, 440, 441, 773, 0, 774, 768, 0, 0, 0, 0, 762, 0, 762, 0, 762, 0, 762, 0, 827, 768, 664, 806, 0, 414, 825, 826, 398, 551, 547, 548, 0, 550, 549, 552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 277, 395, 530, 529, 531, 555, 831, 578, 746, 752, 0, 766, 767, 0, 0, 0, 415, 399, 830, 768, 817, 724, 791, 768, 793, 768, 794, 795, 784, 768, 783, 768, 768, 787, 786, 434, 438, 765, 838, 768, 768, 768, 768, 0, 0, 0, 0, 0, 0, 0, 0, 828, 271, 546, 554, 545, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 277, 277, 0, 748, 0, 0, 0, 0, 777, 790, 792, 785, 789, 788, 0, 842, 839, 848, 845, 0, 768, 0, 768, 0, 768, 0, 768, 0, 0, 521, 749, 770, 771, 772, 0, 768, 843, 768, 840, 768, 849, 768, 846, 522, 523, 775, 844, 841, 850, 847 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -1331, -1331, -1331, 1698, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1615, -1331, -1331, 1367, -1331, -82, 1176, -1331, -823, -1331, -322, -862, -1331, -342, -341, -1331, -1331, -1331, 1638, 1216, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 209, -737, -691, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 1439, 1474, 1689, -103, -407, -390, -562, -667, -377, -1331, -1331, 1650, 925, -1331, 1653, 929, -1331, -1331, 1094, -1331, -1331, 79, -1331, -361, 1100, 1312, -1331, -816, -1331, -1331, -1331, -796, -507, -1331, 427, 592, -1331, -1331, -1331, 587, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 604, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, 448, 951, -1331, -1331, 1662, -730, -1331, -1331, -1331, -1331, 1096, 1105, 1095, 1155, -1331, -484, -178, 1848, -490, -449, 1919, 1748, -1331, -320, -352, -140, 1408, -293, 1927, 1935, 1943, 1951, -1331, 1959, -1331, 1324, -1331, -1331, -1331, 1336, -1331, -1331, 1258, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -1331, -217, -1331, -1331, -1331, -1331, 529, -224, 26, -397, 931, -437, -398, 437, 300, -1165, -218, -1314, -928, -897, -420, -1330, -51, -790, -1331, 1316, -1331, -1331, -1331, -1331, -1331, -1331, -39, 479, -1331, -1331, 1614, -1331, 81, 992, -1331, -1331, -1331, -1331, -1331, 1032, -1331, -1331, -1331, -1331, -1331, 1086, -440 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { 0, 11, 12, 13, 71, 130, 72, 159, 73, 180, 74, 202, 75, 220, 76, 235, 77, 252, 78, 266, 79, 284, 14, 15, 16, 299, 17, 18, 19, 20, 329, 574, 21, 22, 23, 24, 25, 26, 27, 102, 103, 343, 582, 346, 28, 525, 328, 562, 1103, 1401, 526, 877, 903, 527, 528, 29, 30, 84, 85, 301, 529, 31, 86, 317, 318, 319, 320, 321, 322, 731, 891, 323, 324, 325, 326, 327, 726, 878, 879, 880, 883, 884, 730, 32, 33, 34, 35, 36, 37, 38, 39, 40, 131, 132, 133, 395, 597, 396, 599, 530, 531, 1454, 534, 134, 930, 1118, 135, 926, 1105, 136, 778, 938, 226, 845, 1024, 608, 777, 609, 1119, 939, 1278, 1409, 1121, 940, 941, 1304, 1305, 1296, 1438, 1306, 1450, 1298, 1442, 1307, 1455, 1458, 1459, 1308, 1460, 1279, 1418, 1419, 1420, 1421, 1422, 1423, 1540, 1462, 1309, 1463, 1294, 1295, 137, 138, 139, 140, 1025, 1026, 1027, 1028, 1029, 650, 647, 653, 600, 304, 943, 944, 141, 1108, 671, 142, 143, 144, 379, 380, 107, 339, 340, 145, 146, 147, 148, 754, 149, 445, 446, 295, 150, 420, 421, 264, 495, 496, 422, 497, 498, 499, 423, 500, 424, 425, 426, 427, 644, 428, 429, 785, 460, 171, 619, 968, 1380, 1179, 1322, 1472, 977, 978, 1325, 634, 635, 636, 1564, 1191, 1369, 172, 662, 192, 193, 194, 195, 196, 197, 334, 173, 296, 174, 461, 175, 176, 151, 152, 153, 265, 154, 155, 156, 246, 247, 248, 249, 250, 849, 382 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 642, 585, 586, 449, 316, 598, 620, 621, 622, 658, 625, 626, 1063, 1064, 675, 627, 628, 430, 431, 632, 433, 584, 640, 646, 649, 1324, 652, 592, 590, 535, 536, 450, 537, 887, 501, 764, 885, 915, 874, 875, 598, 598, 465, 598, 1617, 1618, 578, 797, 942, 594, 601, 80, 473, 594, 1510, 712, 1620, 638, 992, 668, 659, 660, 672, 673, 104, 69, 96, 104, 462, 677, 678, 679, 942, 682, 684, 706, 475, 117, -762, 601, 696, 697, 698, 434, 764, 702, 703, 764, 463, 645, 764, 1020, 1271, 393, 394, 60, 108, 704, 663, 109, 214, 707, 118, 310, 278, 708, 41, 1116, 42, 1100, 43, 44, 476, 638, 1120, 45, 46, 1300, 82, 477, 478, 479, 480, 302, 680, 99, 100, 601, 657, 47, 551, 552, 553, 1323, 1122, 1021, 554, 555, 798, 556, 557, 602, 558, 559, 1565, 1566, 1070, 1621, 538, 539, 633, 715, 310, 48, 49, 216, 401, 1116, 508, 280, 1605, 50, 61, 51, 1120, 1043, 62, 83, 935, 936, 1439, 1022, 595, 52, 596, 401, 595, 1606, 596, 659, 660, 81, 63, 502, 1122, 760, 401, 97, 98, 53, 1069, 54, 551, 552, 553, 761, 401, 916, 554, 555, 1124, 556, 557, 1324, 558, 559, 970, 971, 83, 793, 794, 795, 595, 779, 596, 1301, 1302, 580, 1509, 88, 401, 972, 633, 633, 435, 633, 787, 788, 973, 385, 386, 666, 888, 105, 889, 440, 447, 503, 592, 685, 686, 687, 688, 817, 818, 819, 820, 806, 666, 1303, 1124, 606, 451, 452, 453, 454, 455, 603, 1631, 605, 839, 583, 465, 451, 452, 453, 454, 472, 689, 690, 691, 692, 890, 854, 855, 856, 106, 645, 501, 448, 637, 862, 110, 560, 840, 456, 843, 457, 504, 870, 871, 970, 971, 1045, 55, 64, 578, 661, 415, 648, 417, 481, 860, 861, 1376, 592, 972, 458, 1648, 1649, 1650, 417, 1250, 973, 56, 509, 510, 918, 540, 876, 57, 393, 394, 459, 87, 876, 474, 1381, 637, 1070, 1070, 1070, 387, 388, 459, 1023, 813, 1662, 437, 438, 439, 937, 710, 393, 394, 560, 157, 65, 920, 921, 922, 923, 924, 925, 1101, 66, 441, 442, 945, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 711, 330, 331, 332, 333, 335, 336, 337, 338, 981, 982, 451, 452, 453, 454, 1377, 1378, 1379, 1252, 58, 974, 648, 991, 993, 975, 976, 67, 595, 998, 596, 1000, 1001, 1002, 401, 1004, 1005, 651, 561, 1377, 1378, 1379, 669, 670, 663, 664, 762, 120, 121, 1015, 595, 1123, 596, 1030, 1031, 1032, 763, 581, 1035, 1036, 1037, 68, 53, 122, 466, 467, 783, 468, 1127, 123, 1106, 124, 125, 1054, 1125, 1112, 89, 1058, 784, 757, 1061, 1062, 716, 665, 717, 1324, 1324, 1324, 90, 592, 310, 335, 336, 337, 338, 91, 1100, 1320, 1292, 92, 886, 1123, 768, 770, 95, 1093, 974, 970, 971, 803, 975, 976, 769, 771, 1324, 469, 931, 932, 1127, 310, 651, 784, 972, 1106, 1125, 508, 399, 1314, 93, 973, 330, 331, 332, 333, 1109, 1110, 1111, 603, 1128, 605, 470, 471, 1113, 1114, 933, 595, 415, 596, 934, 330, 331, 332, 333, 94, 1176, 935, 936, 101, 833, 417, 595, 111, 596, 126, 393, 394, 1478, 127, 1174, 577, 784, 835, 400, 1562, 1562, 1562, 1188, 661, 1199, 1180, 198, 215, 128, 784, 129, 279, 112, 1192, 1193, 1076, 563, 1196, 564, 565, 566, 567, 568, 569, 570, 571, 572, 1505, 1506, 1507, 1563, 1563, 1563, 1208, 1553, 633, 1554, 1212, 113, 837, 1215, 984, 1217, 1320, 1219, 1220, 595, 1222, 596, 841, 1225, 784, 1228, 1229, 330, 331, 332, 333, 1104, 297, 158, 784, 1117, 1216, 772, 1218, 1416, 1416, 1237, 595, 917, 596, 1241, 114, 773, 115, 1245, 931, 932, 954, 755, 1292, 116, 1436, 1436, 1440, 1440, 393, 394, 1256, 956, 298, 865, 1448, 1452, 950, 401, 341, 952, 1246, 1247, 1248, 1249, 1056, 784, 933, 1272, 784, 300, 934, 784, 1104, 1117, 347, 1562, 342, 935, 936, 402, 403, 974, 549, 550, 601, 975, 976, 404, 405, 990, 345, 406, 1383, 407, 408, 409, 410, 411, 602, 509, 510, 1567, 1568, 381, 1619, 348, 1563, 412, 413, 1131, 1132, 1133, 937, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 595, 1101, 596, 1071, 633, 383, 1587, 970, 971, 1013, 391, 414, 384, 1072, 330, 331, 332, 333, 393, 394, 1018, 784, 972, 1073, 1050, 330, 331, 332, 333, 973, 1185, 1186, 1187, 1074, 948, 949, 1107, 397, 955, 957, 1126, 389, 415, 1644, 1645, 416, 1331, 764, 1293, 1377, 1378, 1379, 390, 846, 847, 417, 850, 851, 852, 1456, 418, 392, 1457, 1385, 1203, 1204, 1205, 1206, 398, 1333, 1321, 999, 1316, 443, 1317, 623, 624, 419, 330, 331, 332, 333, 1221, 1007, 1345, 1009, 1347, 598, 432, 1107, 1126, 1351, 573, 1019, 1354, 1355, 603, 604, 605, 1, 669, 670, 1382, 1384, 1386, 629, 630, 1044, 1046, 1242, 1243, 1244, 1051, 1053, 1372, 1373, 1374, 1375, 436, 1254, 937, 330, 331, 332, 333, 330, 331, 332, 333, 1259, 1260, 444, 1102, 509, 510, 1451, 1115, 1198, 1052, 349, 119, 350, 351, 352, 353, 354, 355, 1377, 1378, 1379, 1473, 1474, 1475, 1077, 1078, 1079, 1080, 505, 606, 506, 1189, 1377, 1378, 1379, 1265, 1266, 1267, 1268, 1269, 1270, 694, 695, 607, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 533, 1226, 1102, 1115, 356, 699, 700, 1417, 1417, 507, 357, 974, 532, 358, 541, 975, 976, 1182, 542, 1184, 823, 824, 1293, 543, 1437, 1437, 1441, 1441, 827, 828, 120, 121, 544, 1034, 1449, 1453, 545, 1038, 1197, 829, 830, 1407, 1408, 546, 1516, 53, 122, 831, 832, 1518, 547, 1520, 123, 1522, 124, 125, 330, 331, 332, 333, 897, 898, 1312, 548, 1315, 1517, 575, 1519, 576, 1521, 579, 1523, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1328, 1329, 1227, 588, 612, 593, 1332, 610, 1334, 611, 359, 899, 900, 1336, 631, 1338, 1339, 1340, 360, 1342, 1343, 330, 331, 332, 333, 451, 452, 453, 454, 1257, 1352, 681, 1251, 1253, 963, 964, 965, 966, 967, 1536, 1359, 1360, 1361, 633, 1363, 1364, 1365, 163, 184, 206, 927, 928, 361, 270, 362, 654, 363, 663, 509, 510, 364, 1388, 1081, 1082, 1390, 126, 643, 1392, 1393, 127, 656, 1410, 613, 614, 615, 616, 617, 618, 674, 1403, 1404, 1405, 693, 1406, 128, 676, 129, 701, 177, 199, 217, 709, 365, 366, 281, 713, 665, 367, 368, 715, 369, 335, 336, 337, 338, 370, 718, 371, 372, 373, 374, 1066, 1067, 1068, 719, 375, 376, 377, 378, 1467, 1594, 720, 1596, 721, 1598, 1468, 1600, 1281, 178, 200, 218, 722, 1476, 1477, 282, -347, 1480, 1083, 1084, 591, 1085, 1086, 723, 1484, 1087, 1088, 1411, 1486, 724, 1412, 1487, 612, 1489, 725, 1491, 1492, 1493, 1089, 1090, 1496, 1318, 727, 1499, 1500, 1091, 1092, 1464, 1465, 1504, 1534, 1535, 729, 1508, 179, 752, 786, 1335, 1511, 789, 790, 791, 792, 1537, 1538, 1413, 732, 733, 734, 735, 736, 1414, 737, 738, 804, 739, 1525, 509, 510, 740, 741, 104, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 742, 753, 743, 744, 1367, 745, 1370, 758, 613, 614, 615, 616, 617, 618, 746, 747, 1387, 748, 749, 834, 836, 838, 1391, 750, 842, 751, 844, 1394, 1395, 1396, 1397, 1398, 1399, 759, 766, 120, 121, 774, 767, 775, 776, 780, 781, 782, 863, 864, 866, 800, 796, 868, 53, 122, 799, 805, 807, 809, 305, 123, 306, 124, 125, 811, 509, 510, 815, 816, 821, 822, 307, 1415, 612, 308, 309, 310, 1466, 311, 312, 1570, 825, 826, 848, 857, 858, 1574, 859, 1576, 201, 867, 869, 1580, 872, 1479, 1582, 1583, 1481, 873, 1483, 683, 892, 904, -349, -351, 1485, -353, 881, 882, 905, 1590, 1591, 1592, 1593, 893, 894, 219, 1495, 895, 947, 896, 901, 902, 914, 1501, 1502, 1503, 313, 958, 960, 961, 919, 951, 953, 906, 907, 908, 909, 910, 314, 315, 613, 614, 615, 616, 617, 618, 911, 962, 912, 913, 985, 929, 1524, 126, 1526, 946, 1527, 127, 959, 969, 983, 120, 121, 994, 995, 986, 996, 1529, 1530, 1531, 1532, 987, 128, 997, 129, 1006, 53, 122, 988, 1010, 1016, 1011, 1008, 123, 1014, 124, 125, 1017, 120, 121, 1012, 1033, 1637, 1039, 1639, 1040, 1641, 1041, 1643, 1042, 1049, 1047, 1048, 53, 122, 1055, 1057, 1059, 1060, 1065, 123, 876, 124, 125, 1075, 1094, 1095, 349, 1096, 350, 351, 352, 353, 354, 355, 1097, 1098, 1099, 1129, 1130, 1172, 1557, 1558, 1652, 1175, 1654, 1173, 1656, 1177, 1658, 1181, 1178, 1183, 1190, 1569, 1194, 1195, 1200, 1571, 1201, 1572, 1573, 1202, 1575, 1207, 1577, 1578, 1579, 1209, 1223, 1581, 401, 1210, 1584, 1585, 356, 1211, 1213, 1586, 1214, 1224, 357, 1230, 1234, 358, 1589, 1231, 126, 1232, 1233, 1235, 127, 1236, 1238, 1239, 234, 1240, 1263, 349, 1602, 350, 351, 352, 353, 354, 355, 128, 482, 129, 409, 410, 411, 483, 1255, 126, 1258, 1261, 1262, 127, 1264, 1273, 484, 1274, 485, 486, 487, 488, 489, 490, 491, 492, 493, 1275, 128, 1276, 129, 160, 181, 203, 221, 236, 253, 267, 285, 1625, 1277, 356, 1310, 1626, 1311, 1627, 1313, 357, 1319, 1628, 358, 1629, 1630, 1326, 1327, 1330, 1337, 359, 1341, 1632, 1633, 1634, 1635, 120, 121, 360, 161, 182, 204, 222, 237, 254, 268, 286, 1344, 1346, 1348, 1349, 53, 122, 1350, 416, 1353, 1356, 1357, 123, 1358, 124, 125, 349, 1362, 350, 351, 352, 353, 354, 355, 1366, 1368, 361, 1371, 362, 1389, 363, 1402, 1400, 1653, 364, 1655, 1424, 1657, 1443, 1659, 494, 1444, 1445, 1446, 1471, 1461, 1482, 1488, 1663, 1469, 1664, 1490, 1665, 1494, 1666, 359, 1497, 1498, 1512, 1513, 1514, 1515, 1528, 360, 356, 1533, 365, 366, 1539, 1541, 357, 367, 368, 358, 369, 1588, 1542, 1543, 1551, 370, 1552, 371, 372, 373, 374, 1544, 1545, 1556, 1546, 375, 376, 377, 378, 251, 1547, 1548, 1549, 361, 1550, 362, 1555, 363, 1559, 1561, 1595, 364, 126, 1597, 1599, 1601, 127, 1603, 1607, 756, 1604, 1622, 1608, 349, 1609, 350, 351, 352, 353, 354, 355, 128, 1623, 129, 1624, 1636, 1638, 1640, 1610, 283, 1611, 1612, 1613, 365, 366, 1614, 1615, 1616, 367, 368, 1642, 369, 1647, 1646, 1651, 1660, 370, 359, 371, 372, 373, 374, 1661, 70, 587, 360, 375, 376, 377, 378, 344, 356, 120, 121, 728, 303, 714, 357, 224, 980, 358, 225, 979, 639, 1447, 1297, 802, 53, 122, 1299, 814, 801, 256, 1280, 123, 1435, 124, 125, 810, 361, 812, 362, 59, 363, 808, 765, 705, 364, 589, 641, 1003, 1470, 120, 121, 162, 183, 205, 223, 238, 255, 269, 287, 655, 1560, 667, 464, 0, 53, 122, 0, 0, 853, 0, 0, 123, 0, 124, 125, 0, 365, 366, 0, 0, 0, 367, 368, 0, 369, 0, 0, 0, 0, 370, 0, 371, 372, 373, 374, 359, 0, 0, 0, 375, 376, 377, 378, 360, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 0, 0, 633, 0, 0, 989, 0, 126, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 361, 0, 362, 0, 363, 402, 403, 128, 364, 129, 0, 0, 0, 404, 405, 0, 0, 406, 0, 407, 408, 409, 410, 411, 0, 0, 0, 0, 126, 0, 0, 633, 127, 412, 413, 0, 0, 0, 0, 0, 365, 366, 0, 0, 0, 367, 368, 128, 369, 129, 0, 0, 0, 370, 0, 371, 372, 373, 374, 0, 0, 0, 0, 375, 376, 377, 378, 482, 0, 409, 410, 411, 483, 164, 185, 207, 227, 239, 257, 271, 288, 484, 0, 485, 486, 487, 488, 489, 490, 491, 492, 493, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 511, 512, 513, 514, 515, 516, 0, 518, 519, 520, 521, 522, 523, 524, 165, 186, 208, 228, 240, 258, 272, 289, 166, 187, 209, 229, 241, 259, 273, 290, 167, 188, 210, 230, 242, 260, 274, 291, 168, 189, 211, 231, 243, 261, 275, 292, 169, 190, 212, 232, 244, 262, 276, 293, 170, 191, 213, 233, 245, 263, 277, 294 }; static const yytype_int16 yycheck[] = { 420, 343, 343, 143, 86, 395, 403, 404, 405, 449, 407, 408, 874, 875, 463, 412, 413, 120, 121, 416, 123, 343, 419, 430, 431, 1190, 433, 379, 348, 21, 22, 6, 24, 20, 251, 597, 727, 149, 22, 23, 430, 431, 6, 433, 22, 23, 339, 59, 778, 96, 80, 11, 6, 96, 1368, 504, 59, 418, 58, 456, 22, 23, 459, 460, 93, 0, 76, 93, 262, 466, 467, 468, 802, 470, 471, 495, 6, 16, 5, 80, 477, 478, 479, 150, 646, 482, 483, 649, 282, 96, 652, 16, 40, 140, 141, 147, 75, 494, 259, 78, 74, 498, 41, 31, 78, 502, 8, 930, 10, 37, 12, 13, 42, 474, 930, 17, 18, 80, 150, 49, 50, 51, 52, 96, 285, 214, 215, 80, 448, 31, 26, 27, 28, 3, 930, 60, 32, 33, 150, 35, 36, 94, 38, 39, 1474, 1475, 883, 150, 140, 141, 150, 99, 31, 55, 56, 74, 150, 980, 37, 78, 292, 63, 147, 65, 980, 43, 147, 140, 96, 97, 79, 96, 219, 75, 221, 150, 219, 309, 221, 22, 23, 141, 147, 177, 980, 140, 150, 197, 198, 91, 881, 93, 26, 27, 28, 150, 150, 309, 32, 33, 930, 35, 36, 1368, 38, 39, 76, 77, 140, 629, 630, 631, 219, 610, 221, 178, 179, 96, 3, 305, 150, 91, 150, 150, 291, 150, 623, 624, 98, 140, 141, 455, 219, 262, 221, 76, 262, 231, 590, 269, 270, 271, 272, 663, 664, 665, 666, 644, 472, 212, 980, 281, 227, 228, 229, 230, 231, 219, 1588, 221, 680, 343, 6, 227, 228, 229, 230, 231, 269, 270, 271, 272, 259, 693, 694, 695, 305, 96, 495, 305, 281, 701, 261, 179, 681, 260, 683, 262, 282, 709, 710, 76, 77, 43, 196, 147, 589, 259, 262, 96, 275, 231, 699, 700, 150, 657, 91, 282, 1622, 1623, 1624, 275, 43, 98, 216, 224, 225, 757, 310, 303, 222, 140, 141, 298, 19, 303, 280, 150, 281, 1066, 1067, 1068, 140, 141, 298, 260, 656, 1651, 193, 194, 195, 266, 231, 140, 141, 179, 3, 147, 768, 769, 770, 771, 772, 773, 282, 147, 197, 198, 778, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 262, 252, 253, 254, 255, 143, 144, 145, 146, 802, 803, 227, 228, 229, 230, 234, 235, 236, 43, 294, 263, 96, 815, 816, 267, 268, 147, 219, 821, 221, 823, 824, 825, 150, 827, 828, 96, 306, 234, 235, 236, 303, 304, 259, 260, 140, 76, 77, 841, 219, 930, 221, 845, 846, 847, 150, 308, 850, 851, 852, 147, 91, 92, 180, 181, 150, 183, 930, 98, 926, 100, 101, 865, 930, 16, 141, 869, 162, 591, 872, 873, 140, 298, 142, 1622, 1623, 1624, 141, 813, 31, 143, 144, 145, 146, 305, 37, 96, 1137, 150, 306, 980, 140, 140, 305, 917, 263, 76, 77, 150, 267, 268, 150, 150, 1651, 231, 57, 58, 980, 31, 96, 162, 91, 979, 980, 37, 6, 96, 141, 98, 252, 253, 254, 255, 926, 927, 928, 219, 930, 221, 256, 257, 83, 84, 85, 219, 262, 221, 89, 252, 253, 254, 255, 142, 946, 96, 97, 288, 150, 275, 219, 78, 221, 192, 140, 141, 1328, 196, 937, 306, 162, 150, 52, 1473, 1474, 1475, 968, 259, 990, 949, 73, 74, 211, 162, 213, 78, 78, 979, 980, 903, 64, 983, 66, 67, 68, 69, 70, 71, 72, 73, 74, 1363, 1364, 1365, 1473, 1474, 1475, 999, 140, 150, 142, 1003, 78, 150, 1006, 805, 1008, 96, 1010, 1011, 219, 1013, 221, 150, 1016, 162, 1018, 1019, 252, 253, 254, 255, 926, 9, 263, 162, 930, 1007, 140, 1009, 1279, 1280, 1034, 219, 756, 221, 1038, 16, 150, 78, 1042, 57, 58, 151, 306, 1294, 78, 1296, 1297, 1298, 1299, 140, 141, 1055, 151, 76, 150, 1306, 1307, 150, 150, 141, 150, 1043, 1044, 1045, 1046, 867, 162, 85, 1101, 162, 82, 89, 162, 979, 980, 305, 1588, 150, 96, 97, 172, 173, 263, 29, 30, 80, 267, 268, 180, 181, 814, 286, 184, 150, 186, 187, 188, 189, 190, 94, 224, 225, 1476, 1477, 61, 1551, 305, 1588, 200, 201, 86, 87, 88, 266, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 219, 282, 221, 140, 150, 141, 1508, 76, 77, 150, 140, 231, 141, 150, 252, 253, 254, 255, 140, 141, 151, 162, 91, 140, 151, 252, 253, 254, 255, 98, 960, 961, 962, 150, 785, 786, 926, 140, 789, 790, 930, 141, 262, 1617, 1618, 265, 1198, 1321, 1137, 234, 235, 236, 141, 686, 687, 275, 689, 690, 691, 290, 280, 141, 293, 150, 994, 995, 996, 997, 140, 1201, 1189, 822, 1182, 148, 1184, 180, 181, 297, 252, 253, 254, 255, 1012, 834, 1216, 836, 1218, 1189, 142, 979, 980, 1223, 306, 844, 1226, 1227, 219, 220, 221, 7, 303, 304, 1251, 1252, 1253, 283, 284, 858, 859, 1039, 1040, 1041, 863, 864, 1246, 1247, 1248, 1249, 291, 1049, 266, 252, 253, 254, 255, 252, 253, 254, 255, 1059, 1060, 147, 926, 224, 225, 226, 930, 989, 151, 42, 3, 44, 45, 46, 47, 48, 49, 234, 235, 236, 278, 279, 280, 904, 905, 906, 907, 140, 281, 25, 975, 234, 235, 236, 1094, 1095, 1096, 1097, 1098, 1099, 53, 54, 295, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 81, 151, 979, 980, 90, 50, 51, 1279, 1280, 150, 96, 263, 150, 99, 140, 267, 268, 951, 141, 953, 140, 141, 1294, 95, 1296, 1297, 1298, 1299, 140, 141, 76, 77, 95, 849, 1306, 1307, 305, 853, 984, 140, 141, 1278, 1278, 141, 1376, 91, 92, 140, 141, 1381, 150, 1383, 98, 1385, 100, 101, 252, 253, 254, 255, 14, 15, 1175, 141, 1177, 1380, 289, 1382, 289, 1384, 215, 1386, 163, 164, 165, 166, 167, 168, 169, 170, 171, 1194, 1195, 1017, 287, 231, 150, 1200, 297, 1202, 98, 177, 29, 30, 1207, 275, 1209, 1210, 1211, 185, 1213, 1214, 252, 253, 254, 255, 227, 228, 229, 230, 1056, 1224, 258, 1047, 1048, 233, 234, 235, 236, 237, 1412, 1234, 1235, 1236, 150, 1238, 1239, 1240, 72, 73, 74, 140, 141, 219, 78, 221, 59, 223, 259, 224, 225, 227, 1255, 232, 233, 1258, 192, 199, 1261, 1262, 196, 305, 99, 299, 300, 301, 302, 303, 304, 261, 1273, 1274, 1275, 42, 1277, 211, 261, 213, 42, 72, 73, 74, 177, 259, 260, 78, 150, 298, 264, 265, 99, 267, 143, 144, 145, 146, 272, 140, 274, 275, 276, 277, 878, 879, 880, 140, 282, 283, 284, 285, 1313, 1516, 233, 1518, 140, 1520, 1319, 1522, 78, 72, 73, 74, 141, 1326, 1327, 78, 140, 1330, 232, 233, 306, 232, 233, 141, 1337, 232, 233, 174, 1341, 141, 177, 1344, 231, 1346, 307, 1348, 1349, 1350, 232, 233, 1353, 1187, 140, 1356, 1357, 232, 233, 232, 233, 1362, 175, 176, 20, 1366, 3, 150, 622, 1203, 1371, 625, 626, 627, 628, 140, 141, 212, 307, 307, 307, 307, 307, 218, 307, 307, 640, 307, 1389, 224, 225, 307, 307, 93, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 307, 150, 307, 307, 1242, 307, 1244, 59, 299, 300, 301, 302, 303, 304, 307, 307, 1254, 307, 307, 677, 678, 679, 1260, 307, 682, 307, 684, 1265, 1266, 1267, 1268, 1269, 1270, 150, 140, 76, 77, 288, 141, 296, 82, 150, 150, 150, 702, 703, 704, 288, 150, 707, 91, 92, 5, 5, 150, 150, 14, 98, 16, 100, 101, 150, 224, 225, 150, 99, 99, 150, 26, 308, 231, 29, 30, 31, 1312, 33, 34, 1482, 150, 150, 85, 150, 150, 1488, 150, 1490, 3, 5, 150, 1494, 231, 1329, 1497, 1498, 1332, 140, 1334, 258, 141, 150, 140, 140, 1340, 140, 140, 140, 150, 1512, 1513, 1514, 1515, 141, 141, 3, 1352, 140, 59, 141, 141, 141, 233, 1359, 1360, 1361, 82, 151, 5, 5, 233, 787, 788, 150, 150, 150, 150, 150, 94, 95, 299, 300, 301, 302, 303, 304, 150, 5, 150, 150, 806, 150, 1388, 192, 1390, 150, 1392, 196, 151, 59, 151, 76, 77, 5, 5, 233, 5, 1403, 1404, 1405, 1406, 233, 211, 5, 213, 182, 91, 92, 233, 232, 151, 233, 182, 98, 840, 100, 101, 843, 76, 77, 5, 273, 1595, 5, 1597, 5, 1599, 5, 1601, 151, 5, 150, 150, 91, 92, 151, 151, 5, 5, 140, 98, 303, 100, 101, 150, 5, 5, 42, 5, 44, 45, 46, 47, 48, 49, 5, 5, 5, 140, 140, 150, 1467, 1468, 1636, 5, 1638, 150, 1640, 5, 1642, 182, 233, 182, 4, 1480, 5, 5, 5, 1484, 140, 1486, 1487, 5, 1489, 5, 1491, 1492, 1493, 5, 151, 1496, 150, 5, 1499, 1500, 90, 5, 5, 1504, 5, 5, 96, 140, 5, 99, 1511, 150, 192, 150, 150, 5, 196, 5, 5, 5, 3, 5, 140, 42, 1525, 44, 45, 46, 47, 48, 49, 211, 186, 213, 188, 189, 190, 191, 5, 192, 5, 5, 5, 196, 140, 5, 200, 5, 202, 203, 204, 205, 206, 207, 208, 209, 210, 5, 211, 140, 213, 72, 73, 74, 75, 76, 77, 78, 79, 1570, 5, 90, 233, 1574, 150, 1576, 5, 96, 5, 1580, 99, 1582, 1583, 5, 5, 5, 5, 177, 5, 1590, 1591, 1592, 1593, 76, 77, 185, 72, 73, 74, 75, 76, 77, 78, 79, 5, 5, 5, 5, 91, 92, 5, 265, 5, 5, 5, 98, 233, 100, 101, 42, 5, 44, 45, 46, 47, 48, 49, 5, 4, 219, 5, 221, 5, 223, 140, 299, 1637, 227, 1639, 141, 1641, 140, 1643, 297, 140, 150, 141, 62, 217, 5, 5, 1652, 150, 1654, 5, 1656, 5, 1658, 177, 5, 5, 5, 5, 5, 5, 150, 185, 90, 140, 259, 260, 140, 150, 96, 264, 265, 99, 267, 6, 150, 150, 99, 272, 140, 274, 275, 276, 277, 150, 150, 140, 150, 282, 283, 284, 285, 3, 150, 150, 150, 219, 150, 221, 150, 223, 233, 100, 5, 227, 192, 5, 5, 5, 196, 236, 151, 306, 150, 5, 151, 42, 151, 44, 45, 46, 47, 48, 49, 211, 5, 213, 5, 5, 5, 5, 151, 3, 151, 151, 151, 259, 260, 151, 151, 151, 264, 265, 5, 267, 59, 140, 5, 140, 272, 177, 274, 275, 276, 277, 140, 12, 344, 185, 282, 283, 284, 285, 102, 90, 76, 77, 545, 84, 507, 96, 75, 801, 99, 75, 800, 418, 1304, 1140, 639, 91, 92, 1149, 306, 638, 77, 1136, 98, 1294, 100, 101, 649, 219, 652, 221, 1, 223, 646, 597, 495, 227, 347, 420, 826, 1321, 76, 77, 72, 73, 74, 75, 76, 77, 78, 79, 445, 1470, 455, 158, -1, 91, 92, -1, -1, 692, -1, -1, 98, -1, 100, 101, -1, 259, 260, -1, -1, -1, 264, 265, -1, 267, -1, -1, -1, -1, 272, -1, 274, 275, 276, 277, 177, -1, -1, -1, 282, 283, 284, 285, 185, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, -1, -1, 150, -1, -1, 306, -1, 192, -1, -1, -1, 196, -1, -1, -1, -1, -1, -1, -1, 219, -1, 221, -1, 223, 172, 173, 211, 227, 213, -1, -1, -1, 180, 181, -1, -1, 184, -1, 186, 187, 188, 189, 190, -1, -1, -1, -1, 192, -1, -1, 150, 196, 200, 201, -1, -1, -1, -1, -1, 259, 260, -1, -1, -1, 264, 265, 211, 267, 213, -1, -1, -1, 272, -1, 274, 275, 276, 277, -1, -1, -1, -1, 282, 283, 284, 285, 186, -1, 188, 189, 190, 191, 72, 73, 74, 75, 76, 77, 78, 79, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, 210, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 238, 239, 240, 241, 242, 243, -1, 245, 246, 247, 248, 249, 250, 251, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of state STATE-NUM. */ static const yytype_int16 yystos[] = { 0, 7, 163, 164, 165, 166, 167, 168, 169, 170, 171, 312, 313, 314, 333, 334, 335, 337, 338, 339, 340, 343, 344, 345, 346, 347, 348, 349, 355, 366, 367, 372, 394, 395, 396, 397, 398, 399, 400, 401, 402, 8, 10, 12, 13, 17, 18, 31, 55, 56, 63, 65, 75, 91, 93, 196, 216, 222, 294, 483, 147, 147, 147, 147, 147, 147, 147, 147, 147, 0, 314, 315, 317, 319, 321, 323, 325, 327, 329, 331, 11, 141, 150, 140, 368, 369, 373, 19, 305, 141, 141, 305, 150, 141, 142, 305, 76, 197, 198, 214, 215, 288, 350, 351, 93, 262, 305, 487, 75, 78, 261, 78, 78, 78, 16, 78, 78, 16, 41, 3, 76, 77, 92, 98, 100, 101, 192, 196, 211, 213, 316, 403, 404, 405, 414, 417, 420, 463, 464, 465, 466, 479, 482, 483, 484, 490, 491, 492, 493, 495, 499, 551, 552, 553, 555, 556, 557, 3, 263, 318, 403, 404, 405, 463, 479, 482, 490, 491, 492, 493, 495, 520, 536, 545, 547, 549, 550, 551, 557, 3, 320, 403, 404, 405, 463, 479, 482, 490, 491, 492, 493, 495, 538, 539, 540, 541, 542, 543, 545, 551, 557, 3, 322, 403, 404, 405, 463, 479, 482, 490, 491, 492, 493, 495, 520, 545, 550, 551, 557, 3, 324, 403, 404, 405, 414, 417, 423, 479, 482, 490, 491, 492, 493, 495, 3, 326, 403, 404, 405, 479, 482, 490, 491, 492, 493, 495, 558, 559, 560, 561, 562, 3, 328, 403, 404, 405, 466, 479, 482, 490, 491, 492, 493, 495, 502, 554, 330, 403, 404, 405, 463, 479, 482, 490, 491, 492, 493, 495, 520, 545, 550, 551, 557, 3, 332, 403, 404, 405, 479, 482, 490, 491, 492, 493, 495, 498, 546, 9, 76, 336, 82, 370, 96, 369, 476, 14, 16, 26, 29, 30, 31, 33, 34, 82, 94, 95, 356, 374, 375, 376, 377, 378, 379, 382, 383, 384, 385, 386, 357, 341, 252, 253, 254, 255, 544, 143, 144, 145, 146, 488, 489, 141, 150, 352, 351, 286, 354, 305, 305, 42, 44, 45, 46, 47, 48, 49, 90, 96, 99, 177, 185, 219, 221, 223, 227, 259, 260, 264, 265, 267, 272, 274, 275, 276, 277, 282, 283, 284, 285, 485, 486, 61, 564, 141, 141, 140, 141, 140, 141, 141, 141, 140, 141, 140, 141, 406, 408, 140, 140, 6, 52, 150, 172, 173, 180, 181, 184, 186, 187, 188, 189, 190, 200, 201, 231, 262, 265, 275, 280, 297, 500, 501, 505, 509, 511, 512, 513, 514, 516, 517, 406, 406, 142, 406, 150, 291, 291, 193, 194, 195, 76, 197, 198, 148, 147, 496, 497, 262, 305, 487, 6, 227, 228, 229, 230, 231, 260, 262, 282, 298, 519, 548, 262, 282, 548, 6, 180, 181, 183, 231, 256, 257, 231, 6, 280, 6, 42, 49, 50, 51, 52, 231, 186, 191, 200, 202, 203, 204, 205, 206, 207, 208, 209, 210, 297, 503, 504, 506, 507, 508, 510, 513, 177, 231, 282, 140, 25, 150, 37, 224, 225, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 356, 361, 364, 365, 371, 410, 411, 150, 81, 413, 21, 22, 24, 140, 141, 310, 140, 141, 95, 95, 305, 141, 150, 141, 29, 30, 26, 27, 28, 32, 33, 35, 36, 38, 39, 179, 306, 358, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 306, 342, 289, 289, 306, 489, 215, 96, 308, 353, 356, 361, 364, 365, 354, 287, 488, 485, 306, 486, 150, 96, 219, 221, 407, 408, 409, 475, 80, 94, 219, 220, 221, 281, 295, 426, 428, 297, 98, 231, 299, 300, 301, 302, 303, 304, 521, 521, 521, 521, 180, 181, 521, 521, 521, 521, 283, 284, 275, 521, 150, 530, 531, 532, 281, 426, 428, 521, 501, 532, 199, 515, 96, 407, 473, 96, 407, 472, 96, 407, 474, 59, 497, 305, 485, 564, 22, 23, 259, 537, 259, 260, 298, 519, 537, 521, 303, 304, 481, 521, 521, 261, 481, 261, 521, 521, 521, 285, 258, 521, 258, 521, 269, 270, 271, 272, 269, 270, 271, 272, 42, 53, 54, 521, 521, 521, 50, 51, 42, 521, 521, 521, 504, 532, 521, 521, 177, 231, 262, 481, 150, 370, 99, 140, 142, 140, 140, 233, 140, 141, 141, 141, 307, 387, 140, 357, 20, 393, 380, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 150, 150, 494, 306, 306, 487, 59, 150, 140, 150, 140, 150, 409, 475, 140, 141, 140, 150, 140, 150, 140, 150, 288, 296, 82, 427, 421, 521, 150, 150, 150, 150, 162, 518, 518, 521, 521, 518, 518, 518, 518, 532, 532, 532, 150, 59, 150, 5, 288, 427, 421, 150, 518, 5, 521, 150, 473, 150, 472, 150, 474, 485, 306, 150, 99, 532, 532, 532, 532, 99, 150, 140, 141, 150, 150, 140, 141, 140, 141, 140, 141, 150, 518, 150, 518, 150, 518, 532, 521, 150, 518, 521, 518, 424, 424, 424, 85, 563, 424, 424, 424, 563, 532, 532, 532, 150, 150, 150, 521, 521, 532, 518, 518, 150, 518, 5, 518, 150, 532, 532, 231, 140, 22, 23, 303, 362, 388, 389, 390, 140, 140, 391, 392, 393, 306, 20, 219, 221, 259, 381, 141, 141, 141, 140, 141, 14, 15, 29, 30, 141, 141, 363, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 233, 149, 309, 487, 564, 233, 532, 532, 532, 532, 532, 532, 418, 140, 141, 150, 415, 57, 58, 85, 89, 96, 97, 266, 422, 430, 434, 435, 467, 477, 478, 532, 150, 59, 544, 544, 150, 518, 150, 518, 151, 544, 151, 544, 151, 151, 5, 5, 5, 233, 234, 235, 236, 237, 522, 59, 76, 77, 91, 98, 263, 267, 268, 527, 528, 418, 415, 532, 532, 151, 528, 518, 233, 233, 233, 306, 487, 532, 58, 532, 5, 5, 5, 5, 532, 544, 532, 532, 532, 522, 532, 532, 182, 544, 182, 544, 232, 233, 5, 150, 518, 532, 151, 518, 151, 544, 16, 60, 96, 260, 425, 467, 468, 469, 470, 471, 532, 532, 532, 273, 424, 532, 532, 532, 424, 5, 5, 5, 151, 43, 544, 43, 544, 150, 150, 5, 151, 544, 151, 544, 532, 151, 528, 151, 532, 5, 5, 532, 532, 362, 362, 140, 391, 391, 391, 393, 392, 140, 150, 140, 150, 150, 364, 544, 544, 544, 544, 232, 233, 232, 233, 232, 233, 232, 233, 232, 233, 232, 233, 564, 5, 5, 5, 5, 5, 5, 37, 282, 356, 359, 361, 419, 477, 478, 480, 532, 532, 532, 16, 83, 84, 356, 359, 361, 416, 429, 430, 433, 434, 435, 467, 477, 478, 480, 532, 140, 140, 86, 87, 88, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 150, 150, 521, 5, 532, 5, 233, 524, 524, 182, 544, 182, 544, 528, 528, 528, 532, 406, 4, 534, 532, 532, 5, 5, 532, 534, 487, 564, 5, 140, 5, 528, 528, 528, 528, 5, 532, 5, 5, 5, 532, 5, 5, 532, 524, 532, 524, 532, 532, 528, 532, 151, 5, 532, 151, 544, 532, 532, 140, 150, 150, 150, 5, 5, 5, 532, 5, 5, 5, 532, 528, 528, 528, 532, 524, 524, 524, 524, 43, 544, 43, 544, 528, 5, 532, 534, 5, 528, 528, 5, 5, 140, 140, 528, 528, 528, 528, 528, 528, 40, 481, 5, 5, 5, 140, 5, 431, 450, 450, 78, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 410, 411, 461, 462, 438, 438, 442, 442, 80, 178, 179, 212, 436, 437, 440, 444, 448, 459, 233, 150, 528, 5, 96, 528, 524, 524, 534, 5, 96, 407, 525, 3, 527, 529, 5, 5, 528, 528, 5, 564, 528, 532, 528, 534, 528, 5, 528, 528, 528, 5, 528, 528, 5, 532, 5, 532, 5, 5, 5, 532, 528, 5, 532, 532, 5, 5, 233, 528, 528, 528, 5, 528, 528, 528, 5, 534, 4, 535, 534, 5, 532, 532, 532, 532, 150, 234, 235, 236, 523, 150, 523, 150, 523, 150, 523, 534, 528, 5, 528, 534, 528, 528, 534, 534, 534, 534, 534, 534, 299, 360, 140, 528, 528, 528, 528, 364, 365, 432, 99, 174, 177, 212, 218, 308, 410, 411, 451, 452, 453, 454, 455, 456, 141, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 462, 410, 411, 439, 79, 410, 411, 443, 140, 140, 150, 141, 437, 410, 411, 441, 226, 410, 411, 412, 445, 290, 293, 446, 447, 449, 217, 458, 460, 232, 233, 534, 528, 528, 150, 525, 62, 526, 278, 279, 280, 528, 528, 535, 534, 528, 534, 5, 534, 528, 534, 528, 528, 5, 528, 5, 528, 528, 528, 5, 534, 528, 5, 5, 528, 528, 534, 534, 534, 528, 535, 535, 535, 528, 3, 529, 528, 5, 5, 5, 5, 523, 532, 523, 532, 523, 532, 523, 532, 534, 528, 534, 534, 150, 534, 534, 534, 534, 140, 175, 176, 521, 140, 141, 140, 457, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 99, 140, 140, 142, 150, 140, 534, 534, 233, 526, 100, 530, 531, 533, 533, 533, 535, 535, 534, 528, 534, 534, 534, 528, 534, 528, 534, 534, 534, 528, 534, 528, 528, 534, 534, 534, 535, 6, 534, 528, 528, 528, 528, 532, 5, 532, 5, 532, 5, 532, 5, 534, 236, 150, 292, 309, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 22, 23, 362, 59, 150, 5, 5, 5, 534, 534, 534, 534, 534, 534, 533, 534, 534, 534, 534, 5, 528, 5, 528, 5, 528, 5, 528, 362, 362, 140, 59, 529, 529, 529, 5, 528, 534, 528, 534, 528, 534, 528, 534, 140, 140, 529, 534, 534, 534, 534 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int16 yyr1[] = { 0, 311, 312, 312, 313, 313, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 315, 315, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 319, 319, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 321, 321, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 323, 323, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 325, 325, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 327, 327, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 329, 329, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 331, 331, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 333, 333, 333, 334, 335, 336, 336, 337, 338, 338, 338, 339, 340, 341, 341, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 343, 344, 344, 344, 345, 345, 345, 346, 347, 348, 349, 350, 350, 351, 352, 352, 353, 353, 353, 353, 353, 353, 354, 354, 355, 356, 356, 357, 357, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 359, 360, 360, 361, 361, 361, 362, 362, 363, 363, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 365, 366, 367, 368, 368, 369, 369, 370, 370, 371, 371, 371, 371, 371, 371, 372, 373, 373, 374, 374, 374, 374, 374, 374, 374, 374, 374, 375, 376, 377, 378, 379, 380, 380, 381, 381, 381, 381, 381, 381, 382, 382, 383, 383, 384, 384, 385, 386, 386, 386, 386, 386, 386, 387, 386, 388, 386, 389, 386, 390, 386, 386, 391, 391, 392, 393, 393, 394, 394, 394, 394, 395, 396, 396, 397, 398, 399, 399, 400, 401, 402, 402, 403, 403, 404, 404, 405, 405, 406, 406, 407, 407, 408, 408, 409, 409, 409, 409, 410, 410, 411, 412, 413, 413, 414, 414, 415, 415, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 417, 417, 418, 418, 419, 419, 419, 419, 419, 419, 420, 420, 421, 421, 422, 422, 422, 422, 422, 422, 423, 423, 423, 423, 423, 423, 423, 423, 424, 424, 425, 425, 425, 425, 425, 426, 426, 427, 428, 429, 429, 430, 430, 430, 431, 431, 432, 432, 433, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 435, 435, 436, 436, 437, 437, 437, 437, 438, 438, 439, 439, 440, 440, 441, 441, 442, 442, 443, 443, 443, 443, 443, 444, 444, 445, 445, 445, 446, 446, 447, 448, 448, 449, 449, 450, 450, 451, 451, 451, 451, 451, 451, 451, 451, 452, 453, 453, 454, 454, 455, 456, 457, 457, 458, 459, 459, 460, 461, 461, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 463, 463, 464, 465, 466, 467, 467, 468, 469, 470, 471, 472, 472, 473, 473, 474, 474, 475, 475, 476, 476, 477, 478, 479, 479, 480, 481, 481, 482, 482, 482, 482, 483, 484, 485, 485, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 487, 487, 488, 488, 489, 489, 489, 489, 490, 490, 490, 491, 491, 491, 492, 492, 492, 493, 494, 494, 495, 496, 496, 497, 498, 498, 499, 500, 500, 501, 501, 501, 501, 501, 501, 501, 502, 503, 503, 504, 504, 504, 504, 505, 505, 506, 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, 508, 508, 509, 509, 509, 509, 510, 510, 511, 512, 513, 514, 514, 514, 515, 515, 516, 516, 516, 517, 517, 517, 518, 518, 519, 519, 519, 519, 520, 520, 521, 521, 521, 521, 521, 521, 521, 521, 522, 522, 522, 522, 522, 522, 523, 523, 523, 524, 524, 525, 525, 526, 526, 526, 527, 527, 527, 527, 527, 527, 527, 527, 528, 529, 530, 531, 532, 532, 532, 533, 533, 533, 534, 534, 534, 534, 534, 535, 535, 535, 536, 536, 536, 537, 537, 537, 538, 538, 538, 538, 539, 539, 539, 539, 540, 540, 541, 541, 542, 542, 543, 544, 544, 544, 544, 544, 545, 545, 546, 546, 546, 547, 547, 547, 547, 547, 547, 547, 547, 548, 548, 549, 549, 550, 550, 551, 551, 552, 552, 553, 553, 554, 554, 555, 555, 556, 557, 557, 558, 558, 558, 559, 560, 561, 561, 561, 561, 561, 561, 562, 562, 562, 562, 562, 562, 563, 564, 564, 564 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const yytype_int8 yyr2[] = { 0, 2, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 7, 8, 4, 3, 0, 3, 2, 3, 3, 3, 4, 5, 0, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 3, 3, 5, 4, 6, 4, 3, 3, 3, 3, 2, 3, 2, 0, 2, 3, 1, 1, 1, 1, 3, 0, 2, 5, 1, 4, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 0, 1, 4, 5, 5, 0, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 5, 1, 2, 2, 4, 0, 2, 1, 1, 1, 1, 1, 1, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 3, 0, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 5, 4, 2, 3, 3, 3, 0, 4, 0, 5, 0, 5, 0, 5, 2, 1, 2, 1, 0, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 5, 6, 3, 4, 3, 4, 3, 4, 1, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 9, 9, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 0, 2, 1, 1, 1, 1, 1, 1, 8, 8, 0, 2, 1, 1, 1, 1, 1, 1, 9, 8, 8, 8, 9, 8, 8, 8, 0, 2, 1, 1, 1, 1, 1, 0, 2, 2, 2, 1, 1, 2, 3, 2, 0, 2, 1, 1, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 4, 5, 5, 0, 2, 1, 1, 1, 2, 2, 2, 0, 2, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 1, 1, 2, 1, 1, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 6, 6, 6, 9, 4, 4, 2, 2, 3, 2, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 3, 2, 7, 7, 3, 1, 1, 3, 6, 7, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 4, 1, 2, 2, 2, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 1, 2, 1, 8, 6, 6, 1, 2, 1, 1, 1, 1, 1, 1, 1, 6, 1, 2, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 1, 1, 1, 0, 1, 5, 6, 5, 5, 6, 5, 1, 1, 1, 1, 1, 1, 9, 6, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 3, 0, 3, 4, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 2, 3, 0, 1, 1, 0, 1, 1, 0, 2, 6, 6, 6, 0, 2, 6, 8, 10, 7, 0, 1, 1, 8, 9, 9, 10, 9, 9, 10, 10, 10, 9, 10, 9, 9, 9, 6, 0, 1, 1, 1, 1, 8, 7, 7, 7, 8, 7, 7, 4, 4, 7, 7, 4, 4, 0, 1, 9, 6, 8, 6, 8, 8, 8, 8, 9, 9, 8, 9, 8, 9, 9, 8, 8, 7, 7, 7, 7, 9, 10, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12, 2, 0, 2, 3 }; enum { YYENOMEM = -2 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Backward compatibility with an undocumented macro. Use YYerror or YYUNDEF. */ #define YYERRCODE YYUNDEF /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Kind, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ static void yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { FILE *yyoutput = yyo; YY_USE (yyoutput); if (!yyvaluep) return; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ static void yy_symbol_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); yy_symbol_value_print (yyo, yykind, yyvaluep); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), &yyvsp[(yyi + 1) - (yynrhs)]); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) ((void) 0) # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { YY_USE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* Lookahead token kind. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus = 0; /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* Their size. */ YYPTRDIFF_T yystacksize = YYINITDEPTH; /* The state stack: array, bottom, top. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss = yyssa; yy_state_t *yyssp = yyss; /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp = yyvs; int yyn; /* The return value of yyparse. */ int yyresult; /* Lookahead symbol kind. */ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yy_state_t *yyss1 = yyss; union yyalloc *yyptr = YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YY_IGNORE_USELESS_CAST_BEGIN YYDPRINTF ((stderr, "Stack size increased to %ld\n", YY_CAST (long, yystacksize))); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = YYEOF; yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else if (yychar == YYerror) { /* The scanner already issued an error message, process directly to error recovery. But do not keep the error token as lookahead, it is too special and may lead us to an endless loop in error recovery. */ yychar = YYUNDEF; yytoken = YYSYMBOL_YYerror; goto yyerrlab1; } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Discard the shifted token. */ yychar = YYEMPTY; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 199: /* setalert: SET alertmail formatlist reminder */ #line 636 "src/p.y" { mailset.events = Event_All; addmail((yyvsp[-2].string), &mailset, &Run.maillist); } #line 3266 "src/y.tab.c" break; case 200: /* setalert: SET alertmail '{' eventoptionlist '}' formatlist reminder */ #line 640 "src/p.y" { addmail((yyvsp[-5].string), &mailset, &Run.maillist); } #line 3274 "src/y.tab.c" break; case 201: /* setalert: SET alertmail NOT '{' eventoptionlist '}' formatlist reminder */ #line 643 "src/p.y" { mailset.events = ~mailset.events; addmail((yyvsp[-6].string), &mailset, &Run.maillist); } #line 3283 "src/y.tab.c" break; case 202: /* setdaemon: SET DAEMON NUMBER startdelay */ #line 649 "src/p.y" { if (! (Run.flags & Run_Daemon) || ihp.daemon) { int one_year = 31556952; ihp.daemon = true; Run.flags |= Run_Daemon; if (((yyvsp[-1].number) <= 0) || ((yyvsp[-1].number) > one_year)) { yyerror2("Invalid Poll time seconds."); } Run.polltime = (yyvsp[-1].number); Run.startdelay = (yyvsp[0].number); } } #line 3300 "src/y.tab.c" break; case 203: /* setterminal: SET TERMINAL BATCH */ #line 663 "src/p.y" { Run.flags |= Run_Batch; } #line 3308 "src/y.tab.c" break; case 204: /* startdelay: %empty */ #line 668 "src/p.y" { (yyval.number) = 0; } #line 3316 "src/y.tab.c" break; case 205: /* startdelay: START DELAY NUMBER */ #line 671 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 3324 "src/y.tab.c" break; case 206: /* setinit: SET INIT */ #line 676 "src/p.y" { Run.flags |= Run_Foreground; } #line 3332 "src/y.tab.c" break; case 207: /* setonreboot: SET ONREBOOT START */ #line 681 "src/p.y" { Run.onreboot = Onreboot_Start; } #line 3340 "src/y.tab.c" break; case 208: /* setonreboot: SET ONREBOOT NOSTART */ #line 684 "src/p.y" { Run.onreboot = Onreboot_Nostart; } #line 3348 "src/y.tab.c" break; case 209: /* setonreboot: SET ONREBOOT LASTSTATE */ #line 687 "src/p.y" { Run.onreboot = Onreboot_Laststate; } #line 3356 "src/y.tab.c" break; case 210: /* setexpectbuffer: SET EXPECTBUFFER NUMBER unit */ #line 692 "src/p.y" { // Note: deprecated (replaced by "set limits" statement's "sendExpectBuffer" option) Run.limits.sendExpectBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } #line 3365 "src/y.tab.c" break; case 214: /* limit: SENDEXPECTBUFFER ':' NUMBER unit */ #line 705 "src/p.y" { if ((yyvsp[-1].number) <= 0) { yyerror2("The sendExpectBuffer value must be > 0"); } else { long long value = (yyvsp[-1].number) * (yyvsp[0].number64); if (value > INT_MAX) yyerror2("The sendExpectBuffer value must be <= %d", INT_MAX); else Run.limits.sendExpectBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } } #line 3381 "src/y.tab.c" break; case 215: /* limit: FILECONTENTBUFFER ':' NUMBER unit */ #line 716 "src/p.y" { if ((yyvsp[-1].number) <= 0) { yyerror2("The fileContentBuffer value must be > 0"); } else { Run.limits.fileContentBuffer = (yyvsp[-1].number) * (yyvsp[0].number64); } } #line 3393 "src/y.tab.c" break; case 216: /* limit: HTTPCONTENTBUFFER ':' NUMBER unit */ #line 723 "src/p.y" { if ((yyvsp[-1].number) <= 0) { yyerror2("The httpContentBuffer value must be > 0"); } else { long long value = (yyvsp[-1].number) * (yyvsp[0].number64); if (value > INT_MAX) yyerror2("The httpContentBuffer value must be <= %d", INT_MAX); else Run.limits.httpContentBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } } #line 3409 "src/y.tab.c" break; case 217: /* limit: PROGRAMOUTPUT ':' NUMBER unit */ #line 734 "src/p.y" { if ((yyvsp[-1].number) <= 0) { yyerror2("The programOutput value must be > 0"); } else { long long value = (yyvsp[-1].number) * (yyvsp[0].number64); if (value > INT_MAX) yyerror2("The programOutput value must be <= %d", INT_MAX); else Run.limits.programOutput = (yyvsp[-1].number) * (yyvsp[0].number); } } #line 3425 "src/y.tab.c" break; case 218: /* limit: NETWORKTIMEOUT ':' NUMBER MILLISECOND */ #line 745 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The networkTimeout value must be > 0"); else Run.limits.networkTimeout = (yyvsp[-1].number); } #line 3436 "src/y.tab.c" break; case 219: /* limit: NETWORKTIMEOUT ':' NUMBER SECOND */ #line 751 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The networkTimeout value must be > 0"); else Run.limits.networkTimeout = (yyvsp[-1].number) * 1000; } #line 3447 "src/y.tab.c" break; case 220: /* limit: PROGRAMTIMEOUT ':' NUMBER MILLISECOND */ #line 757 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The programTimeout value must be > 0"); else Run.limits.programTimeout = (yyvsp[-1].number); } #line 3458 "src/y.tab.c" break; case 221: /* limit: PROGRAMTIMEOUT ':' NUMBER SECOND */ #line 763 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The programTimeout value must be > 0"); else Run.limits.programTimeout = (yyvsp[-1].number) * 1000; } #line 3469 "src/y.tab.c" break; case 222: /* limit: STOPTIMEOUT ':' NUMBER MILLISECOND */ #line 769 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The stopTimeout value must be > 0"); else Run.limits.stopTimeout = (yyvsp[-1].number); } #line 3480 "src/y.tab.c" break; case 223: /* limit: STOPTIMEOUT ':' NUMBER SECOND */ #line 775 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The stopTimeout value must be > 0"); else Run.limits.stopTimeout = (yyvsp[-1].number) * 1000; } #line 3491 "src/y.tab.c" break; case 224: /* limit: STARTTIMEOUT ':' NUMBER MILLISECOND */ #line 781 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The startTimeout value must be > 0"); else Run.limits.startTimeout = (yyvsp[-1].number); } #line 3502 "src/y.tab.c" break; case 225: /* limit: STARTTIMEOUT ':' NUMBER SECOND */ #line 787 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The startTimeout value must be > 0"); else Run.limits.startTimeout = (yyvsp[-1].number) * 1000; } #line 3513 "src/y.tab.c" break; case 226: /* limit: RESTARTTIMEOUT ':' NUMBER MILLISECOND */ #line 793 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The restartTimeout value must be > 0"); else Run.limits.restartTimeout = (yyvsp[-1].number); } #line 3524 "src/y.tab.c" break; case 227: /* limit: RESTARTTIMEOUT ':' NUMBER SECOND */ #line 799 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The restartTimeout value must be > 0"); else Run.limits.restartTimeout = (yyvsp[-1].number) * 1000; } #line 3535 "src/y.tab.c" break; case 228: /* limit: EXECTIMEOUT ':' NUMBER MILLISECOND */ #line 805 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The execTimeout value must be > 0"); else Run.limits.execTimeout = (yyvsp[-1].number); } #line 3546 "src/y.tab.c" break; case 229: /* limit: EXECTIMEOUT ':' NUMBER SECOND */ #line 811 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The execTimeout value must be > 0"); else Run.limits.execTimeout = (yyvsp[-1].number) * 1000; } #line 3557 "src/y.tab.c" break; case 230: /* setfips: SET FIPS */ #line 819 "src/p.y" { Run.flags |= Run_FipsEnabled; } #line 3565 "src/y.tab.c" break; case 231: /* setlog: SET LOGFILE PATH */ #line 824 "src/p.y" { if (! Run.files.log || ihp.logfile) { ihp.logfile = true; setlogfile((yyvsp[0].string)); Run.flags &= ~Run_UseSyslog; Run.flags |= Run_Log; } else { FREE((yyvsp[0].string)); } } #line 3580 "src/y.tab.c" break; case 232: /* setlog: SET LOGFILE SYSLOG */ #line 834 "src/p.y" { setsyslog(NULL); } #line 3588 "src/y.tab.c" break; case 233: /* setlog: SET LOGFILE SYSLOG FACILITY STRING */ #line 837 "src/p.y" { setsyslog((yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 3596 "src/y.tab.c" break; case 234: /* seteventqueue: SET EVENTQUEUE BASEDIR PATH */ #line 842 "src/p.y" { Run.eventlist_dir = (yyvsp[0].string); } #line 3604 "src/y.tab.c" break; case 235: /* seteventqueue: SET EVENTQUEUE BASEDIR PATH SLOT NUMBER */ #line 845 "src/p.y" { Run.eventlist_dir = (yyvsp[-2].string); Run.eventlist_slots = (yyvsp[0].number); } #line 3613 "src/y.tab.c" break; case 236: /* seteventqueue: SET EVENTQUEUE SLOT NUMBER */ #line 849 "src/p.y" { Run.eventlist_dir = Str_dup(MYEVENTLISTBASE); Run.eventlist_slots = (yyvsp[0].number); } #line 3622 "src/y.tab.c" break; case 237: /* setidfile: SET IDFILE PATH */ #line 855 "src/p.y" { if (! Run.files.id || ihp.idfile) { ihp.idfile = true; setidfile((yyvsp[0].string)); } else { FREE((yyvsp[0].string)); } } #line 3635 "src/y.tab.c" break; case 238: /* setstatefile: SET STATEFILE PATH */ #line 865 "src/p.y" { if (! Run.files.state || ihp.statefile) { ihp.statefile = true; setstatefile((yyvsp[0].string)); } else { FREE((yyvsp[0].string)); } } #line 3648 "src/y.tab.c" break; case 239: /* setpid: SET PIDFILE PATH */ #line 875 "src/p.y" { if (! Run.files.pid || ihp.pidfile) { ihp.pidfile = true; setpidfile((yyvsp[0].string)); } else { FREE((yyvsp[0].string)); } } #line 3661 "src/y.tab.c" break; case 243: /* mmonit: URLOBJECT mmonitoptlist */ #line 892 "src/p.y" { mmonitset.url = (yyvsp[-1].url); addmmonit(&mmonitset); } #line 3670 "src/y.tab.c" break; case 246: /* mmonitopt: TIMEOUT NUMBER SECOND */ #line 902 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else mmonitset.timeout = (yyvsp[-1].number) * 1000; // net timeout is in milliseconds internally } #line 3681 "src/y.tab.c" break; case 253: /* credentials: REGISTER CREDENTIALS */ #line 916 "src/p.y" { Run.flags &= ~Run_MmonitCredentials; } #line 3689 "src/y.tab.c" break; case 254: /* setssl: SET SSLTOKEN '{' ssloptionlist '}' */ #line 921 "src/p.y" { _setSSLOptions(&(Run.ssl)); } #line 3697 "src/y.tab.c" break; case 255: /* ssl: SSLTOKEN */ #line 926 "src/p.y" { sslset.flags = SSL_Enabled; } #line 3705 "src/y.tab.c" break; case 259: /* ssloption: VERIFY ':' ENABLE */ #line 936 "src/p.y" { sslset.flags = SSL_Enabled; sslset.verify = true; } #line 3714 "src/y.tab.c" break; case 260: /* ssloption: VERIFY ':' DISABLE */ #line 940 "src/p.y" { sslset.flags = SSL_Enabled; sslset.verify = false; } #line 3723 "src/y.tab.c" break; case 261: /* ssloption: SELFSIGNED ':' ALLOW */ #line 944 "src/p.y" { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = true; } #line 3732 "src/y.tab.c" break; case 262: /* ssloption: SELFSIGNED ':' REJECTOPT */ #line 948 "src/p.y" { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = false; } #line 3741 "src/y.tab.c" break; case 263: /* ssloption: VERSIONOPT ':' sslversionlist */ #line 952 "src/p.y" { sslset.flags = SSL_Enabled; } #line 3749 "src/y.tab.c" break; case 264: /* ssloption: CIPHER ':' STRING */ #line 955 "src/p.y" { FREE(sslset.ciphers); sslset.ciphers = (yyvsp[0].string); } #line 3758 "src/y.tab.c" break; case 265: /* ssloption: PEMFILE ':' PATH */ #line 959 "src/p.y" { _setPEM(&(sslset.pemfile), (yyvsp[0].string), "SSL server PEM file", true); } #line 3766 "src/y.tab.c" break; case 266: /* ssloption: PEMCHAIN ':' PATH */ #line 962 "src/p.y" { _setPEM(&(sslset.pemchain), (yyvsp[0].string), "SSL certificate chain PEM file", true); } #line 3774 "src/y.tab.c" break; case 267: /* ssloption: PEMKEY ':' PATH */ #line 965 "src/p.y" { _setPEM(&(sslset.pemkey), (yyvsp[0].string), "SSL server private key PEM file", true); } #line 3782 "src/y.tab.c" break; case 268: /* ssloption: CLIENTPEMFILE ':' PATH */ #line 968 "src/p.y" { _setPEM(&(sslset.clientpemfile), (yyvsp[0].string), "SSL client PEM file", true); } #line 3790 "src/y.tab.c" break; case 269: /* ssloption: CACERTIFICATEFILE ':' PATH */ #line 971 "src/p.y" { _setPEM(&(sslset.CACertificateFile), (yyvsp[0].string), "SSL CA certificates file", true); } #line 3798 "src/y.tab.c" break; case 270: /* ssloption: CACERTIFICATEPATH ':' PATH */ #line 974 "src/p.y" { _setPEM(&(sslset.CACertificatePath), (yyvsp[0].string), "SSL CA certificates directory", false); } #line 3806 "src/y.tab.c" break; case 271: /* sslexpire: CERTIFICATE VALID expireoperator NUMBER DAY */ #line 979 "src/p.y" { sslset.flags = SSL_Enabled; portset.target.net.ssl.certificate.minimumDays = (yyvsp[-1].number); } #line 3815 "src/y.tab.c" break; case 274: /* sslchecksum: CERTIFICATE CHECKSUM checksumoperator STRING */ #line 989 "src/p.y" { sslset.flags = SSL_Enabled; sslset.checksum = (yyvsp[0].string); switch (cleanup_hash_string(sslset.checksum)) { case 32: sslset.checksumType = Hash_Md5; break; case 40: sslset.checksumType = Hash_Sha1; break; default: yyerror2("Unknown checksum type: [%s] is not MD5 nor SHA1", sslset.checksum); } } #line 3834 "src/y.tab.c" break; case 275: /* sslchecksum: CERTIFICATE CHECKSUM MD5HASH checksumoperator STRING */ #line 1003 "src/p.y" { sslset.flags = SSL_Enabled; sslset.checksum = (yyvsp[0].string); if (cleanup_hash_string(sslset.checksum) != 32) yyerror2("Unknown checksum type: [%s] is not MD5", sslset.checksum); sslset.checksumType = Hash_Md5; } #line 3846 "src/y.tab.c" break; case 276: /* sslchecksum: CERTIFICATE CHECKSUM SHA1HASH checksumoperator STRING */ #line 1010 "src/p.y" { sslset.flags = SSL_Enabled; sslset.checksum = (yyvsp[0].string); if (cleanup_hash_string(sslset.checksum) != 40) yyerror2("Unknown checksum type: [%s] is not SHA1", sslset.checksum); sslset.checksumType = Hash_Sha1; } #line 3858 "src/y.tab.c" break; case 281: /* sslversion: SSLV2 */ #line 1027 "src/p.y" { #if defined OPENSSL_NO_SSL2 || ! defined HAVE_SSLV2 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support SSL version 2"); #else _setSSLVersion(SSL_V2); #endif } #line 3870 "src/y.tab.c" break; case 282: /* sslversion: NOSSLV2 */ #line 1034 "src/p.y" { _unsetSSLVersion(SSL_V2); } #line 3878 "src/y.tab.c" break; case 283: /* sslversion: SSLV3 */ #line 1037 "src/p.y" { #if defined OPENSSL_NO_SSL3 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support SSL version 3"); #else _setSSLVersion(SSL_V3); #endif } #line 3890 "src/y.tab.c" break; case 284: /* sslversion: NOSSLV3 */ #line 1044 "src/p.y" { _unsetSSLVersion(SSL_V3); } #line 3898 "src/y.tab.c" break; case 285: /* sslversion: TLSV1 */ #line 1047 "src/p.y" { #if defined OPENSSL_NO_TLS1_METHOD || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.0"); #else _setSSLVersion(SSL_TLSV1); #endif } #line 3910 "src/y.tab.c" break; case 286: /* sslversion: NOTLSV1 */ #line 1054 "src/p.y" { _unsetSSLVersion(SSL_TLSV1); } #line 3918 "src/y.tab.c" break; case 287: /* sslversion: TLSV11 */ #line 1057 "src/p.y" { #if defined OPENSSL_NO_TLS1_1_METHOD || ! defined HAVE_TLSV1_1 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.1"); #else _setSSLVersion(SSL_TLSV11); #endif } #line 3930 "src/y.tab.c" break; case 288: /* sslversion: NOTLSV11 */ #line 1064 "src/p.y" { _unsetSSLVersion(SSL_TLSV11); } #line 3938 "src/y.tab.c" break; case 289: /* sslversion: TLSV12 */ #line 1067 "src/p.y" { #if defined OPENSSL_NO_TLS1_2_METHOD || ! defined HAVE_TLSV1_2 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.2"); #else _setSSLVersion(SSL_TLSV12); #endif } #line 3950 "src/y.tab.c" break; case 290: /* sslversion: NOTLSV12 */ #line 1074 "src/p.y" { _unsetSSLVersion(SSL_TLSV12); } #line 3958 "src/y.tab.c" break; case 291: /* sslversion: TLSV13 */ #line 1077 "src/p.y" { #if defined OPENSSL_NO_TLS1_3_METHOD || ! defined HAVE_TLSV1_3 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.3"); #else _setSSLVersion(SSL_TLSV13); #endif } #line 3970 "src/y.tab.c" break; case 292: /* sslversion: NOTLSV13 */ #line 1084 "src/p.y" { _unsetSSLVersion(SSL_TLSV13); } #line 3978 "src/y.tab.c" break; case 293: /* sslversion: AUTO */ #line 1087 "src/p.y" { // Enable just TLS 1.2 and 1.3 by default #if ! defined OPENSSL_NO_TLS1_2_METHOD && defined HAVE_TLSV1_2 && defined HAVE_OPENSSL _setSSLVersion(SSL_TLSV12); #endif #if ! defined OPENSSL_NO_TLS1_3_METHOD && defined HAVE_TLSV1_3 && defined HAVE_OPENSSL _setSSLVersion(SSL_TLSV13); #endif } #line 3992 "src/y.tab.c" break; case 294: /* certmd5: CERTMD5 STRING */ #line 1098 "src/p.y" { // Backward compatibility sslset.flags = SSL_Enabled; sslset.checksum = (yyvsp[0].string); if (cleanup_hash_string(sslset.checksum) != 32) yyerror2("Unknown checksum type: [%s] is not MD5", sslset.checksum); sslset.checksumType = Hash_Md5; } #line 4004 "src/y.tab.c" break; case 295: /* setmailservers: SET MAILSERVER mailserverlist nettimeout hostname */ #line 1107 "src/p.y" { Run.mailserver_timeout = (yyvsp[-1].number); Run.mail_hostname = (yyvsp[0].string); } #line 4013 "src/y.tab.c" break; case 296: /* setmailformat: SET MAILFORMAT '{' formatoptionlist '}' */ #line 1113 "src/p.y" { if (mailset.from) { Run.MailFormat.from = mailset.from; } else { Run.MailFormat.from = Address_new(); Run.MailFormat.from->address = Str_dup(ALERT_FROM); } if (mailset.replyto) Run.MailFormat.replyto = mailset.replyto; Run.MailFormat.subject = mailset.subject ? mailset.subject : Str_dup(ALERT_SUBJECT); Run.MailFormat.message = mailset.message ? mailset.message : Str_dup(ALERT_MESSAGE); reset_mailset(); } #line 4031 "src/y.tab.c" break; case 299: /* mailserver: STRING mailserveroptlist */ #line 1132 "src/p.y" { /* Restore the current text overridden by lookahead */ FREE(argyytext); argyytext = Str_dup((yyvsp[-1].string)); mailserverset.host = (yyvsp[-1].string); mailserverset.port = PORT_SMTP; addmailserver(&mailserverset); } #line 4045 "src/y.tab.c" break; case 300: /* mailserver: STRING PORT NUMBER mailserveroptlist */ #line 1141 "src/p.y" { /* Restore the current text overridden by lookahead */ FREE(argyytext); argyytext = Str_dup((yyvsp[-3].string)); mailserverset.host = (yyvsp[-3].string); mailserverset.port = (yyvsp[-1].number); addmailserver(&mailserverset); } #line 4059 "src/y.tab.c" break; case 303: /* mailserveropt: username */ #line 1156 "src/p.y" { mailserverset.username = (yyvsp[0].string); } #line 4067 "src/y.tab.c" break; case 304: /* mailserveropt: password */ #line 1159 "src/p.y" { mailserverset.password = (yyvsp[0].string); } #line 4075 "src/y.tab.c" break; case 309: /* sethttpd: SET HTTPD httpdlist */ #line 1168 "src/p.y" { if (sslset.flags & SSL_Enabled) { #ifdef HAVE_OPENSSL if (sslset.pemfile) { if (sslset.pemchain || sslset.pemkey) { yyerror("SSL server option pemfile and pemchain|pemkey are mutually exclusive"); } else if (! file_checkStat(sslset.pemfile, "SSL server PEM file", S_IRWXU | S_IRGRP | S_IXGRP)) { yyerror("SSL server PEM file permissions check failed"); } else { _setSSLOptions(&(Run.httpd.socket.net.ssl)); } } else if (sslset.pemchain && sslset.pemkey) { if (! file_checkStat(sslset.pemkey, "SSL server private key PEM file", S_IRWXU | S_IRGRP | S_IXGRP)) { yyerror("SSL server private key PEM file permissions check failed"); } else { _setSSLOptions(&(Run.httpd.socket.net.ssl)); } } else { yyerror("SSL server PEM file is required (please use ssl pemfile option)"); } #else yyerror("SSL is not supported"); #endif } } #line 4105 "src/y.tab.c" break; case 321: /* pemfile: PEMFILE PATH */ #line 1211 "src/p.y" { _setPEM(&(sslset.pemfile), (yyvsp[0].string), "SSL server PEM file", true); } #line 4113 "src/y.tab.c" break; case 322: /* clientpemfile: CLIENTPEMFILE PATH */ #line 1217 "src/p.y" { _setPEM(&(sslset.clientpemfile), (yyvsp[0].string), "SSL client PEM file", true); } #line 4121 "src/y.tab.c" break; case 323: /* allowselfcert: ALLOWSELFCERTIFICATION */ #line 1223 "src/p.y" { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = true; } #line 4130 "src/y.tab.c" break; case 324: /* httpdport: PORT NUMBER readonly */ #line 1229 "src/p.y" { Run.httpd.flags |= Httpd_Net; Run.httpd.socket.net.port = (yyvsp[-1].number); Run.httpd.socket.net.readonly = (yyvsp[0].number); } #line 4140 "src/y.tab.c" break; case 325: /* httpdsocket: UNIXSOCKET PATH httpdsocketoptionlist */ #line 1236 "src/p.y" { Run.httpd.flags |= Httpd_Unix; Run.httpd.socket.unix.path = (yyvsp[-1].string); } #line 4149 "src/y.tab.c" break; case 328: /* httpdsocketoption: UID STRING */ #line 1246 "src/p.y" { Run.httpd.flags |= Httpd_UnixUid; Run.httpd.socket.unix.uid = get_uid((yyvsp[0].string), 0); FREE((yyvsp[0].string)); } #line 4159 "src/y.tab.c" break; case 329: /* httpdsocketoption: GID STRING */ #line 1251 "src/p.y" { Run.httpd.flags |= Httpd_UnixGid; Run.httpd.socket.unix.gid = get_gid((yyvsp[0].string), 0); FREE((yyvsp[0].string)); } #line 4169 "src/y.tab.c" break; case 330: /* httpdsocketoption: UID NUMBER */ #line 1256 "src/p.y" { Run.httpd.flags |= Httpd_UnixUid; Run.httpd.socket.unix.uid = get_uid(NULL, (yyvsp[0].number)); } #line 4178 "src/y.tab.c" break; case 331: /* httpdsocketoption: GID NUMBER */ #line 1260 "src/p.y" { Run.httpd.flags |= Httpd_UnixGid; Run.httpd.socket.unix.gid = get_gid(NULL, (yyvsp[0].number)); } #line 4187 "src/y.tab.c" break; case 332: /* httpdsocketoption: PERMISSION NUMBER */ #line 1264 "src/p.y" { Run.httpd.flags |= Httpd_UnixPermission; Run.httpd.socket.unix.permission = check_perm((yyvsp[0].number)); } #line 4196 "src/y.tab.c" break; case 333: /* httpdsocketoption: READONLY */ #line 1268 "src/p.y" { Run.httpd.socket.unix.readonly = true; } #line 4204 "src/y.tab.c" break; case 338: /* signature: sigenable */ #line 1281 "src/p.y" { Run.httpd.flags |= Httpd_Signature; } #line 4212 "src/y.tab.c" break; case 339: /* signature: sigdisable */ #line 1284 "src/p.y" { Run.httpd.flags &= ~Httpd_Signature; } #line 4220 "src/y.tab.c" break; case 340: /* bindaddress: ADDRESS STRING */ #line 1289 "src/p.y" { if (Run.httpd.socket.net.address) { yywarning2("The 'address' option can be specified only once, the last value will be used\n"); FREE(Run.httpd.socket.net.address); } Run.httpd.socket.net.address = (yyvsp[0].string); } #line 4232 "src/y.tab.c" break; case 341: /* allow: ALLOW STRING ':' STRING readonly */ #line 1298 "src/p.y" { addcredentials((yyvsp[-3].string), (yyvsp[-1].string), Digest_Cleartext, (yyvsp[0].number)); } #line 4240 "src/y.tab.c" break; case 342: /* allow: ALLOW '@' STRING readonly */ #line 1301 "src/p.y" { #ifdef HAVE_LIBPAM addpamauth((yyvsp[-1].string), (yyvsp[0].number)); #else yyerror("PAM is not supported"); FREE((yyvsp[-1].string)); #endif } #line 4253 "src/y.tab.c" break; case 343: /* allow: ALLOW PATH */ #line 1309 "src/p.y" { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Cleartext); FREE((yyvsp[0].string)); } #line 4262 "src/y.tab.c" break; case 344: /* allow: ALLOW CLEARTEXT PATH */ #line 1313 "src/p.y" { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Cleartext); FREE((yyvsp[0].string)); } #line 4271 "src/y.tab.c" break; case 345: /* allow: ALLOW MD5HASH PATH */ #line 1317 "src/p.y" { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Md5); FREE((yyvsp[0].string)); } #line 4280 "src/y.tab.c" break; case 346: /* allow: ALLOW CRYPT PATH */ #line 1321 "src/p.y" { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Crypt); FREE((yyvsp[0].string)); } #line 4289 "src/y.tab.c" break; case 347: /* $@1: %empty */ #line 1325 "src/p.y" { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Cleartext; } #line 4298 "src/y.tab.c" break; case 348: /* allow: ALLOW PATH $@1 allowuserlist */ #line 1329 "src/p.y" { FREE(htpasswd_file); } #line 4306 "src/y.tab.c" break; case 349: /* $@2: %empty */ #line 1332 "src/p.y" { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Cleartext; } #line 4315 "src/y.tab.c" break; case 350: /* allow: ALLOW CLEARTEXT PATH $@2 allowuserlist */ #line 1336 "src/p.y" { FREE(htpasswd_file); } #line 4323 "src/y.tab.c" break; case 351: /* $@3: %empty */ #line 1339 "src/p.y" { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Md5; } #line 4332 "src/y.tab.c" break; case 352: /* allow: ALLOW MD5HASH PATH $@3 allowuserlist */ #line 1343 "src/p.y" { FREE(htpasswd_file); } #line 4340 "src/y.tab.c" break; case 353: /* $@4: %empty */ #line 1346 "src/p.y" { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Crypt; } #line 4349 "src/y.tab.c" break; case 354: /* allow: ALLOW CRYPT PATH $@4 allowuserlist */ #line 1350 "src/p.y" { FREE(htpasswd_file); } #line 4357 "src/y.tab.c" break; case 355: /* allow: ALLOW STRING */ #line 1353 "src/p.y" { if (! Engine_addAllow((yyvsp[0].string))) yywarning2("invalid allow option: %s", (yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 4367 "src/y.tab.c" break; case 358: /* allowuser: STRING */ #line 1364 "src/p.y" { addhtpasswdentry(htpasswd_file, (yyvsp[0].string), digesttype); FREE((yyvsp[0].string)); } #line 4376 "src/y.tab.c" break; case 359: /* readonly: %empty */ #line 1370 "src/p.y" { (yyval.number) = false; } #line 4384 "src/y.tab.c" break; case 360: /* readonly: READONLY */ #line 1373 "src/p.y" { (yyval.number) = true; } #line 4392 "src/y.tab.c" break; case 361: /* checkproc: CHECKPROC SERVICENAME PIDFILE PATH */ #line 1378 "src/p.y" { createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process); } #line 4400 "src/y.tab.c" break; case 362: /* checkproc: CHECKPROC SERVICENAME PATHTOK PATH */ #line 1381 "src/p.y" { createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process); } #line 4408 "src/y.tab.c" break; case 363: /* checkproc: CHECKPROC SERVICENAME MATCH STRING */ #line 1384 "src/p.y" { createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process); matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = Str_dup((yyvsp[0].string)); addmatch(&matchset, Action_Ignored, 0); } #line 4420 "src/y.tab.c" break; case 364: /* checkproc: CHECKPROC SERVICENAME MATCH PATH */ #line 1391 "src/p.y" { createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process); matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = Str_dup((yyvsp[0].string)); addmatch(&matchset, Action_Ignored, 0); } #line 4432 "src/y.tab.c" break; case 365: /* checkfile: CHECKFILE SERVICENAME PATHTOK PATH */ #line 1400 "src/p.y" { createservice(Service_File, (yyvsp[-2].string), (yyvsp[0].string), check_file); } #line 4440 "src/y.tab.c" break; case 366: /* checkfilesys: CHECKFILESYS SERVICENAME PATHTOK PATH */ #line 1405 "src/p.y" { createservice(Service_Filesystem, (yyvsp[-2].string), (yyvsp[0].string), check_filesystem); } #line 4448 "src/y.tab.c" break; case 367: /* checkfilesys: CHECKFILESYS SERVICENAME PATHTOK STRING */ #line 1408 "src/p.y" { createservice(Service_Filesystem, (yyvsp[-2].string), (yyvsp[0].string), check_filesystem); } #line 4456 "src/y.tab.c" break; case 368: /* checkdir: CHECKDIR SERVICENAME PATHTOK PATH */ #line 1413 "src/p.y" { createservice(Service_Directory, (yyvsp[-2].string), (yyvsp[0].string), check_directory); } #line 4464 "src/y.tab.c" break; case 369: /* checkhost: CHECKHOST SERVICENAME ADDRESS STRING */ #line 1418 "src/p.y" { createservice(Service_Host, (yyvsp[-2].string), (yyvsp[0].string), check_remote_host); } #line 4472 "src/y.tab.c" break; case 370: /* checknet: CHECKNET SERVICENAME ADDRESS STRING */ #line 1423 "src/p.y" { if (Link_isGetByAddressSupported()) { createservice(Service_Net, (yyvsp[-2].string), (yyvsp[0].string), check_net); current->inf.net->stats = Link_createForAddress((yyvsp[0].string)); } else { yyerror("Network monitoring by IP address is not supported on this platform, please use 'check network with interface ' instead"); } } #line 4485 "src/y.tab.c" break; case 371: /* checknet: CHECKNET SERVICENAME INTERFACE STRING */ #line 1431 "src/p.y" { createservice(Service_Net, (yyvsp[-2].string), (yyvsp[0].string), check_net); current->inf.net->stats = Link_createForInterface((yyvsp[0].string)); } #line 4494 "src/y.tab.c" break; case 372: /* checksystem: CHECKSYSTEM SERVICENAME */ #line 1437 "src/p.y" { char *servicename = (yyvsp[0].string); if (Str_sub(servicename, "$HOST")) { char hostname[STRLEN]; if (gethostname(hostname, sizeof(hostname))) { Log_error("System hostname error -- %s\n", STRERROR); cfg_errflag++; } else { Util_replaceString(&servicename, "$HOST", hostname); } } Run.system = createservice(Service_System, servicename, NULL, check_system); // The name given in the 'check system' statement overrides system hostname } #line 4512 "src/y.tab.c" break; case 373: /* checkfifo: CHECKFIFO SERVICENAME PATHTOK PATH */ #line 1452 "src/p.y" { createservice(Service_Fifo, (yyvsp[-2].string), (yyvsp[0].string), check_fifo); } #line 4520 "src/y.tab.c" break; case 374: /* checkprogram: CHECKPROGRAM SERVICENAME PATHTOK argumentlist programtimeout */ #line 1457 "src/p.y" { createservice(Service_Program, (yyvsp[-3].string), NULL, check_program); current->program->timeout = (yyvsp[0].number); current->program->lastOutput = StringBuffer_create(64); current->program->inprogressOutput = StringBuffer_create(64); } #line 4531 "src/y.tab.c" break; case 375: /* checkprogram: CHECKPROGRAM SERVICENAME PATHTOK argumentlist useroptionlist programtimeout */ #line 1463 "src/p.y" { createservice(Service_Program, (yyvsp[-4].string), NULL, check_program); current->program->timeout = (yyvsp[0].number); current->program->lastOutput = StringBuffer_create(64); current->program->inprogressOutput = StringBuffer_create(64); } #line 4542 "src/y.tab.c" break; case 376: /* start: START argumentlist starttimeout */ #line 1471 "src/p.y" { addcommand(START, (yyvsp[0].number)); } #line 4550 "src/y.tab.c" break; case 377: /* start: START argumentlist useroptionlist starttimeout */ #line 1474 "src/p.y" { addcommand(START, (yyvsp[0].number)); } #line 4558 "src/y.tab.c" break; case 378: /* stop: STOP argumentlist stoptimeout */ #line 1479 "src/p.y" { addcommand(STOP, (yyvsp[0].number)); } #line 4566 "src/y.tab.c" break; case 379: /* stop: STOP argumentlist useroptionlist stoptimeout */ #line 1482 "src/p.y" { addcommand(STOP, (yyvsp[0].number)); } #line 4574 "src/y.tab.c" break; case 380: /* restart: RESTART argumentlist restarttimeout */ #line 1488 "src/p.y" { addcommand(RESTART, (yyvsp[0].number)); } #line 4582 "src/y.tab.c" break; case 381: /* restart: RESTART argumentlist useroptionlist restarttimeout */ #line 1491 "src/p.y" { addcommand(RESTART, (yyvsp[0].number)); } #line 4590 "src/y.tab.c" break; case 386: /* argument: STRING */ #line 1504 "src/p.y" { addargument((yyvsp[0].string)); } #line 4598 "src/y.tab.c" break; case 387: /* argument: PATH */ #line 1507 "src/p.y" { addargument((yyvsp[0].string)); } #line 4606 "src/y.tab.c" break; case 388: /* useroption: UID STRING */ #line 1512 "src/p.y" { addeuid(get_uid((yyvsp[0].string), 0)); FREE((yyvsp[0].string)); } #line 4615 "src/y.tab.c" break; case 389: /* useroption: GID STRING */ #line 1516 "src/p.y" { addegid(get_gid((yyvsp[0].string), 0)); FREE((yyvsp[0].string)); } #line 4624 "src/y.tab.c" break; case 390: /* useroption: UID NUMBER */ #line 1520 "src/p.y" { addeuid(get_uid(NULL, (yyvsp[0].number))); } #line 4632 "src/y.tab.c" break; case 391: /* useroption: GID NUMBER */ #line 1523 "src/p.y" { addegid(get_gid(NULL, (yyvsp[0].number))); } #line 4640 "src/y.tab.c" break; case 392: /* username: USERNAME MAILADDR */ #line 1528 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 4648 "src/y.tab.c" break; case 393: /* username: USERNAME STRING */ #line 1531 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 4656 "src/y.tab.c" break; case 394: /* password: PASSWORD STRING */ #line 1536 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 4664 "src/y.tab.c" break; case 395: /* database: DATABASE STRING */ #line 1541 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 4672 "src/y.tab.c" break; case 396: /* hostname: %empty */ #line 1546 "src/p.y" { (yyval.string) = NULL; } #line 4680 "src/y.tab.c" break; case 397: /* hostname: HOSTNAME STRING */ #line 1549 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 4688 "src/y.tab.c" break; case 398: /* connection: IF FAILED host port connectionoptlist rate1 THEN action1 recovery_success */ #line 1554 "src/p.y" { /* This is a workaround to support content match without having to create an URL object. 'urloption' creates the Request_T object we need minus the URL object, but with enough information to perform content test. TODO: Parser is in need of refactoring */ portset.url_request = urlrequest; portset.check_invers = false; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->portlist), &portset); } #line 4703 "src/y.tab.c" break; case 399: /* connection: IF SUCCEEDED host port connectionoptlist rate1 THEN action1 recovery_failure */ #line 1564 "src/p.y" { portset.url_request = urlrequest; portset.check_invers = true; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->portlist), &portset); } #line 4716 "src/y.tab.c" break; case 414: /* connectionurl: IF FAILED URL URLOBJECT connectionurloptlist rate1 THEN action1 recovery_success */ #line 1592 "src/p.y" { portset.check_invers = false; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; prepare_urlrequest((yyvsp[-5].url)); addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->portlist), &portset); } #line 4729 "src/y.tab.c" break; case 415: /* connectionurl: IF SUCCEEDED URL URLOBJECT connectionurloptlist rate1 THEN action1 recovery_failure */ #line 1600 "src/p.y" { portset.check_invers = true; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; prepare_urlrequest((yyvsp[-5].url)); addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->portlist), &portset); } #line 4742 "src/y.tab.c" break; case 424: /* connectionunix: IF FAILED unixsocket connectionuxoptlist rate1 THEN action1 recovery_success */ #line 1622 "src/p.y" { portset.check_invers = false; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->socketlist), &portset); } #line 4754 "src/y.tab.c" break; case 425: /* connectionunix: IF SUCCEEDED unixsocket connectionuxoptlist rate1 THEN action1 recovery_failure */ #line 1629 "src/p.y" { portset.check_invers = true; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->socketlist), &portset); } #line 4766 "src/y.tab.c" break; case 434: /* icmp: IF FAILED ICMP icmptype icmpoptlist rate1 THEN action1 recovery_success */ #line 1650 "src/p.y" { icmpset.family = Socket_Ip; icmpset.check_invers = false; icmpset.type = (yyvsp[-5].number); icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4780 "src/y.tab.c" break; case 435: /* icmp: IF FAILED PING icmpoptlist rate1 THEN action1 recovery_success */ #line 1659 "src/p.y" { icmpset.family = Socket_Ip; icmpset.check_invers = false; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4793 "src/y.tab.c" break; case 436: /* icmp: IF FAILED PING4 icmpoptlist rate1 THEN action1 recovery_success */ #line 1667 "src/p.y" { icmpset.family = Socket_Ip4; icmpset.check_invers = false; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4806 "src/y.tab.c" break; case 437: /* icmp: IF FAILED PING6 icmpoptlist rate1 THEN action1 recovery_success */ #line 1675 "src/p.y" { icmpset.family = Socket_Ip6; icmpset.check_invers = false; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4819 "src/y.tab.c" break; case 438: /* icmp: IF SUCCEEDED ICMP icmptype icmpoptlist rate1 THEN action1 recovery_failure */ #line 1683 "src/p.y" { icmpset.family = Socket_Ip; icmpset.check_invers = true; icmpset.type = (yyvsp[-5].number); icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4833 "src/y.tab.c" break; case 439: /* icmp: IF SUCCEEDED PING icmpoptlist rate1 THEN action1 recovery_failure */ #line 1692 "src/p.y" { icmpset.family = Socket_Ip; icmpset.check_invers = true; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4846 "src/y.tab.c" break; case 440: /* icmp: IF SUCCEEDED PING4 icmpoptlist rate1 THEN action1 recovery_failure */ #line 1700 "src/p.y" { icmpset.family = Socket_Ip4; icmpset.check_invers = true; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4859 "src/y.tab.c" break; case 441: /* icmp: IF SUCCEEDED PING6 icmpoptlist rate1 THEN action1 recovery_failure */ #line 1708 "src/p.y" { icmpset.family = Socket_Ip6; icmpset.check_invers = true; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4872 "src/y.tab.c" break; case 449: /* host: %empty */ #line 1729 "src/p.y" { portset.hostname = Str_dup(current->type == Service_Host ? current->path : LOCALHOST); } #line 4880 "src/y.tab.c" break; case 450: /* host: HOST STRING */ #line 1732 "src/p.y" { portset.hostname = (yyvsp[0].string); } #line 4888 "src/y.tab.c" break; case 451: /* port: PORT NUMBER */ #line 1737 "src/p.y" { portset.target.net.port = (yyvsp[0].number); } #line 4896 "src/y.tab.c" break; case 452: /* unixsocket: UNIXSOCKET PATH */ #line 1742 "src/p.y" { portset.family = Socket_Unix; portset.target.unix.pathname = (yyvsp[0].string); } #line 4905 "src/y.tab.c" break; case 453: /* ip: IPV4 */ #line 1748 "src/p.y" { portset.family = Socket_Ip4; } #line 4913 "src/y.tab.c" break; case 454: /* ip: IPV6 */ #line 1751 "src/p.y" { portset.family = Socket_Ip6; } #line 4921 "src/y.tab.c" break; case 455: /* type: TYPE TCP */ #line 1756 "src/p.y" { portset.type = Socket_Tcp; } #line 4929 "src/y.tab.c" break; case 456: /* type: TYPE TCPSSL typeoptlist */ #line 1759 "src/p.y" { // The typelist is kept for backward compatibility (replaced by ssloptionlist) portset.type = Socket_Tcp; sslset.flags = SSL_Enabled; } #line 4938 "src/y.tab.c" break; case 457: /* type: TYPE UDP */ #line 1763 "src/p.y" { portset.type = Socket_Udp; } #line 4946 "src/y.tab.c" break; case 462: /* outgoing: ADDRESS STRING */ #line 1776 "src/p.y" { _parseOutgoingAddress((yyvsp[0].string), &(portset.outgoing)); } #line 4954 "src/y.tab.c" break; case 463: /* protocol: PROTOCOL APACHESTATUS apache_stat_list */ #line 1781 "src/p.y" { portset.protocol = Protocol_get(Protocol_APACHESTATUS); } #line 4962 "src/y.tab.c" break; case 464: /* protocol: PROTOCOL CLAMAV */ #line 1784 "src/p.y" { portset.protocol = Protocol_get(Protocol_CLAMAV); } #line 4970 "src/y.tab.c" break; case 465: /* protocol: PROTOCOL DEFAULT */ #line 1787 "src/p.y" { portset.protocol = Protocol_get(Protocol_DEFAULT); } #line 4978 "src/y.tab.c" break; case 466: /* protocol: PROTOCOL DNS */ #line 1790 "src/p.y" { portset.protocol = Protocol_get(Protocol_DNS); } #line 4986 "src/y.tab.c" break; case 467: /* protocol: PROTOCOL DWP */ #line 1793 "src/p.y" { portset.protocol = Protocol_get(Protocol_DWP); } #line 4994 "src/y.tab.c" break; case 468: /* protocol: PROTOCOL FAIL2BAN */ #line 1796 "src/p.y" { portset.protocol = Protocol_get(Protocol_FAIL2BAN); } #line 5002 "src/y.tab.c" break; case 469: /* protocol: PROTOCOL FTP */ #line 1799 "src/p.y" { portset.protocol = Protocol_get(Protocol_FTP); } #line 5010 "src/y.tab.c" break; case 470: /* protocol: PROTOCOL GPS */ #line 1802 "src/p.y" { portset.protocol = Protocol_get(Protocol_GPS); } #line 5018 "src/y.tab.c" break; case 471: /* protocol: PROTOCOL HTTP httplist */ #line 1805 "src/p.y" { portset.protocol = Protocol_get(Protocol_HTTP); } #line 5026 "src/y.tab.c" break; case 472: /* protocol: PROTOCOL HTTPS httplist */ #line 1808 "src/p.y" { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_HTTP); } #line 5036 "src/y.tab.c" break; case 473: /* protocol: PROTOCOL IMAP */ #line 1813 "src/p.y" { portset.protocol = Protocol_get(Protocol_IMAP); } #line 5044 "src/y.tab.c" break; case 474: /* protocol: PROTOCOL IMAPS */ #line 1816 "src/p.y" { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_IMAP); } #line 5054 "src/y.tab.c" break; case 475: /* protocol: PROTOCOL LDAP2 */ #line 1821 "src/p.y" { portset.protocol = Protocol_get(Protocol_LDAP2); } #line 5062 "src/y.tab.c" break; case 476: /* protocol: PROTOCOL LDAP3 */ #line 1824 "src/p.y" { portset.protocol = Protocol_get(Protocol_LDAP3); } #line 5070 "src/y.tab.c" break; case 477: /* protocol: PROTOCOL LMTP */ #line 1827 "src/p.y" { portset.protocol = Protocol_get(Protocol_LMTP); } #line 5078 "src/y.tab.c" break; case 478: /* protocol: PROTOCOL MEMCACHE */ #line 1830 "src/p.y" { portset.protocol = Protocol_get(Protocol_MEMCACHE); } #line 5086 "src/y.tab.c" break; case 479: /* protocol: PROTOCOL MONGODB */ #line 1833 "src/p.y" { portset.protocol = Protocol_get(Protocol_MONGODB); } #line 5094 "src/y.tab.c" break; case 480: /* protocol: PROTOCOL MQTT mqttlist */ #line 1836 "src/p.y" { portset.protocol = Protocol_get(Protocol_MQTT); } #line 5102 "src/y.tab.c" break; case 481: /* protocol: PROTOCOL MYSQL mysqllist */ #line 1839 "src/p.y" { portset.protocol = Protocol_get(Protocol_MYSQL); } #line 5110 "src/y.tab.c" break; case 482: /* protocol: PROTOCOL MYSQLS mysqllist */ #line 1842 "src/p.y" { sslset.flags = SSL_StartTLS; portset.protocol = Protocol_get(Protocol_MYSQL); } #line 5119 "src/y.tab.c" break; case 483: /* protocol: PROTOCOL NNTP */ #line 1846 "src/p.y" { portset.protocol = Protocol_get(Protocol_NNTP); } #line 5127 "src/y.tab.c" break; case 484: /* protocol: PROTOCOL NTP3 */ #line 1849 "src/p.y" { portset.protocol = Protocol_get(Protocol_NTP3); portset.type = Socket_Udp; } #line 5136 "src/y.tab.c" break; case 485: /* protocol: PROTOCOL PGSQL postgresqllist */ #line 1853 "src/p.y" { portset.protocol = Protocol_get(Protocol_PGSQL); } #line 5144 "src/y.tab.c" break; case 486: /* protocol: PROTOCOL POP */ #line 1856 "src/p.y" { portset.protocol = Protocol_get(Protocol_POP); } #line 5152 "src/y.tab.c" break; case 487: /* protocol: PROTOCOL POPS */ #line 1859 "src/p.y" { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_POP); } #line 5162 "src/y.tab.c" break; case 488: /* protocol: PROTOCOL POSTFIXPOLICY */ #line 1864 "src/p.y" { portset.protocol = Protocol_get(Protocol_POSTFIXPOLICY); } #line 5170 "src/y.tab.c" break; case 489: /* protocol: PROTOCOL RADIUS radiuslist */ #line 1867 "src/p.y" { portset.protocol = Protocol_get(Protocol_RADIUS); } #line 5178 "src/y.tab.c" break; case 490: /* protocol: PROTOCOL RDATE */ #line 1870 "src/p.y" { portset.protocol = Protocol_get(Protocol_RDATE); } #line 5186 "src/y.tab.c" break; case 491: /* protocol: PROTOCOL REDIS */ #line 1873 "src/p.y" { portset.protocol = Protocol_get(Protocol_REDIS); } #line 5194 "src/y.tab.c" break; case 492: /* protocol: PROTOCOL RSYNC */ #line 1876 "src/p.y" { portset.protocol = Protocol_get(Protocol_RSYNC); } #line 5202 "src/y.tab.c" break; case 493: /* protocol: PROTOCOL SIEVE */ #line 1879 "src/p.y" { portset.protocol = Protocol_get(Protocol_SIEVE); } #line 5210 "src/y.tab.c" break; case 494: /* protocol: PROTOCOL SIP siplist */ #line 1882 "src/p.y" { portset.protocol = Protocol_get(Protocol_SIP); } #line 5218 "src/y.tab.c" break; case 495: /* protocol: PROTOCOL SMTP smtplist */ #line 1885 "src/p.y" { portset.protocol = Protocol_get(Protocol_SMTP); } #line 5226 "src/y.tab.c" break; case 496: /* protocol: PROTOCOL SMTPS smtplist */ #line 1888 "src/p.y" { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_SMTP); } #line 5236 "src/y.tab.c" break; case 497: /* protocol: PROTOCOL SPAMASSASSIN */ #line 1893 "src/p.y" { portset.protocol = Protocol_get(Protocol_SPAMASSASSIN); } #line 5244 "src/y.tab.c" break; case 498: /* protocol: PROTOCOL SSH */ #line 1896 "src/p.y" { portset.protocol = Protocol_get(Protocol_SSH); } #line 5252 "src/y.tab.c" break; case 499: /* protocol: PROTOCOL TNS */ #line 1899 "src/p.y" { portset.protocol = Protocol_get(Protocol_TNS); } #line 5260 "src/y.tab.c" break; case 500: /* protocol: PROTOCOL WEBSOCKET websocketlist */ #line 1902 "src/p.y" { portset.protocol = Protocol_get(Protocol_WEBSOCKET); } #line 5268 "src/y.tab.c" break; case 501: /* sendexpect: SEND STRING */ #line 1907 "src/p.y" { if (portset.protocol->check == check_default || portset.protocol->check == check_generic) { portset.protocol = Protocol_get(Protocol_GENERIC); addgeneric(&portset, (yyvsp[0].string), NULL); } else { yyerror("The SEND statement is not allowed in the %s protocol context", portset.protocol->name); } } #line 5281 "src/y.tab.c" break; case 502: /* sendexpect: EXPECT STRING */ #line 1915 "src/p.y" { if (portset.protocol->check == check_default || portset.protocol->check == check_generic) { portset.protocol = Protocol_get(Protocol_GENERIC); addgeneric(&portset, NULL, (yyvsp[0].string)); } else { yyerror("The EXPECT statement is not allowed in the %s protocol context", portset.protocol->name); } } #line 5294 "src/y.tab.c" break; case 505: /* websocket: ORIGIN STRING */ #line 1929 "src/p.y" { portset.parameters.websocket.origin = (yyvsp[0].string); } #line 5302 "src/y.tab.c" break; case 506: /* websocket: REQUEST PATH */ #line 1932 "src/p.y" { portset.parameters.websocket.request = (yyvsp[0].string); } #line 5310 "src/y.tab.c" break; case 507: /* websocket: HOST STRING */ #line 1935 "src/p.y" { portset.parameters.websocket.host = (yyvsp[0].string); } #line 5318 "src/y.tab.c" break; case 508: /* websocket: VERSIONOPT NUMBER */ #line 1938 "src/p.y" { portset.parameters.websocket.version = (yyvsp[0].number); } #line 5326 "src/y.tab.c" break; case 511: /* smtp: username */ #line 1947 "src/p.y" { portset.parameters.smtp.username = (yyvsp[0].string); } #line 5334 "src/y.tab.c" break; case 512: /* smtp: password */ #line 1950 "src/p.y" { portset.parameters.smtp.password = (yyvsp[0].string); } #line 5342 "src/y.tab.c" break; case 515: /* mqtt: username */ #line 1959 "src/p.y" { portset.parameters.mqtt.username = (yyvsp[0].string); } #line 5350 "src/y.tab.c" break; case 516: /* mqtt: password */ #line 1962 "src/p.y" { portset.parameters.mqtt.password = (yyvsp[0].string); } #line 5358 "src/y.tab.c" break; case 519: /* mysql: username */ #line 1971 "src/p.y" { portset.parameters.mysql.username = (yyvsp[0].string); } #line 5366 "src/y.tab.c" break; case 520: /* mysql: password */ #line 1974 "src/p.y" { portset.parameters.mysql.password = (yyvsp[0].string); } #line 5374 "src/y.tab.c" break; case 521: /* mysql: RSAKEY CHECKSUM checksumoperator STRING */ #line 1977 "src/p.y" { portset.parameters.mysql.rsaChecksum = (yyvsp[0].string); switch (cleanup_hash_string(portset.parameters.mysql.rsaChecksum)) { case 32: portset.parameters.mysql.rsaChecksumType = Hash_Md5; break; case 40: portset.parameters.mysql.rsaChecksumType = Hash_Sha1; break; default: yyerror2("Unknown checksum type: [%s] is not MD5 nor SHA1", portset.parameters.mysql.rsaChecksum); } } #line 5392 "src/y.tab.c" break; case 522: /* mysql: RSAKEY CHECKSUM MD5HASH checksumoperator STRING */ #line 1990 "src/p.y" { portset.parameters.mysql.rsaChecksum = (yyvsp[0].string); if (cleanup_hash_string(portset.parameters.mysql.rsaChecksum) != 32) yyerror2("Unknown checksum type: [%s] is not MD5", portset.parameters.mysql.rsaChecksum); portset.parameters.mysql.rsaChecksumType = Hash_Md5; } #line 5403 "src/y.tab.c" break; case 523: /* mysql: RSAKEY CHECKSUM SHA1HASH checksumoperator STRING */ #line 1996 "src/p.y" { portset.parameters.mysql.rsaChecksum = (yyvsp[0].string); if (cleanup_hash_string(portset.parameters.mysql.rsaChecksum) != 40) yyerror2("Unknown checksum type: [%s] is not SHA1", portset.parameters.mysql.rsaChecksum); portset.parameters.mysql.rsaChecksumType = Hash_Sha1; } #line 5414 "src/y.tab.c" break; case 526: /* postgresql: username */ #line 2008 "src/p.y" { portset.parameters.postgresql.username = (yyvsp[0].string); } #line 5422 "src/y.tab.c" break; case 527: /* postgresql: password */ #line 2011 "src/p.y" { portset.parameters.postgresql.password = (yyvsp[0].string); } #line 5430 "src/y.tab.c" break; case 528: /* postgresql: database */ #line 2014 "src/p.y" { portset.parameters.postgresql.database = (yyvsp[0].string); } #line 5438 "src/y.tab.c" break; case 529: /* target: TARGET MAILADDR */ #line 2019 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 5446 "src/y.tab.c" break; case 530: /* target: TARGET STRING */ #line 2022 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 5454 "src/y.tab.c" break; case 531: /* maxforward: MAXFORWARD NUMBER */ #line 2027 "src/p.y" { (yyval.number) = verifyMaxForward((yyvsp[0].number)); } #line 5462 "src/y.tab.c" break; case 534: /* sip: target */ #line 2036 "src/p.y" { portset.parameters.sip.target = (yyvsp[0].string); } #line 5470 "src/y.tab.c" break; case 535: /* sip: maxforward */ #line 2039 "src/p.y" { portset.parameters.sip.maxforward = (yyvsp[0].number); } #line 5478 "src/y.tab.c" break; case 538: /* http: username */ #line 2048 "src/p.y" { portset.parameters.http.username = (yyvsp[0].string); } #line 5486 "src/y.tab.c" break; case 539: /* http: password */ #line 2051 "src/p.y" { portset.parameters.http.password = (yyvsp[0].string); } #line 5494 "src/y.tab.c" break; case 546: /* status: STATUS operator NUMBER */ #line 2062 "src/p.y" { if ((yyvsp[0].number) < 0) { yyerror2("The status value must be greater or equal to 0"); } portset.parameters.http.operator = (yyvsp[-1].number); portset.parameters.http.status = (yyvsp[0].number); portset.parameters.http.hasStatus = true; } #line 5507 "src/y.tab.c" break; case 547: /* method: METHOD GET */ #line 2072 "src/p.y" { portset.parameters.http.method = Http_Get; } #line 5515 "src/y.tab.c" break; case 548: /* method: METHOD HEAD */ #line 2075 "src/p.y" { portset.parameters.http.method = Http_Head; } #line 5523 "src/y.tab.c" break; case 549: /* request: REQUEST PATH */ #line 2080 "src/p.y" { portset.parameters.http.request = Util_urlEncode((yyvsp[0].string), false); FREE((yyvsp[0].string)); } #line 5532 "src/y.tab.c" break; case 550: /* request: REQUEST STRING */ #line 2084 "src/p.y" { portset.parameters.http.request = Util_urlEncode((yyvsp[0].string), false); FREE((yyvsp[0].string)); } #line 5541 "src/y.tab.c" break; case 551: /* responsesum: CHECKSUM STRING */ #line 2090 "src/p.y" { portset.parameters.http.checksum = (yyvsp[0].string); } #line 5549 "src/y.tab.c" break; case 552: /* hostheader: HOSTHEADER STRING */ #line 2095 "src/p.y" { addhttpheader(&portset, Str_cat("Host:%s", (yyvsp[0].string))); FREE((yyvsp[0].string)); } #line 5558 "src/y.tab.c" break; case 554: /* httpheaderlist: httpheaderlist HTTPHEADER */ #line 2102 "src/p.y" { addhttpheader(&portset, (yyvsp[0].string)); } #line 5566 "src/y.tab.c" break; case 555: /* secret: SECRET STRING */ #line 2107 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 5574 "src/y.tab.c" break; case 558: /* radius: secret */ #line 2116 "src/p.y" { portset.parameters.radius.secret = (yyvsp[0].string); } #line 5582 "src/y.tab.c" break; case 561: /* apache_stat: username */ #line 2125 "src/p.y" { portset.parameters.apachestatus.username = (yyvsp[0].string); } #line 5590 "src/y.tab.c" break; case 562: /* apache_stat: password */ #line 2128 "src/p.y" { portset.parameters.apachestatus.password = (yyvsp[0].string); } #line 5598 "src/y.tab.c" break; case 563: /* apache_stat: PATHTOK PATH */ #line 2131 "src/p.y" { portset.parameters.apachestatus.path = (yyvsp[0].string); } #line 5606 "src/y.tab.c" break; case 564: /* apache_stat: LOGLIMIT operator NUMBER PERCENT */ #line 2134 "src/p.y" { portset.parameters.apachestatus.loglimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.loglimit = (yyvsp[-1].number); } #line 5615 "src/y.tab.c" break; case 565: /* apache_stat: CLOSELIMIT operator NUMBER PERCENT */ #line 2138 "src/p.y" { portset.parameters.apachestatus.closelimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.closelimit = (yyvsp[-1].number); } #line 5624 "src/y.tab.c" break; case 566: /* apache_stat: DNSLIMIT operator NUMBER PERCENT */ #line 2142 "src/p.y" { portset.parameters.apachestatus.dnslimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.dnslimit = (yyvsp[-1].number); } #line 5633 "src/y.tab.c" break; case 567: /* apache_stat: KEEPALIVELIMIT operator NUMBER PERCENT */ #line 2146 "src/p.y" { portset.parameters.apachestatus.keepalivelimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.keepalivelimit = (yyvsp[-1].number); } #line 5642 "src/y.tab.c" break; case 568: /* apache_stat: REPLYLIMIT operator NUMBER PERCENT */ #line 2150 "src/p.y" { portset.parameters.apachestatus.replylimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.replylimit = (yyvsp[-1].number); } #line 5651 "src/y.tab.c" break; case 569: /* apache_stat: REQUESTLIMIT operator NUMBER PERCENT */ #line 2154 "src/p.y" { portset.parameters.apachestatus.requestlimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.requestlimit = (yyvsp[-1].number); } #line 5660 "src/y.tab.c" break; case 570: /* apache_stat: STARTLIMIT operator NUMBER PERCENT */ #line 2158 "src/p.y" { portset.parameters.apachestatus.startlimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.startlimit = (yyvsp[-1].number); } #line 5669 "src/y.tab.c" break; case 571: /* apache_stat: WAITLIMIT operator NUMBER PERCENT */ #line 2162 "src/p.y" { portset.parameters.apachestatus.waitlimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.waitlimit = (yyvsp[-1].number); } #line 5678 "src/y.tab.c" break; case 572: /* apache_stat: GRACEFULLIMIT operator NUMBER PERCENT */ #line 2166 "src/p.y" { portset.parameters.apachestatus.gracefullimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.gracefullimit = (yyvsp[-1].number); } #line 5687 "src/y.tab.c" break; case 573: /* apache_stat: CLEANUPLIMIT operator NUMBER PERCENT */ #line 2170 "src/p.y" { portset.parameters.apachestatus.cleanuplimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.cleanuplimit = (yyvsp[-1].number); } #line 5696 "src/y.tab.c" break; case 574: /* exist: IF NOT EXIST rate1 THEN action1 recovery_success */ #line 2176 "src/p.y" { addeventaction(&(nonexistset).action, (yyvsp[-1].number), (yyvsp[0].number)); addnonexist(&nonexistset); } #line 5705 "src/y.tab.c" break; case 575: /* exist: IF EXIST rate1 THEN action1 recovery_success */ #line 2180 "src/p.y" { addeventaction(&(existset).action, (yyvsp[-1].number), (yyvsp[0].number)); addexist(&existset); } #line 5714 "src/y.tab.c" break; case 576: /* pid: IF CHANGED PID rate1 THEN action1 */ #line 2187 "src/p.y" { addeventaction(&(pidset).action, (yyvsp[0].number), Action_Ignored); addpid(&pidset); } #line 5723 "src/y.tab.c" break; case 577: /* ppid: IF CHANGED PPID rate1 THEN action1 */ #line 2193 "src/p.y" { addeventaction(&(ppidset).action, (yyvsp[0].number), Action_Ignored); addppid(&ppidset); } #line 5732 "src/y.tab.c" break; case 578: /* uptime: IF UPTIME operator NUMBER time rate1 THEN action1 recovery_success */ #line 2199 "src/p.y" { uptimeset.operator = (yyvsp[-6].number); uptimeset.uptime = ((unsigned long long)(yyvsp[-5].number) * (yyvsp[-4].number)); addeventaction(&(uptimeset).action, (yyvsp[-1].number), (yyvsp[0].number)); adduptime(&uptimeset); } #line 5743 "src/y.tab.c" break; case 579: /* responsetime: RESPONSETIME operator NUMBER MILLISECOND */ #line 2207 "src/p.y" { responsetimeset.operator = (yyvsp[-2].number); responsetimeset.limit = (yyvsp[-1].number); } #line 5752 "src/y.tab.c" break; case 580: /* responsetime: RESPONSETIME operator NUMBER SECOND */ #line 2211 "src/p.y" { responsetimeset.operator = (yyvsp[-2].number); responsetimeset.limit = (yyvsp[-1].number) * 1000; } #line 5761 "src/y.tab.c" break; case 581: /* icmpcount: COUNT NUMBER */ #line 2217 "src/p.y" { icmpset.count = (yyvsp[0].number); } #line 5769 "src/y.tab.c" break; case 582: /* icmpsize: SIZE NUMBER */ #line 2222 "src/p.y" { icmpset.size = (yyvsp[0].number); if (icmpset.size < 8) { yyerror2("The minimum ping size is 8 bytes"); } else if (icmpset.size > 1492) { yyerror2("The maximum ping size is 1492 bytes"); } } #line 5782 "src/y.tab.c" break; case 583: /* icmptimeout: TIMEOUT NUMBER SECOND */ #line 2232 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else icmpset.timeout = (yyvsp[-1].number) * 1000; // timeout is in milliseconds internally } #line 5793 "src/y.tab.c" break; case 584: /* icmpoutgoing: ADDRESS STRING */ #line 2240 "src/p.y" { _parseOutgoingAddress((yyvsp[0].string), &(icmpset.outgoing)); } #line 5801 "src/y.tab.c" break; case 585: /* stoptimeout: %empty */ #line 2245 "src/p.y" { (yyval.number) = Run.limits.stopTimeout; } #line 5809 "src/y.tab.c" break; case 586: /* stoptimeout: TIMEOUT NUMBER SECOND */ #line 2248 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5820 "src/y.tab.c" break; case 587: /* starttimeout: %empty */ #line 2256 "src/p.y" { (yyval.number) = Run.limits.startTimeout; } #line 5828 "src/y.tab.c" break; case 588: /* starttimeout: TIMEOUT NUMBER SECOND */ #line 2259 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5839 "src/y.tab.c" break; case 589: /* restarttimeout: %empty */ #line 2267 "src/p.y" { (yyval.number) = Run.limits.restartTimeout; } #line 5847 "src/y.tab.c" break; case 590: /* restarttimeout: TIMEOUT NUMBER SECOND */ #line 2270 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5858 "src/y.tab.c" break; case 591: /* programtimeout: %empty */ #line 2278 "src/p.y" { (yyval.number) = Run.limits.programTimeout; } #line 5866 "src/y.tab.c" break; case 592: /* programtimeout: TIMEOUT NUMBER SECOND */ #line 2281 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5877 "src/y.tab.c" break; case 593: /* nettimeout: %empty */ #line 2289 "src/p.y" { (yyval.number) = Run.limits.networkTimeout; } #line 5885 "src/y.tab.c" break; case 594: /* nettimeout: TIMEOUT NUMBER SECOND */ #line 2292 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else (yyval.number) = (yyvsp[-1].number) * 1000; // net timeout is in milliseconds internally } #line 5896 "src/y.tab.c" break; case 595: /* connectiontimeout: TIMEOUT NUMBER SECOND */ #line 2300 "src/p.y" { if ((yyvsp[-1].number) <= 0) yyerror2("The timeout value must be > 0"); else portset.timeout = (yyvsp[-1].number) * 1000; // timeout is in milliseconds internally } #line 5907 "src/y.tab.c" break; case 596: /* retry: RETRY NUMBER */ #line 2308 "src/p.y" { portset.retry = (yyvsp[0].number); } #line 5915 "src/y.tab.c" break; case 597: /* actionrate: IF NUMBER RESTART NUMBER CYCLE THEN action1 */ #line 2313 "src/p.y" { actionrateset.count = (yyvsp[-5].number); actionrateset.cycle = (yyvsp[-3].number); addeventaction(&(actionrateset).action, (yyvsp[0].number), Action_Alert); addactionrate(&actionrateset); } #line 5926 "src/y.tab.c" break; case 598: /* actionrate: IF NUMBER RESTART NUMBER CYCLE THEN TIMEOUT */ #line 2319 "src/p.y" { actionrateset.count = (yyvsp[-5].number); actionrateset.cycle = (yyvsp[-3].number); addeventaction(&(actionrateset).action, Action_Unmonitor, Action_Alert); addactionrate(&actionrateset); } #line 5937 "src/y.tab.c" break; case 599: /* urloption: CONTENT urloperator STRING */ #line 2327 "src/p.y" { seturlrequest((yyvsp[-1].number), (yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 5946 "src/y.tab.c" break; case 600: /* urloperator: EQUAL */ #line 2333 "src/p.y" { (yyval.number) = Operator_Equal; } #line 5952 "src/y.tab.c" break; case 601: /* urloperator: NOTEQUAL */ #line 2334 "src/p.y" { (yyval.number) = Operator_NotEqual; } #line 5958 "src/y.tab.c" break; case 602: /* alert: alertmail formatlist reminder */ #line 2337 "src/p.y" { mailset.events = Event_All; addmail((yyvsp[-2].string), &mailset, ¤t->maillist); } #line 5967 "src/y.tab.c" break; case 603: /* alert: alertmail '{' eventoptionlist '}' formatlist reminder */ #line 2341 "src/p.y" { addmail((yyvsp[-5].string), &mailset, ¤t->maillist); } #line 5975 "src/y.tab.c" break; case 604: /* alert: alertmail NOT '{' eventoptionlist '}' formatlist reminder */ #line 2344 "src/p.y" { mailset.events = ~mailset.events; addmail((yyvsp[-6].string), &mailset, ¤t->maillist); } #line 5984 "src/y.tab.c" break; case 605: /* alert: noalertmail */ #line 2348 "src/p.y" { addmail((yyvsp[0].string), &mailset, ¤t->maillist); } #line 5992 "src/y.tab.c" break; case 606: /* alertmail: ALERT MAILADDR */ #line 2353 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 5998 "src/y.tab.c" break; case 607: /* noalertmail: NOALERT MAILADDR */ #line 2356 "src/p.y" { (yyval.string) = (yyvsp[0].string); } #line 6004 "src/y.tab.c" break; case 610: /* eventoption: ACTION */ #line 2363 "src/p.y" { mailset.events |= Event_Action; } #line 6010 "src/y.tab.c" break; case 611: /* eventoption: BYTEIN */ #line 2364 "src/p.y" { mailset.events |= Event_ByteIn; } #line 6016 "src/y.tab.c" break; case 612: /* eventoption: BYTEOUT */ #line 2365 "src/p.y" { mailset.events |= Event_ByteOut; } #line 6022 "src/y.tab.c" break; case 613: /* eventoption: CHECKSUM */ #line 2366 "src/p.y" { mailset.events |= Event_Checksum; } #line 6028 "src/y.tab.c" break; case 614: /* eventoption: CONNECTION */ #line 2367 "src/p.y" { mailset.events |= Event_Connection; } #line 6034 "src/y.tab.c" break; case 615: /* eventoption: CONTENT */ #line 2368 "src/p.y" { mailset.events |= Event_Content; } #line 6040 "src/y.tab.c" break; case 616: /* eventoption: DATA */ #line 2369 "src/p.y" { mailset.events |= Event_Data; } #line 6046 "src/y.tab.c" break; case 617: /* eventoption: EXEC */ #line 2370 "src/p.y" { mailset.events |= Event_Exec; } #line 6052 "src/y.tab.c" break; case 618: /* eventoption: EXIST */ #line 2371 "src/p.y" { mailset.events |= Event_Exist; } #line 6058 "src/y.tab.c" break; case 619: /* eventoption: FSFLAG */ #line 2372 "src/p.y" { mailset.events |= Event_FsFlag; } #line 6064 "src/y.tab.c" break; case 620: /* eventoption: GID */ #line 2373 "src/p.y" { mailset.events |= Event_Gid; } #line 6070 "src/y.tab.c" break; case 621: /* eventoption: ICMP */ #line 2374 "src/p.y" { mailset.events |= Event_Icmp; } #line 6076 "src/y.tab.c" break; case 622: /* eventoption: INSTANCE */ #line 2375 "src/p.y" { mailset.events |= Event_Instance; } #line 6082 "src/y.tab.c" break; case 623: /* eventoption: INVALID */ #line 2376 "src/p.y" { mailset.events |= Event_Invalid; } #line 6088 "src/y.tab.c" break; case 624: /* eventoption: LINK */ #line 2377 "src/p.y" { mailset.events |= Event_Link; } #line 6094 "src/y.tab.c" break; case 625: /* eventoption: NONEXIST */ #line 2378 "src/p.y" { mailset.events |= Event_NonExist; } #line 6100 "src/y.tab.c" break; case 626: /* eventoption: PACKETIN */ #line 2379 "src/p.y" { mailset.events |= Event_PacketIn; } #line 6106 "src/y.tab.c" break; case 627: /* eventoption: PACKETOUT */ #line 2380 "src/p.y" { mailset.events |= Event_PacketOut; } #line 6112 "src/y.tab.c" break; case 628: /* eventoption: PERMISSION */ #line 2381 "src/p.y" { mailset.events |= Event_Permission; } #line 6118 "src/y.tab.c" break; case 629: /* eventoption: PID */ #line 2382 "src/p.y" { mailset.events |= Event_Pid; } #line 6124 "src/y.tab.c" break; case 630: /* eventoption: PPID */ #line 2383 "src/p.y" { mailset.events |= Event_PPid; } #line 6130 "src/y.tab.c" break; case 631: /* eventoption: RESOURCE */ #line 2384 "src/p.y" { mailset.events |= Event_Resource; } #line 6136 "src/y.tab.c" break; case 632: /* eventoption: SATURATION */ #line 2385 "src/p.y" { mailset.events |= Event_Saturation; } #line 6142 "src/y.tab.c" break; case 633: /* eventoption: SIZE */ #line 2386 "src/p.y" { mailset.events |= Event_Size; } #line 6148 "src/y.tab.c" break; case 634: /* eventoption: SPEED */ #line 2387 "src/p.y" { mailset.events |= Event_Speed; } #line 6154 "src/y.tab.c" break; case 635: /* eventoption: STATUS */ #line 2388 "src/p.y" { mailset.events |= Event_Status; } #line 6160 "src/y.tab.c" break; case 636: /* eventoption: TIMEOUT */ #line 2389 "src/p.y" { mailset.events |= Event_Timeout; } #line 6166 "src/y.tab.c" break; case 637: /* eventoption: TIME */ #line 2390 "src/p.y" { mailset.events |= Event_Timestamp; } #line 6172 "src/y.tab.c" break; case 638: /* eventoption: UID */ #line 2391 "src/p.y" { mailset.events |= Event_Uid; } #line 6178 "src/y.tab.c" break; case 639: /* eventoption: UPTIME */ #line 2392 "src/p.y" { mailset.events |= Event_Uptime; } #line 6184 "src/y.tab.c" break; case 644: /* formatoption: MAILFROM ADDRESSOBJECT */ #line 2403 "src/p.y" { mailset.from = (yyvsp[-1].address); } #line 6190 "src/y.tab.c" break; case 645: /* formatoption: MAILREPLYTO ADDRESSOBJECT */ #line 2404 "src/p.y" { mailset.replyto = (yyvsp[-1].address); } #line 6196 "src/y.tab.c" break; case 646: /* formatoption: MAILSUBJECT */ #line 2405 "src/p.y" { mailset.subject = (yyvsp[0].string); } #line 6202 "src/y.tab.c" break; case 647: /* formatoption: MAILBODY */ #line 2406 "src/p.y" { mailset.message = (yyvsp[0].string); } #line 6208 "src/y.tab.c" break; case 648: /* every: EVERY NUMBER CYCLE */ #line 2409 "src/p.y" { _sanityCheckEveryStatement(current); current->every.type = Every_SkipCycles; current->every.spec.cycle.counter = current->every.spec.cycle.number = (yyvsp[-1].number); } #line 6218 "src/y.tab.c" break; case 649: /* every: EVERY TIMESPEC */ #line 2414 "src/p.y" { _sanityCheckEveryStatement(current); if (Time_incron((yyvsp[0].string), Time_now()) < 0) yyerror2("Invalid cron specification"); current->every.type = Every_Cron; current->every.spec.cron = (yyvsp[0].string); } #line 6230 "src/y.tab.c" break; case 650: /* every: NOTEVERY TIMESPEC */ #line 2421 "src/p.y" { _sanityCheckEveryStatement(current); if (Time_incron((yyvsp[0].string), Time_now()) < 0) yyerror2("Invalid cron specification"); current->every.type = Every_NotInCron; current->every.spec.cron = (yyvsp[0].string); } #line 6242 "src/y.tab.c" break; case 651: /* mode: MODE ACTIVE */ #line 2430 "src/p.y" { current->mode = Monitor_Active; } #line 6250 "src/y.tab.c" break; case 652: /* mode: MODE PASSIVE */ #line 2433 "src/p.y" { current->mode = Monitor_Passive; } #line 6258 "src/y.tab.c" break; case 653: /* mode: MODE MANUAL */ #line 2436 "src/p.y" { // Deprecated since monit 5.18 current->onreboot = Onreboot_Laststate; } #line 6267 "src/y.tab.c" break; case 654: /* onreboot: ONREBOOT START */ #line 2442 "src/p.y" { current->onreboot = Onreboot_Start; } #line 6275 "src/y.tab.c" break; case 655: /* onreboot: ONREBOOT NOSTART */ #line 2445 "src/p.y" { current->onreboot = Onreboot_Nostart; current->monitor = Monitor_Not; } #line 6284 "src/y.tab.c" break; case 656: /* onreboot: ONREBOOT LASTSTATE */ #line 2449 "src/p.y" { current->onreboot = Onreboot_Laststate; } #line 6292 "src/y.tab.c" break; case 657: /* group: GROUP STRINGNAME */ #line 2454 "src/p.y" { addservicegroup((yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 6301 "src/y.tab.c" break; case 659: /* hostgrouplist: hostgrouplist HOSTGROUPNAME */ #line 2461 "src/p.y" { addhostgroup((yyvsp[0].string)); } #line 6309 "src/y.tab.c" break; case 663: /* dependant: SERVICENAME */ #line 2474 "src/p.y" { adddependant((yyvsp[0].string)); } #line 6315 "src/y.tab.c" break; case 664: /* statusvalue: IF STATUS operator NUMBER rate1 THEN action1 recovery_success */ #line 2477 "src/p.y" { statusset.initialized = true; statusset.operator = (yyvsp[-5].number); statusset.return_value = (yyvsp[-4].number); addeventaction(&(statusset).action, (yyvsp[-1].number), (yyvsp[0].number)); addstatus(&statusset); } #line 6327 "src/y.tab.c" break; case 665: /* statusvalue: IF CHANGED STATUS rate1 THEN action1 */ #line 2484 "src/p.y" { statusset.initialized = false; statusset.operator = Operator_Changed; statusset.return_value = 0; addeventaction(&(statusset).action, (yyvsp[0].number), Action_Ignored); addstatus(&statusset); } #line 6339 "src/y.tab.c" break; case 666: /* resourceprocess: IF resourceprocesslist rate1 THEN action1 recovery_success */ #line 2493 "src/p.y" { addeventaction(&(resourceset).action, (yyvsp[-1].number), (yyvsp[0].number)); addresource(&resourceset); } #line 6348 "src/y.tab.c" break; case 676: /* resourcesystem: IF resourcesystemlist rate1 THEN action1 recovery_success */ #line 2512 "src/p.y" { addeventaction(&(resourceset).action, (yyvsp[-1].number), (yyvsp[0].number)); addresource(&resourceset); } #line 6357 "src/y.tab.c" break; case 683: /* resourcecpuproc: CPU operator value PERCENT */ #line 2528 "src/p.y" { resourceset.resource_id = Resource_CpuPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6367 "src/y.tab.c" break; case 684: /* resourcecpuproc: TOTALCPU operator value PERCENT */ #line 2533 "src/p.y" { resourceset.resource_id = Resource_CpuPercentTotal; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6377 "src/y.tab.c" break; case 685: /* resourcecpu: resourcecpuid operator value PERCENT */ #line 2540 "src/p.y" { resourceset.resource_id = (yyvsp[-3].number); resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6387 "src/y.tab.c" break; case 686: /* resourcecpuid: CPUUSER */ #line 2547 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuUser) (yyval.number) = Resource_CpuUser; else yywarning2("The CPU user usage statistics is not available on this system\n"); } #line 6398 "src/y.tab.c" break; case 687: /* resourcecpuid: CPUSYSTEM */ #line 2553 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuSystem) (yyval.number) = Resource_CpuSystem; else yywarning2("The CPU system usage statistics is not available on this system\n"); } #line 6409 "src/y.tab.c" break; case 688: /* resourcecpuid: CPUWAIT */ #line 2559 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuIOWait) (yyval.number) = Resource_CpuWait; else yywarning2("The CPU I/O wait usage statistics is not available on this system\n"); } #line 6420 "src/y.tab.c" break; case 689: /* resourcecpuid: CPUNICE */ #line 2565 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuNice) (yyval.number) = Resource_CpuNice; else yywarning2("The CPU nice usage statistics is not available on this system\n"); } #line 6431 "src/y.tab.c" break; case 690: /* resourcecpuid: CPUHARDIRQ */ #line 2571 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuHardIRQ) (yyval.number) = Resource_CpuHardIRQ; else yywarning2("The CPU hardware IRQ usage statistics is not available on this system\n"); } #line 6442 "src/y.tab.c" break; case 691: /* resourcecpuid: CPUSOFTIRQ */ #line 2577 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuSoftIRQ) (yyval.number) = Resource_CpuSoftIRQ; else yywarning2("The CPU software IRQ usage statistics is not available on this system\n"); } #line 6453 "src/y.tab.c" break; case 692: /* resourcecpuid: CPUSTEAL */ #line 2583 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuSteal) (yyval.number) = Resource_CpuSteal; else yywarning2("The CPU steal usage statistics is not available on this system\n"); } #line 6464 "src/y.tab.c" break; case 693: /* resourcecpuid: CPUGUEST */ #line 2589 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuGuest) (yyval.number) = Resource_CpuGuest; else yywarning2("The CPU guest usage statistics is not available on this system\n"); } #line 6475 "src/y.tab.c" break; case 694: /* resourcecpuid: CPUGUESTNICE */ #line 2595 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_CpuGuestNice) (yyval.number) = Resource_CpuGuestNice; else yywarning2("The CPU guest nice usage statistics is not available on this system\n"); } #line 6486 "src/y.tab.c" break; case 695: /* resourcecpuid: CPU */ #line 2601 "src/p.y" { (yyval.number) = Resource_CpuPercent; } #line 6494 "src/y.tab.c" break; case 696: /* resourcemem: MEMORY operator value unit */ #line 2606 "src/p.y" { resourceset.resource_id = Resource_MemoryKbyte; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 6504 "src/y.tab.c" break; case 697: /* resourcemem: MEMORY operator value PERCENT */ #line 2611 "src/p.y" { resourceset.resource_id = Resource_MemoryPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6514 "src/y.tab.c" break; case 698: /* resourcememproc: MEMORY operator value unit */ #line 2618 "src/p.y" { resourceset.resource_id = Resource_MemoryKbyte; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 6524 "src/y.tab.c" break; case 699: /* resourcememproc: MEMORY operator value PERCENT */ #line 2623 "src/p.y" { resourceset.resource_id = Resource_MemoryPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6534 "src/y.tab.c" break; case 700: /* resourcememproc: TOTALMEMORY operator value unit */ #line 2628 "src/p.y" { resourceset.resource_id = Resource_MemoryKbyteTotal; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 6544 "src/y.tab.c" break; case 701: /* resourcememproc: TOTALMEMORY operator value PERCENT */ #line 2633 "src/p.y" { resourceset.resource_id = Resource_MemoryPercentTotal; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6554 "src/y.tab.c" break; case 702: /* resourceswap: SWAP operator value unit */ #line 2640 "src/p.y" { resourceset.resource_id = Resource_SwapKbyte; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 6564 "src/y.tab.c" break; case 703: /* resourceswap: SWAP operator value PERCENT */ #line 2645 "src/p.y" { resourceset.resource_id = Resource_SwapPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6574 "src/y.tab.c" break; case 704: /* resourcethreads: THREADS operator NUMBER */ #line 2652 "src/p.y" { resourceset.resource_id = Resource_Threads; resourceset.operator = (yyvsp[-1].number); resourceset.limit = (yyvsp[0].number); } #line 6584 "src/y.tab.c" break; case 705: /* resourcechild: CHILDREN operator NUMBER */ #line 2659 "src/p.y" { resourceset.resource_id = Resource_Children; resourceset.operator = (yyvsp[-1].number); resourceset.limit = (yyvsp[0].number); } #line 6594 "src/y.tab.c" break; case 706: /* resourceload: resourceloadavg coremultiplier operator value */ #line 2666 "src/p.y" { switch ((yyvsp[-3].number)) { case Resource_LoadAverage1m: resourceset.resource_id = (yyvsp[-2].number) > 1 ? Resource_LoadAveragePerCore1m : (yyvsp[-3].number); break; case Resource_LoadAverage5m: resourceset.resource_id = (yyvsp[-2].number) > 1 ? Resource_LoadAveragePerCore5m : (yyvsp[-3].number); break; case Resource_LoadAverage15m: resourceset.resource_id = (yyvsp[-2].number) > 1 ? Resource_LoadAveragePerCore15m : (yyvsp[-3].number); break; default: resourceset.resource_id = (yyvsp[-3].number); break; } resourceset.operator = (yyvsp[-1].number); resourceset.limit = (yyvsp[0].real); } #line 6617 "src/y.tab.c" break; case 707: /* resourceloadavg: LOADAVG1 */ #line 2686 "src/p.y" { (yyval.number) = Resource_LoadAverage1m; } #line 6623 "src/y.tab.c" break; case 708: /* resourceloadavg: LOADAVG5 */ #line 2687 "src/p.y" { (yyval.number) = Resource_LoadAverage5m; } #line 6629 "src/y.tab.c" break; case 709: /* resourceloadavg: LOADAVG15 */ #line 2688 "src/p.y" { (yyval.number) = Resource_LoadAverage15m; } #line 6635 "src/y.tab.c" break; case 710: /* coremultiplier: %empty */ #line 2691 "src/p.y" { (yyval.number) = 1; } #line 6641 "src/y.tab.c" break; case 711: /* coremultiplier: CORE */ #line 2692 "src/p.y" { (yyval.number) = System_Info.cpu.count; } #line 6647 "src/y.tab.c" break; case 712: /* resourceread: READ operator value unit currenttime */ #line 2696 "src/p.y" { resourceset.resource_id = Resource_ReadBytes; resourceset.operator = (yyvsp[-3].number); resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number); } #line 6657 "src/y.tab.c" break; case 713: /* resourceread: DISK READ operator value unit currenttime */ #line 2701 "src/p.y" { resourceset.resource_id = Resource_ReadBytesPhysical; resourceset.operator = (yyvsp[-3].number); resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number); } #line 6667 "src/y.tab.c" break; case 714: /* resourceread: DISK READ operator NUMBER OPERATION */ #line 2706 "src/p.y" { resourceset.resource_id = Resource_ReadOperations; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].number); } #line 6677 "src/y.tab.c" break; case 715: /* resourcewrite: WRITE operator value unit currenttime */ #line 2713 "src/p.y" { resourceset.resource_id = Resource_WriteBytes; resourceset.operator = (yyvsp[-3].number); resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number); } #line 6687 "src/y.tab.c" break; case 716: /* resourcewrite: DISK WRITE operator value unit currenttime */ #line 2718 "src/p.y" { resourceset.resource_id = Resource_WriteBytesPhysical; resourceset.operator = (yyvsp[-3].number); resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number); } #line 6697 "src/y.tab.c" break; case 717: /* resourcewrite: DISK WRITE operator NUMBER OPERATION */ #line 2723 "src/p.y" { resourceset.resource_id = Resource_WriteOperations; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].number); } #line 6707 "src/y.tab.c" break; case 718: /* value: REAL */ #line 2730 "src/p.y" { (yyval.real) = (yyvsp[0].real); } #line 6713 "src/y.tab.c" break; case 719: /* value: NUMBER */ #line 2731 "src/p.y" { (yyval.real) = (float) (yyvsp[0].number); } #line 6719 "src/y.tab.c" break; case 720: /* timestamptype: TIME */ #line 2734 "src/p.y" { (yyval.number) = Timestamp_Default; } #line 6725 "src/y.tab.c" break; case 721: /* timestamptype: ATIME */ #line 2735 "src/p.y" { (yyval.number) = Timestamp_Access; } #line 6731 "src/y.tab.c" break; case 722: /* timestamptype: CTIME */ #line 2736 "src/p.y" { (yyval.number) = Timestamp_Change; } #line 6737 "src/y.tab.c" break; case 723: /* timestamptype: MTIME */ #line 2737 "src/p.y" { (yyval.number) = Timestamp_Modification; } #line 6743 "src/y.tab.c" break; case 724: /* timestamp: IF timestamptype operator NUMBER time rate1 THEN action1 recovery_success */ #line 2740 "src/p.y" { timestampset.type = (yyvsp[-7].number); timestampset.operator = (yyvsp[-6].number); timestampset.time = ((yyvsp[-5].number) * (yyvsp[-4].number)); addeventaction(&(timestampset).action, (yyvsp[-1].number), (yyvsp[0].number)); addtimestamp(×tampset); } #line 6755 "src/y.tab.c" break; case 725: /* timestamp: IF CHANGED timestamptype rate1 THEN action1 */ #line 2747 "src/p.y" { timestampset.type = (yyvsp[-3].number); timestampset.test_changes = true; addeventaction(&(timestampset).action, (yyvsp[0].number), Action_Ignored); addtimestamp(×tampset); } #line 6766 "src/y.tab.c" break; case 726: /* operator: %empty */ #line 2755 "src/p.y" { (yyval.number) = Operator_Equal; } #line 6772 "src/y.tab.c" break; case 727: /* operator: GREATER */ #line 2756 "src/p.y" { (yyval.number) = Operator_Greater; } #line 6778 "src/y.tab.c" break; case 728: /* operator: GREATEROREQUAL */ #line 2757 "src/p.y" { (yyval.number) = Operator_GreaterOrEqual; } #line 6784 "src/y.tab.c" break; case 729: /* operator: LESS */ #line 2758 "src/p.y" { (yyval.number) = Operator_Less; } #line 6790 "src/y.tab.c" break; case 730: /* operator: LESSOREQUAL */ #line 2759 "src/p.y" { (yyval.number) = Operator_LessOrEqual; } #line 6796 "src/y.tab.c" break; case 731: /* operator: EQUAL */ #line 2760 "src/p.y" { (yyval.number) = Operator_Equal; } #line 6802 "src/y.tab.c" break; case 732: /* operator: NOTEQUAL */ #line 2761 "src/p.y" { (yyval.number) = Operator_NotEqual; } #line 6808 "src/y.tab.c" break; case 733: /* operator: CHANGED */ #line 2762 "src/p.y" { (yyval.number) = Operator_Changed; } #line 6814 "src/y.tab.c" break; case 734: /* time: %empty */ #line 2765 "src/p.y" { (yyval.number) = Time_Second; } #line 6820 "src/y.tab.c" break; case 735: /* time: SECOND */ #line 2766 "src/p.y" { (yyval.number) = Time_Second; } #line 6826 "src/y.tab.c" break; case 736: /* time: MINUTE */ #line 2767 "src/p.y" { (yyval.number) = Time_Minute; } #line 6832 "src/y.tab.c" break; case 737: /* time: HOUR */ #line 2768 "src/p.y" { (yyval.number) = Time_Hour; } #line 6838 "src/y.tab.c" break; case 738: /* time: DAY */ #line 2769 "src/p.y" { (yyval.number) = Time_Day; } #line 6844 "src/y.tab.c" break; case 739: /* time: MONTH */ #line 2770 "src/p.y" { (yyval.number) = Time_Month; } #line 6850 "src/y.tab.c" break; case 740: /* totaltime: MINUTE */ #line 2773 "src/p.y" { (yyval.number) = Time_Minute; } #line 6856 "src/y.tab.c" break; case 741: /* totaltime: HOUR */ #line 2774 "src/p.y" { (yyval.number) = Time_Hour; } #line 6862 "src/y.tab.c" break; case 742: /* totaltime: DAY */ #line 2775 "src/p.y" { (yyval.number) = Time_Day; } #line 6868 "src/y.tab.c" break; case 743: /* currenttime: %empty */ #line 2777 "src/p.y" { (yyval.number) = Time_Second; } #line 6874 "src/y.tab.c" break; case 744: /* currenttime: SECOND */ #line 2778 "src/p.y" { (yyval.number) = Time_Second; } #line 6880 "src/y.tab.c" break; case 745: /* exectimeout: %empty */ #line 2781 "src/p.y" { timeout = Run.limits.execTimeout; } #line 6888 "src/y.tab.c" break; case 746: /* exectimeout: TIMEOUT NUMBER SECOND */ #line 2784 "src/p.y" { if ((yyvsp[0].number) < 0) { yyerror2("The timeout must be greater or equal to 0"); } timeout = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 6899 "src/y.tab.c" break; case 747: /* repeat: %empty */ #line 2792 "src/p.y" { repeat = 0; } #line 6907 "src/y.tab.c" break; case 748: /* repeat: REPEAT EVERY CYCLE */ #line 2795 "src/p.y" { repeat = 1; } #line 6915 "src/y.tab.c" break; case 749: /* repeat: REPEAT EVERY NUMBER CYCLE */ #line 2798 "src/p.y" { if ((yyvsp[-1].number) < 0) { yyerror2("The number of repeat cycles must be greater or equal to 0"); } repeat = (yyvsp[-1].number); } #line 6926 "src/y.tab.c" break; case 750: /* action: ALERT */ #line 2806 "src/p.y" { (yyval.number) = Action_Alert; } #line 6934 "src/y.tab.c" break; case 751: /* action: EXEC argumentlist exectimeout repeat */ #line 2809 "src/p.y" { (yyval.number) = Action_Exec; } #line 6942 "src/y.tab.c" break; case 752: /* action: EXEC argumentlist useroptionlist exectimeout repeat */ #line 2813 "src/p.y" { (yyval.number) = Action_Exec; } #line 6950 "src/y.tab.c" break; case 753: /* action: IGNORE */ #line 2816 "src/p.y" { (yyval.number) = Action_Ignored; } #line 6958 "src/y.tab.c" break; case 754: /* action: RESTART */ #line 2819 "src/p.y" { (yyval.number) = Action_Restart; } #line 6966 "src/y.tab.c" break; case 755: /* action: START */ #line 2822 "src/p.y" { (yyval.number) = Action_Start; } #line 6974 "src/y.tab.c" break; case 756: /* action: STOP */ #line 2825 "src/p.y" { (yyval.number) = Action_Stop; } #line 6982 "src/y.tab.c" break; case 757: /* action: UNMONITOR */ #line 2828 "src/p.y" { (yyval.number) = Action_Unmonitor; } #line 6990 "src/y.tab.c" break; case 758: /* action1: action */ #line 2833 "src/p.y" { (yyval.number) = (yyvsp[0].number); if ((yyvsp[0].number) == Action_Exec && command) { repeat1 = repeat; repeat = 0; command->timeout = timeout; timeout = 0; command1 = command; command = NULL; } } #line 7006 "src/y.tab.c" break; case 759: /* action2: action */ #line 2846 "src/p.y" { (yyval.number) = (yyvsp[0].number); if ((yyvsp[0].number) == Action_Exec && command) { repeat2 = repeat; repeat = 0; command->timeout = timeout; timeout = 0; command2 = command; command = NULL; } } #line 7022 "src/y.tab.c" break; case 760: /* rateXcycles: NUMBER CYCLE */ #line 2859 "src/p.y" { if ((yyvsp[-1].number) < 1 || (unsigned long)(yyvsp[-1].number) > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %zu", BITMAP_MAX); } else { rate.count = (yyvsp[-1].number); rate.cycles = (yyvsp[-1].number); } } #line 7035 "src/y.tab.c" break; case 761: /* rateXYcycles: NUMBER NUMBER CYCLE */ #line 2869 "src/p.y" { if ((yyvsp[-1].number) < 1 || (unsigned long)(yyvsp[-1].number) > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %zu", BITMAP_MAX); } else if ((yyvsp[-2].number) < 1 || (yyvsp[-2].number) > (yyvsp[-1].number)) { yyerror2("The number of events must be between 1 and less then poll cycles"); } else { rate.count = (yyvsp[-2].number); rate.cycles = (yyvsp[-1].number); } } #line 7050 "src/y.tab.c" break; case 763: /* rate1: rateXcycles */ #line 2882 "src/p.y" { rate1.count = rate.count; rate1.cycles = rate.cycles; reset_rateset(&rate); } #line 7060 "src/y.tab.c" break; case 764: /* rate1: rateXYcycles */ #line 2887 "src/p.y" { rate1.count = rate.count; rate1.cycles = rate.cycles; reset_rateset(&rate); } #line 7070 "src/y.tab.c" break; case 766: /* rate2: rateXcycles */ #line 2895 "src/p.y" { rate2.count = rate.count; rate2.cycles = rate.cycles; reset_rateset(&rate); } #line 7080 "src/y.tab.c" break; case 767: /* rate2: rateXYcycles */ #line 2900 "src/p.y" { rate2.count = rate.count; rate2.cycles = rate.cycles; reset_rateset(&rate); } #line 7090 "src/y.tab.c" break; case 768: /* recovery_success: %empty */ #line 2907 "src/p.y" { (yyval.number) = Action_Alert; } #line 7098 "src/y.tab.c" break; case 769: /* recovery_success: ELSE action2 */ #line 2910 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 7106 "src/y.tab.c" break; case 770: /* recovery_success: ELSE IF RECOVERED rate2 THEN action2 */ #line 2913 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 7114 "src/y.tab.c" break; case 771: /* recovery_success: ELSE IF PASSED rate2 THEN action2 */ #line 2916 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 7122 "src/y.tab.c" break; case 772: /* recovery_success: ELSE IF SUCCEEDED rate2 THEN action2 */ #line 2919 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 7130 "src/y.tab.c" break; case 773: /* recovery_failure: %empty */ #line 2924 "src/p.y" { (yyval.number) = Action_Alert; } #line 7138 "src/y.tab.c" break; case 774: /* recovery_failure: ELSE action2 */ #line 2927 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 7146 "src/y.tab.c" break; case 775: /* recovery_failure: ELSE IF FAILED rate2 THEN action2 */ #line 2930 "src/p.y" { (yyval.number) = (yyvsp[0].number); } #line 7154 "src/y.tab.c" break; case 776: /* checksum: IF FAILED hashtype CHECKSUM rate1 THEN action1 recovery_success */ #line 2935 "src/p.y" { addeventaction(&(checksumset).action, (yyvsp[-1].number), (yyvsp[0].number)); addchecksum(&checksumset); } #line 7163 "src/y.tab.c" break; case 777: /* checksum: IF FAILED hashtype CHECKSUM EXPECT STRING rate1 THEN action1 recovery_success */ #line 2940 "src/p.y" { snprintf(checksumset.hash, sizeof(checksumset.hash), "%s", (yyvsp[-4].string)); FREE((yyvsp[-4].string)); addeventaction(&(checksumset).action, (yyvsp[-1].number), (yyvsp[0].number)); addchecksum(&checksumset); } #line 7174 "src/y.tab.c" break; case 778: /* checksum: IF CHANGED hashtype CHECKSUM rate1 THEN action1 */ #line 2946 "src/p.y" { checksumset.test_changes = true; addeventaction(&(checksumset).action, (yyvsp[0].number), Action_Ignored); addchecksum(&checksumset); } #line 7184 "src/y.tab.c" break; case 779: /* hashtype: %empty */ #line 2952 "src/p.y" { checksumset.type = Hash_Unknown; } #line 7190 "src/y.tab.c" break; case 780: /* hashtype: MD5HASH */ #line 2953 "src/p.y" { checksumset.type = Hash_Md5; } #line 7196 "src/y.tab.c" break; case 781: /* hashtype: SHA1HASH */ #line 2954 "src/p.y" { checksumset.type = Hash_Sha1; } #line 7202 "src/y.tab.c" break; case 782: /* inode: IF INODE operator NUMBER rate1 THEN action1 recovery_success */ #line 2957 "src/p.y" { filesystemset.resource = Resource_Inode; filesystemset.operator = (yyvsp[-5].number); filesystemset.limit_absolute = (yyvsp[-4].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7214 "src/y.tab.c" break; case 783: /* inode: IF INODE operator value PERCENT rate1 THEN action1 recovery_success */ #line 2964 "src/p.y" { filesystemset.resource = Resource_Inode; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_percent = (yyvsp[-5].real); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7226 "src/y.tab.c" break; case 784: /* inode: IF INODE TFREE operator NUMBER rate1 THEN action1 recovery_success */ #line 2971 "src/p.y" { filesystemset.resource = Resource_InodeFree; filesystemset.operator = (yyvsp[-5].number); filesystemset.limit_absolute = (yyvsp[-4].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7238 "src/y.tab.c" break; case 785: /* inode: IF INODE TFREE operator value PERCENT rate1 THEN action1 recovery_success */ #line 2978 "src/p.y" { filesystemset.resource = Resource_InodeFree; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_percent = (yyvsp[-5].real); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7250 "src/y.tab.c" break; case 786: /* space: IF SPACE operator value unit rate1 THEN action1 recovery_success */ #line 2987 "src/p.y" { filesystemset.resource = Resource_Space; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_absolute = (yyvsp[-5].real) * (yyvsp[-4].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7262 "src/y.tab.c" break; case 787: /* space: IF SPACE operator value PERCENT rate1 THEN action1 recovery_success */ #line 2994 "src/p.y" { filesystemset.resource = Resource_Space; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_percent = (yyvsp[-5].real); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7274 "src/y.tab.c" break; case 788: /* space: IF SPACE TFREE operator value unit rate1 THEN action1 recovery_success */ #line 3001 "src/p.y" { filesystemset.resource = Resource_SpaceFree; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_absolute = (yyvsp[-5].real) * (yyvsp[-4].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7286 "src/y.tab.c" break; case 789: /* space: IF SPACE TFREE operator value PERCENT rate1 THEN action1 recovery_success */ #line 3008 "src/p.y" { filesystemset.resource = Resource_SpaceFree; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_percent = (yyvsp[-5].real); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7298 "src/y.tab.c" break; case 790: /* read: IF READ operator value unit currenttime rate1 THEN action1 recovery_success */ #line 3017 "src/p.y" { filesystemset.resource = Resource_ReadBytes; filesystemset.operator = (yyvsp[-7].number); filesystemset.limit_absolute = (yyvsp[-6].real) * (yyvsp[-5].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7310 "src/y.tab.c" break; case 791: /* read: IF READ operator NUMBER OPERATION rate1 THEN action1 recovery_success */ #line 3024 "src/p.y" { filesystemset.resource = Resource_ReadOperations; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_absolute = (yyvsp[-5].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7322 "src/y.tab.c" break; case 792: /* write: IF WRITE operator value unit currenttime rate1 THEN action1 recovery_success */ #line 3033 "src/p.y" { filesystemset.resource = Resource_WriteBytes; filesystemset.operator = (yyvsp[-7].number); filesystemset.limit_absolute = (yyvsp[-6].real) * (yyvsp[-5].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7334 "src/y.tab.c" break; case 793: /* write: IF WRITE operator NUMBER OPERATION rate1 THEN action1 recovery_success */ #line 3040 "src/p.y" { filesystemset.resource = Resource_WriteOperations; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_absolute = (yyvsp[-5].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7346 "src/y.tab.c" break; case 794: /* servicetime: IF SERVICETIME operator NUMBER MILLISECOND rate1 THEN action1 recovery_success */ #line 3049 "src/p.y" { filesystemset.resource = Resource_ServiceTime; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_absolute = (yyvsp[-5].number); addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7358 "src/y.tab.c" break; case 795: /* servicetime: IF SERVICETIME operator value SECOND rate1 THEN action1 recovery_success */ #line 3056 "src/p.y" { filesystemset.resource = Resource_ServiceTime; filesystemset.operator = (yyvsp[-6].number); filesystemset.limit_absolute = (yyvsp[-5].real) * 1000; addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number)); addfilesystem(&filesystemset); } #line 7370 "src/y.tab.c" break; case 796: /* fsflag: IF CHANGED FSFLAG rate1 THEN action1 */ #line 3065 "src/p.y" { addeventaction(&(fsflagset).action, (yyvsp[0].number), Action_Ignored); addfsflag(&fsflagset); } #line 7379 "src/y.tab.c" break; case 797: /* unit: %empty */ #line 3071 "src/p.y" { (yyval.number64) = Unit_Byte; } #line 7385 "src/y.tab.c" break; case 798: /* unit: BYTE */ #line 3072 "src/p.y" { (yyval.number64) = Unit_Byte; } #line 7391 "src/y.tab.c" break; case 799: /* unit: KILOBYTE */ #line 3073 "src/p.y" { (yyval.number64) = Unit_Kilobyte; } #line 7397 "src/y.tab.c" break; case 800: /* unit: MEGABYTE */ #line 3074 "src/p.y" { (yyval.number64) = Unit_Megabyte; } #line 7403 "src/y.tab.c" break; case 801: /* unit: GIGABYTE */ #line 3075 "src/p.y" { (yyval.number64) = Unit_Gigabyte; } #line 7409 "src/y.tab.c" break; case 802: /* permission: IF FAILED PERMISSION NUMBER rate1 THEN action1 recovery_success */ #line 3078 "src/p.y" { permset.perm = check_perm((yyvsp[-4].number)); addeventaction(&(permset).action, (yyvsp[-1].number), (yyvsp[0].number)); addperm(&permset); } #line 7419 "src/y.tab.c" break; case 803: /* permission: IF CHANGED PERMISSION rate1 THEN action1 recovery_success */ #line 3083 "src/p.y" { permset.test_changes = true; addeventaction(&(permset).action, (yyvsp[-1].number), Action_Ignored); addperm(&permset); } #line 7429 "src/y.tab.c" break; case 804: /* programmatch: IF CONTENT urloperator STRING rate1 THEN action1 */ #line 3090 "src/p.y" { matchset.not = (yyvsp[-4].number) == Operator_Equal ? false : true; matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = (yyvsp[-3].string); addmatch(&matchset, (yyvsp[0].number), 0); } #line 7441 "src/y.tab.c" break; case 805: /* programmatch: IF CONTENT CHANGED rate1 THEN action1 recovery_success */ #line 3097 "src/p.y" { addoutputchange(false, (yyvsp[-1].number), (yyvsp[0].number)); } #line 7449 "src/y.tab.c" break; case 806: /* programmatch: IF CONTENT NOT CHANGED rate1 THEN action1 recovery_success */ #line 3100 "src/p.y" { addoutputchange(true, (yyvsp[-1].number), (yyvsp[0].number)); } #line 7457 "src/y.tab.c" break; case 807: /* match: IF CONTENT urloperator PATH rate1 THEN action1 */ #line 3105 "src/p.y" { matchset.not = (yyvsp[-4].number) == Operator_Equal ? false : true; matchset.ignore = false; matchset.match_path = (yyvsp[-3].string); matchset.match_string = NULL; addmatchpath(&matchset, (yyvsp[0].number)); FREE((yyvsp[-3].string)); } #line 7470 "src/y.tab.c" break; case 808: /* match: IF CONTENT urloperator STRING rate1 THEN action1 */ #line 3113 "src/p.y" { matchset.not = (yyvsp[-4].number) == Operator_Equal ? false : true; matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = (yyvsp[-3].string); addmatch(&matchset, (yyvsp[0].number), 0); } #line 7482 "src/y.tab.c" break; case 809: /* match: IGNORE CONTENT urloperator PATH */ #line 3120 "src/p.y" { matchset.not = (yyvsp[-1].number) == Operator_Equal ? false : true; matchset.ignore = true; matchset.match_path = (yyvsp[0].string); matchset.match_string = NULL; addmatchpath(&matchset, Action_Ignored); FREE((yyvsp[0].string)); } #line 7495 "src/y.tab.c" break; case 810: /* match: IGNORE CONTENT urloperator STRING */ #line 3128 "src/p.y" { matchset.not = (yyvsp[-1].number) == Operator_Equal ? false : true; matchset.ignore = true; matchset.match_path = NULL; matchset.match_string = (yyvsp[0].string); addmatch(&matchset, Action_Ignored, 0); } #line 7507 "src/y.tab.c" break; case 811: /* match: IF matchflagnot MATCH PATH rate1 THEN action1 */ #line 3136 "src/p.y" { matchset.ignore = false; matchset.match_path = (yyvsp[-3].string); matchset.match_string = NULL; addmatchpath(&matchset, (yyvsp[0].number)); FREE((yyvsp[-3].string)); } #line 7519 "src/y.tab.c" break; case 812: /* match: IF matchflagnot MATCH STRING rate1 THEN action1 */ #line 3143 "src/p.y" { matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = (yyvsp[-3].string); addmatch(&matchset, (yyvsp[0].number), 0); } #line 7530 "src/y.tab.c" break; case 813: /* match: IGNORE matchflagnot MATCH PATH */ #line 3149 "src/p.y" { matchset.ignore = true; matchset.match_path = (yyvsp[0].string); matchset.match_string = NULL; addmatchpath(&matchset, Action_Ignored); FREE((yyvsp[0].string)); } #line 7542 "src/y.tab.c" break; case 814: /* match: IGNORE matchflagnot MATCH STRING */ #line 3156 "src/p.y" { matchset.ignore = true; matchset.match_path = NULL; matchset.match_string = (yyvsp[0].string); addmatch(&matchset, Action_Ignored, 0); } #line 7553 "src/y.tab.c" break; case 815: /* matchflagnot: %empty */ #line 3164 "src/p.y" { matchset.not = false; } #line 7561 "src/y.tab.c" break; case 816: /* matchflagnot: NOT */ #line 3167 "src/p.y" { matchset.not = true; } #line 7569 "src/y.tab.c" break; case 817: /* size: IF SIZE operator NUMBER unit rate1 THEN action1 recovery_success */ #line 3173 "src/p.y" { sizeset.operator = (yyvsp[-6].number); sizeset.size = ((unsigned long long)(yyvsp[-5].number) * (yyvsp[-4].number)); addeventaction(&(sizeset).action, (yyvsp[-1].number), (yyvsp[0].number)); addsize(&sizeset); } #line 7580 "src/y.tab.c" break; case 818: /* size: IF CHANGED SIZE rate1 THEN action1 */ #line 3179 "src/p.y" { sizeset.test_changes = true; addeventaction(&(sizeset).action, (yyvsp[0].number), Action_Ignored); addsize(&sizeset); } #line 7590 "src/y.tab.c" break; case 819: /* hardlink: IF HARDLINK operator NUMBER rate1 THEN action1 recovery_success */ #line 3186 "src/p.y" { nlinkset.operator = (yyvsp[-5].number); nlinkset.nlink = ((unsigned long long)(yyvsp[-4].number)); addeventaction(&(nlinkset).action, (yyvsp[-1].number), (yyvsp[0].number)); addnlink(&nlinkset); } #line 7601 "src/y.tab.c" break; case 820: /* hardlink: IF CHANGED HARDLINK rate1 THEN action1 */ #line 3192 "src/p.y" { nlinkset.test_changes = true; addeventaction(&(nlinkset).action, (yyvsp[0].number), Action_Ignored); addnlink(&nlinkset); } #line 7611 "src/y.tab.c" break; case 821: /* uid: IF FAILED UID STRING rate1 THEN action1 recovery_success */ #line 3200 "src/p.y" { uidset.uid = get_uid((yyvsp[-4].string), 0); addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->uid = adduid(&uidset); FREE((yyvsp[-4].string)); } #line 7622 "src/y.tab.c" break; case 822: /* uid: IF FAILED UID NUMBER rate1 THEN action1 recovery_success */ #line 3206 "src/p.y" { uidset.uid = get_uid(NULL, (yyvsp[-4].number)); addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->uid = adduid(&uidset); } #line 7632 "src/y.tab.c" break; case 823: /* euid: IF FAILED EUID STRING rate1 THEN action1 recovery_success */ #line 3213 "src/p.y" { uidset.uid = get_uid((yyvsp[-4].string), 0); addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->euid = adduid(&uidset); FREE((yyvsp[-4].string)); } #line 7643 "src/y.tab.c" break; case 824: /* euid: IF FAILED EUID NUMBER rate1 THEN action1 recovery_success */ #line 3219 "src/p.y" { uidset.uid = get_uid(NULL, (yyvsp[-4].number)); addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->euid = adduid(&uidset); } #line 7653 "src/y.tab.c" break; case 825: /* secattr: IF FAILED SECURITY ATTRIBUTE STRING rate1 THEN action1 recovery_success */ #line 3226 "src/p.y" { addsecurityattribute((yyvsp[-4].string), (yyvsp[-1].number), (yyvsp[0].number)); } #line 7661 "src/y.tab.c" break; case 826: /* secattr: IF FAILED SECURITY ATTRIBUTE PATH rate1 THEN action1 recovery_success */ #line 3229 "src/p.y" { addsecurityattribute((yyvsp[-4].string), (yyvsp[-1].number), (yyvsp[0].number)); } #line 7669 "src/y.tab.c" break; case 827: /* filedescriptorssystem: IF FILEDESCRIPTORS operator NUMBER rate1 THEN action1 recovery_success */ #line 3234 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem) addfiledescriptors((yyvsp[-5].number), false, (long long)(yyvsp[-4].number), -1., (yyvsp[-1].number), (yyvsp[0].number)); else yywarning("The per-system filedescriptors statistics is not available on this system\n"); } #line 7680 "src/y.tab.c" break; case 828: /* filedescriptorssystem: IF FILEDESCRIPTORS operator value PERCENT rate1 THEN action1 recovery_success */ #line 3240 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem) addfiledescriptors((yyvsp[-6].number), false, -1LL, (yyvsp[-5].real), (yyvsp[-1].number), (yyvsp[0].number)); else yywarning("The per-system filedescriptors statistics is not available on this system\n"); } #line 7691 "src/y.tab.c" break; case 829: /* filedescriptorsprocess: IF FILEDESCRIPTORS operator NUMBER rate1 THEN action1 recovery_success */ #line 3248 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcess) addfiledescriptors((yyvsp[-5].number), false, (long long)(yyvsp[-4].number), -1., (yyvsp[-1].number), (yyvsp[0].number)); else yywarning("The per-process filedescriptors statistics is not available on this system\n"); } #line 7702 "src/y.tab.c" break; case 830: /* filedescriptorsprocess: IF FILEDESCRIPTORS operator value PERCENT rate1 THEN action1 recovery_success */ #line 3254 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcessMax) addfiledescriptors((yyvsp[-6].number), false, -1LL, (yyvsp[-5].real), (yyvsp[-1].number), (yyvsp[0].number)); else yywarning("The per-process filedescriptors maximum is not exposed on this system, so we cannot compute usage %%, please use the test with absolute value\n"); } #line 7713 "src/y.tab.c" break; case 831: /* filedescriptorsprocesstotal: IF TOTAL FILEDESCRIPTORS operator NUMBER rate1 THEN action1 recovery_success */ #line 3262 "src/p.y" { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcess) addfiledescriptors((yyvsp[-5].number), true, (long long)(yyvsp[-4].number), -1., (yyvsp[-1].number), (yyvsp[0].number)); else yywarning("The per-process filedescriptors statistics is not available on this system\n"); } #line 7724 "src/y.tab.c" break; case 832: /* gid: IF FAILED GID STRING rate1 THEN action1 recovery_success */ #line 3270 "src/p.y" { gidset.gid = get_gid((yyvsp[-4].string), 0); addeventaction(&(gidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->gid = addgid(&gidset); FREE((yyvsp[-4].string)); } #line 7735 "src/y.tab.c" break; case 833: /* gid: IF FAILED GID NUMBER rate1 THEN action1 recovery_success */ #line 3276 "src/p.y" { gidset.gid = get_gid(NULL, (yyvsp[-4].number)); addeventaction(&(gidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->gid = addgid(&gidset); } #line 7745 "src/y.tab.c" break; case 834: /* linkstatus: IF FAILED LINK rate1 THEN action1 recovery_success */ #line 3283 "src/p.y" { /* Deprecated */ addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinkstatus(current, &linkstatusset); } #line 7754 "src/y.tab.c" break; case 835: /* linkstatus: IF LINK DOWN rate1 THEN action1 recovery_success */ #line 3287 "src/p.y" { linkstatusset.check_invers = false; addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinkstatus(current, &linkstatusset); } #line 7764 "src/y.tab.c" break; case 836: /* linkstatus: IF LINK UP rate1 THEN action1 recovery_failure */ #line 3292 "src/p.y" { linkstatusset.check_invers = true; addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinkstatus(current, &linkstatusset); } #line 7774 "src/y.tab.c" break; case 837: /* linkspeed: IF CHANGED LINK rate1 THEN action1 recovery_success */ #line 3299 "src/p.y" { addeventaction(&(linkspeedset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinkspeed(current, &linkspeedset); } #line 7783 "src/y.tab.c" break; case 838: /* linksaturation: IF SATURATION operator NUMBER PERCENT rate1 THEN action1 recovery_success */ #line 3304 "src/p.y" { linksaturationset.operator = (yyvsp[-6].number); linksaturationset.limit = (unsigned long long)(yyvsp[-5].number); addeventaction(&(linksaturationset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinksaturation(current, &linksaturationset); } #line 7794 "src/y.tab.c" break; case 839: /* upload: IF UPLOAD operator NUMBER unit currenttime rate1 THEN action1 recovery_success */ #line 3312 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number)); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->uploadbyteslist), &bandwidthset); } #line 7807 "src/y.tab.c" break; case 840: /* upload: IF TOTAL UPLOAD operator NUMBER unit totaltime rate1 THEN action1 recovery_success */ #line 3320 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number)); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->uploadbyteslist), &bandwidthset); } #line 7820 "src/y.tab.c" break; case 841: /* upload: IF TOTAL UPLOAD operator NUMBER unit NUMBER totaltime rate1 THEN action1 recovery_success */ #line 3328 "src/p.y" { bandwidthset.operator = (yyvsp[-8].number); bandwidthset.limit = ((unsigned long long)(yyvsp[-7].number) * (yyvsp[-6].number)); bandwidthset.rangecount = (yyvsp[-5].number); bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->uploadbyteslist), &bandwidthset); } #line 7833 "src/y.tab.c" break; case 842: /* upload: IF UPLOAD operator NUMBER PACKET currenttime rate1 THEN action1 recovery_success */ #line 3336 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = (unsigned long long)(yyvsp[-6].number); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->uploadpacketslist), &bandwidthset); } #line 7846 "src/y.tab.c" break; case 843: /* upload: IF TOTAL UPLOAD operator NUMBER PACKET totaltime rate1 THEN action1 recovery_success */ #line 3344 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = (unsigned long long)(yyvsp[-6].number); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->uploadpacketslist), &bandwidthset); } #line 7859 "src/y.tab.c" break; case 844: /* upload: IF TOTAL UPLOAD operator NUMBER PACKET NUMBER totaltime rate1 THEN action1 recovery_success */ #line 3352 "src/p.y" { bandwidthset.operator = (yyvsp[-8].number); bandwidthset.limit = (unsigned long long)(yyvsp[-7].number); bandwidthset.rangecount = (yyvsp[-5].number); bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->uploadpacketslist), &bandwidthset); } #line 7872 "src/y.tab.c" break; case 845: /* download: IF DOWNLOAD operator NUMBER unit currenttime rate1 THEN action1 recovery_success */ #line 3362 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number)); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->downloadbyteslist), &bandwidthset); } #line 7885 "src/y.tab.c" break; case 846: /* download: IF TOTAL DOWNLOAD operator NUMBER unit totaltime rate1 THEN action1 recovery_success */ #line 3370 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number)); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->downloadbyteslist), &bandwidthset); } #line 7898 "src/y.tab.c" break; case 847: /* download: IF TOTAL DOWNLOAD operator NUMBER unit NUMBER totaltime rate1 THEN action1 recovery_success */ #line 3378 "src/p.y" { bandwidthset.operator = (yyvsp[-8].number); bandwidthset.limit = ((unsigned long long)(yyvsp[-7].number) * (yyvsp[-6].number)); bandwidthset.rangecount = (yyvsp[-5].number); bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->downloadbyteslist), &bandwidthset); } #line 7911 "src/y.tab.c" break; case 848: /* download: IF DOWNLOAD operator NUMBER PACKET currenttime rate1 THEN action1 recovery_success */ #line 3386 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = (unsigned long long)(yyvsp[-6].number); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->downloadpacketslist), &bandwidthset); } #line 7924 "src/y.tab.c" break; case 849: /* download: IF TOTAL DOWNLOAD operator NUMBER PACKET totaltime rate1 THEN action1 recovery_success */ #line 3394 "src/p.y" { bandwidthset.operator = (yyvsp[-7].number); bandwidthset.limit = (unsigned long long)(yyvsp[-6].number); bandwidthset.rangecount = 1; bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->downloadpacketslist), &bandwidthset); } #line 7937 "src/y.tab.c" break; case 850: /* download: IF TOTAL DOWNLOAD operator NUMBER PACKET NUMBER totaltime rate1 THEN action1 recovery_success */ #line 3402 "src/p.y" { bandwidthset.operator = (yyvsp[-8].number); bandwidthset.limit = (unsigned long long)(yyvsp[-7].number); bandwidthset.rangecount = (yyvsp[-5].number); bandwidthset.range = (yyvsp[-4].number); addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number)); addbandwidth(&(current->downloadpacketslist), &bandwidthset); } #line 7950 "src/y.tab.c" break; case 851: /* icmptype: TYPE ICMPECHO */ #line 3412 "src/p.y" { (yyval.number) = ICMP_ECHO; } #line 7956 "src/y.tab.c" break; case 852: /* reminder: %empty */ #line 3415 "src/p.y" { mailset.reminder = 0; } #line 7962 "src/y.tab.c" break; case 853: /* reminder: REMINDER NUMBER */ #line 3416 "src/p.y" { mailset.reminder = (yyvsp[0].number); } #line 7968 "src/y.tab.c" break; case 854: /* reminder: REMINDER NUMBER CYCLE */ #line 3417 "src/p.y" { mailset.reminder = (yyvsp[-1].number); } #line 7974 "src/y.tab.c" break; #line 7978 "src/y.tab.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; const int yyi = yypgoto[yylhs] + *yyssp; yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; yyerror (YY_("syntax error")); } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYSYMBOL_YYerror; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", YY_ACCESSING_SYMBOL (yystate), yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturnlab; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturnlab; /*-----------------------------------------------------------. | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | `-----------------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; goto yyreturnlab; /*----------------------------------------------------------. | yyreturnlab -- parsing is finished, clean up and return. | `----------------------------------------------------------*/ yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 3420 "src/p.y" /* -------------------------------------------------------- Parser interface */ /** * Syntactic error routine * * This routine is automatically called by the lexer! */ void yyerror(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_error("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext); cfg_errflag++; FREE(msg); } /** * Syntactical warning routine */ void yywarning(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_warning("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext); FREE(msg); } /** * Argument error routine */ void yyerror2(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_error("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext); cfg_errflag++; FREE(msg); } /** * Argument warning routine */ void yywarning2(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_warning("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext); FREE(msg); } /* * The Parser hook - start parsing the control file * Returns true if parsing succeeded, otherwise false */ bool parse(char *controlfile) { assert(controlfile); if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) { Log_error("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR); return false; } currentfile = Str_dup(controlfile); available_statistics(&System_Info); /* * Creation of the global service list is synchronized */ LOCK(Run.mutex) { preparse(); yyparse(); fclose(yyin); postparse(); } END_LOCK; FREE(currentfile); if (argyytext != NULL) FREE(argyytext); /* * Secure check the monitrc file. The run control file must have the * same uid as the REAL uid of this process, it must have permissions * no greater than 700 and it must not be a symbolic link. */ if (! file_checkStat(controlfile, "control file", S_IRUSR|S_IWUSR|S_IXUSR)) return false; return cfg_errflag == 0; } /* ----------------------------------------------------------------- Private */ /** * Initialize objects used by the parser. */ static void preparse(void) { Service_List = tail = current = NULL; /* Set instance incarnation ID */ time(&Run.incarnation); /* Reset lexer */ buffer_stack_ptr = 0; lineno = 1; arglineno = 1; argcurrentfile = NULL; argyytext = NULL; /* Reset parser */ Run.limits.sendExpectBuffer = LIMIT_SENDEXPECTBUFFER; Run.limits.fileContentBuffer = LIMIT_FILECONTENTBUFFER; Run.limits.httpContentBuffer = LIMIT_HTTPCONTENTBUFFER; Run.limits.programOutput = LIMIT_PROGRAMOUTPUT; Run.limits.networkTimeout = LIMIT_NETWORKTIMEOUT; Run.limits.programTimeout = LIMIT_PROGRAMTIMEOUT; Run.limits.stopTimeout = LIMIT_STOPTIMEOUT; Run.limits.startTimeout = LIMIT_STARTTIMEOUT; Run.limits.restartTimeout = LIMIT_RESTARTTIMEOUT; Run.limits.execTimeout = LIMIT_EXECTIMEOUT; Run.onreboot = Onreboot_Start; Run.mmonitcredentials = NULL; Run.httpd.flags = Httpd_Disabled | Httpd_Signature; Run.httpd.credentials = NULL; memset(&(Run.httpd.socket), 0, sizeof(Run.httpd.socket)); Run.mailserver_timeout = SMTP_TIMEOUT; Run.eventlist_dir = NULL; Run.eventlist_slots = -1; Run.system = NULL; Run.mmonits = NULL; Run.maillist = NULL; Run.mailservers = NULL; Run.MailFormat.from = NULL; Run.MailFormat.replyto = NULL; Run.MailFormat.subject = NULL; Run.MailFormat.message = NULL; depend_list = NULL; Run.flags |= Run_HandlerInit | Run_MmonitCredentials; for (int i = 0; i <= Handler_Max; i++) Run.handler_queue[i] = 0; /* * Initialize objects */ reset_uidset(); reset_gidset(); reset_statusset(); reset_sizeset(); reset_nlinkset(); reset_mailset(); reset_sslset(); reset_mailserverset(); reset_mmonitset(); reset_responsetimeset(); reset_portset(); reset_permset(); reset_icmpset(); reset_linkstatusset(); reset_linkspeedset(); reset_linksaturationset(); reset_bandwidthset(); reset_rateset(&rate); reset_rateset(&rate1); reset_rateset(&rate2); reset_filesystemset(); reset_resourceset(); reset_checksumset(); reset_timestampset(); reset_actionrateset(); } /* * Check that values are reasonable after parsing */ static void postparse(void) { if (cfg_errflag) return; /* If defined - add the last service to the service list */ if (current) { addservice(current); current = NULL; } /* Check that we do not start monit in daemon mode without having a poll time */ if (Run.polltime <= 0 && ((Run.flags & Run_Daemon) || (Run.flags & Run_Foreground))) { Log_error("Poll time is invalid or not defined. Please define poll time in the control file\nas a number (> 0) or use the -d option when starting monit\n"); cfg_errflag++; } if (Run.files.log) Run.flags |= Run_Log; /* Add the default general system service if not specified explicitly: service name default to hostname */ if (! Run.system) { char hostname[STRLEN]; if (gethostname(hostname, sizeof(hostname))) { Log_error("Cannot get system hostname -- please add 'check system '\n"); cfg_errflag++; } if (Util_existService(hostname)) { Log_error("'check system' not defined in control file, failed to add automatic configuration (service name %s is used already) -- please add 'check system ' manually\n", hostname); cfg_errflag++; } Run.system = createservice(Service_System, Str_dup(hostname), NULL, check_system); addservice(Run.system); } addeventaction(&(Run.system->action_MONIT_START), Action_Start, Action_Ignored); addeventaction(&(Run.system->action_MONIT_STOP), Action_Stop, Action_Ignored); if (Run.mmonits) { if (Run.httpd.flags & Httpd_Net) { if (Run.flags & Run_MmonitCredentials) { Auth_T c; for (c = Run.httpd.credentials; c; c = c->next) { if (c->digesttype == Digest_Cleartext && ! c->is_readonly) { Run.mmonitcredentials = c; break; } } if (! Run.mmonitcredentials) Log_warning("M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n"); } } else if (Run.httpd.flags & Httpd_Unix) { Log_warning("M/Monit enabled but Monit httpd is using unix socket -- please change 'set httpd' statement to use TCP port in order to be able to manage services on Monit\n"); } else { Log_warning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n"); } } /* Check the sanity of any dependency graph */ check_depend(); #if defined HAVE_OPENSSL && defined OPENSSL_FIPS Ssl_setFipsMode(Run.flags & Run_FipsEnabled); #endif Processor_setHttpPostLimit(); } static bool _parseOutgoingAddress(char *ip, Outgoing_T *outgoing) { struct addrinfo *result, hints = {.ai_flags = AI_NUMERICHOST}; int status = getaddrinfo(ip, NULL, &hints, &result); if (status == 0) { outgoing->ip = ip; outgoing->addrlen = result->ai_addrlen; memcpy(&(outgoing->addr), result->ai_addr, result->ai_addrlen); freeaddrinfo(result); return true; } else { yyerror2("IP address parsing failed for %s -- %s", ip, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); } return false; } /* * Create a new service object and add any current objects to the * service list. */ static Service_T createservice(Service_Type type, char *name, char *value, State_Type (*check)(Service_T s)) { assert(name); check_name(name); if (current) addservice(current); NEW(current); current->type = type; switch (type) { case Service_Directory: NEW(current->inf.directory); break; case Service_Fifo: NEW(current->inf.fifo); break; case Service_File: NEW(current->inf.file); break; case Service_Filesystem: NEW(current->inf.filesystem); break; case Service_Net: NEW(current->inf.net); break; case Service_Process: NEW(current->inf.process); break; default: break; } Util_resetInfo(current); if (type == Service_Program) { NEW(current->program); current->program->args = command; command = NULL; current->program->timeout = Run.limits.programTimeout; } /* Set default values */ current->onrebootRestored = false; current->mode = Monitor_Active; current->monitor = Monitor_Init; current->onreboot = Run.onreboot; current->name = name; current->name_urlescaped = Util_urlEncode(name, false); current->name_htmlescaped = escapeHTML(StringBuffer_create(16), name); current->check = check; current->path = value; /* Initialize general event handlers */ addeventaction(&(current)->action_DATA, Action_Alert, Action_Alert); addeventaction(&(current)->action_EXEC, Action_Alert, Action_Alert); addeventaction(&(current)->action_INVALID, Action_Restart, Action_Alert); /* Initialize internal event handlers */ addeventaction(&(current)->action_ACTION, Action_Alert, Action_Ignored); gettimeofday(¤t->collected, NULL); return current; } /* * Add a service object to the Service_List */ static void addservice(Service_T s) { assert(s); // Test sanity check switch (s->type) { case Service_Host: // Verify that a remote service has a port or an icmp list if (! s->portlist && ! s->icmplist) { Log_error("'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", s->name); cfg_errflag++; } break; case Service_Program: // Verify that a program test has a status test if (! s->statuslist && ! s->matchlist && ! s->outputchangelist) { Log_error("'check program %s' is incomplete: Please add a 'status' or 'content' test\n", s->name); cfg_errflag++; } char program[PATH_MAX]; strncpy(program, s->program->args->arg[0], sizeof(program) - 1); // Require that the program exist before creating the Command object if (File_isExecutable(program)) { s->program->C = Command_new(program, NULL); for (int i = 1; i < s->program->args->length; i++) { Command_appendArgument(s->program->C, s->program->args->arg[i]); snprintf(program + strlen(program), sizeof(program) - strlen(program) - 1, " %s", s->program->args->arg[i]); } s->path = Str_dup(program); if (s->program->args->has_uid) Command_setUid(s->program->C, s->program->args->uid); if (s->program->args->has_gid) Command_setGid(s->program->C, s->program->args->gid); // Set environment Command_setEnv(s->program->C, "MONIT_SERVICE", s->name); } else { Log_error("A 'check program' statement requires the program to exist '%s'\n", program); cfg_errflag++; } break; case Service_Net: if (! s->linkstatuslist) { // Add link status test if not defined addeventaction(&(linkstatusset).action, Action_Alert, Action_Alert); addlinkstatus(s, &linkstatusset); } break; case Service_Filesystem: if (! s->nonexistlist && ! s->existlist) { // Add non-existence test if not defined addeventaction(&(nonexistset).action, Action_Restart, Action_Alert); addnonexist(&nonexistset); } if (! s->fsflaglist) { // Add filesystem flags change test if not defined addeventaction(&(fsflagset).action, Action_Alert, Action_Ignored); addfsflag(&fsflagset); } break; case Service_Directory: case Service_Fifo: case Service_File: case Service_Process: if (! s->nonexistlist && ! s->existlist) { // Add existence test if not defined addeventaction(&(nonexistset).action, Action_Restart, Action_Alert); addnonexist(&nonexistset); } break; default: break; } // No "every" statement was used, monitor each cycle if (s->every.type == Every_Initializing) s->every.type = Every_Cycle; /* Add the service to the end of the service list */ if (tail != NULL) { tail->next = s; tail->next_conf = s; } else { Service_List = s; Service_List_Conf = s; } tail = s; } /* * Add entry to service group list */ static void addservicegroup(char *name) { ServiceGroup_T g; assert(name); /* Check if service group with the same name is defined already */ for (g = Service_Group_List; g; g = g->next) if (IS(g->name, name)) break; if (! g) { NEW(g); g->name = Str_dup(name); g->members = List_new(); g->next = Service_Group_List; Service_Group_List = g; } List_append(g->members, current); } /* * Add entry to M/Monit hostgroup membership list */ static void addhostgroup(char *name) { if (! mmonitset.hostgroups) mmonitset.hostgroups = List_new(); List_append(mmonitset.hostgroups, name); } /* * Add a dependant entry to the current service dependant list */ static void adddependant(char *dependant) { Dependant_T d; assert(dependant); NEW(d); if (current->dependantlist) d->next = current->dependantlist; d->dependant = dependant; d->dependant_urlescaped = Util_urlEncode(dependant, false); d->dependant_htmlescaped = escapeHTML(StringBuffer_create(16), dependant); current->dependantlist = d; } /* * Add the given mailaddress with the appropriate alert notification * values and mail attributes to the given mailinglist. */ static void addmail(char *mailto, Mail_T f, Mail_T *l) { Mail_T m; assert(mailto); NEW(m); m->to = mailto; m->from = f->from; m->replyto = f->replyto; m->subject = f->subject; m->message = f->message; m->events = f->events; m->reminder = f->reminder; m->next = *l; *l = m; reset_mailset(); } /* * Add the given portset to the current service's portlist */ static void addport(Port_T *list, Port_T port) { assert(port); if (port->protocol->check == check_radius && port->type != Socket_Udp) yyerror("Radius protocol test supports UDP only"); Port_T p; NEW(p); p->is_available = Connection_Init; p->check_invers = port->check_invers; p->type = port->type; p->socket = port->socket; p->family = port->family; p->action = port->action; p->timeout = port->timeout; p->retry = port->retry; p->protocol = port->protocol; p->hostname = port->hostname; p->url_request = port->url_request; p->outgoing = port->outgoing; if (p->family == Socket_Unix) { p->target.unix.pathname = port->target.unix.pathname; } else { p->target.net.port = port->target.net.port; if (sslset.flags) { #ifdef HAVE_OPENSSL p->target.net.ssl.certificate.minimumDays = port->target.net.ssl.certificate.minimumDays; if (sslset.flags && (p->target.net.port == 25 || p->target.net.port == 143 || p->target.net.port == 587)) sslset.flags = SSL_StartTLS; _setSSLOptions(&(p->target.net.ssl.options)); #else yyerror("SSL check cannot be activated -- Monit was not built with SSL support"); #endif } } memcpy(&p->parameters, &port->parameters, sizeof(port->parameters)); if (p->protocol->check == check_http) { if (p->parameters.http.checksum) { cleanup_hash_string(p->parameters.http.checksum); if (strlen(p->parameters.http.checksum) == 32) p->parameters.http.hashtype = Hash_Md5; else if (strlen(p->parameters.http.checksum) == 40) p->parameters.http.hashtype = Hash_Sha1; else yyerror2("invalid checksum [%s]", p->parameters.http.checksum); } else { p->parameters.http.hashtype = Hash_Unknown; } if (! p->parameters.http.method) { p->parameters.http.method = Http_Get; } else if (p->parameters.http.method == Http_Head) { // Sanity check: if content or checksum test is used, the method Http_Head is not allowed, as we need the content if ((p->url_request && p->url_request->regex) || p->parameters.http.checksum) { yyerror2("if response content or checksum test is enabled, the HEAD method is not allowed"); } } } else if (p->protocol->check == check_mysql) { if (p->parameters.mysql.rsaChecksum) { if (! p->parameters.mysql.username) yyerror2("the rsakey checksum test requires credentials to be defined"); if (p->target.net.ssl.options.flags != SSL_Disabled) yyerror2("the rsakey checksum test can be used just with unsecured mysql protocol"); } } p->responsetime.limit = responsetimeset.limit; p->responsetime.current = responsetimeset.current; p->responsetime.operator = responsetimeset.operator; p->next = *list; *list = p; reset_sslset(); reset_responsetimeset(); reset_portset(); } static void addhttpheader(Port_T port, char *header) { if (! port->parameters.http.headers) { port->parameters.http.headers = List_new(); } if (Str_startsWith(header, "Connection:") && ! Str_sub(header, "close")) { yywarning("We don't recommend setting the Connection header. Monit will always close the connection even if 'keep-alive' is set\n"); } List_append(port->parameters.http.headers, header); } /* * Add a new resource object to the current service resource list */ static void addresource(Resource_T rr) { assert(rr); if (Run.flags & Run_ProcessEngineEnabled) { Resource_T r; NEW(r); r->resource_id = rr->resource_id; r->limit = rr->limit; r->action = rr->action; r->operator = rr->operator; r->next = current->resourcelist; current->resourcelist = r; } else { yywarning("Cannot activate service check. The process status engine was disabled. On certain systems you must run monit as root to utilize this feature)\n"); } reset_resourceset(); } /* * Add a new file object to the current service timestamp list */ static void addtimestamp(Timestamp_T ts) { assert(ts); Timestamp_T t; NEW(t); t->type = ts->type; t->operator = ts->operator; t->time = ts->time; t->action = ts->action; t->test_changes = ts->test_changes; t->next = current->timestamplist; current->timestamplist = t; reset_timestampset(); } /* * Add a new object to the current service actionrate list */ static void addactionrate(ActionRate_T ar) { ActionRate_T a; assert(ar); if (ar->count > ar->cycle) yyerror2("The number of restarts must be less than poll cycles"); if (ar->count <= 0 || ar->cycle <= 0) yyerror2("Zero or negative values not allowed in a action rate statement"); NEW(a); a->count = ar->count; a->cycle = ar->cycle; a->action = ar->action; a->next = current->actionratelist; current->actionratelist = a; reset_actionrateset(); } /* * Add a new Size object to the current service size list */ static void addsize(Size_T ss) { Size_T s; struct stat buf; assert(ss); NEW(s); s->operator = ss->operator; s->size = ss->size; s->action = ss->action; s->test_changes = ss->test_changes; /* Get the initial size for future comparison, if the file exists */ if (s->test_changes) { s->initialized = ! stat(current->path, &buf); if (s->initialized) s->size = (unsigned long long)buf.st_size; } s->next = current->sizelist; current->sizelist = s; reset_sizeset(); } /* * Add a new NLink object to the current service nlink list */ static void addnlink(NLink_T ss) { NLink_T s; struct stat buf; assert(ss); NEW(s); s->operator = ss->operator; s->nlink = ss->nlink; s->action = ss->action; s->test_changes = ss->test_changes; /* Get the initial size for future comparison */ if (s->test_changes) { s->initialized = ! stat(current->path, &buf); if (s->initialized) s->nlink = (unsigned long long)buf.st_nlink; } s->next = current->nlinklist; current->nlinklist = s; reset_nlinkset(); } /* * Add a new Uptime object to the current service uptime list */ static void adduptime(Uptime_T uu) { Uptime_T u; assert(uu); NEW(u); u->operator = uu->operator; u->uptime = uu->uptime; u->action = uu->action; u->next = current->uptimelist; current->uptimelist = u; reset_uptimeset(); } /* * Add a new Pid object to the current service pid list */ static void addpid(Pid_T pp) { assert(pp); Pid_T p; NEW(p); p->action = pp->action; p->next = current->pidlist; current->pidlist = p; reset_pidset(); } /* * Add a new PPid object to the current service ppid list */ static void addppid(Pid_T pp) { assert(pp); Pid_T p; NEW(p); p->action = pp->action; p->next = current->ppidlist; current->ppidlist = p; reset_ppidset(); } /* * Add a new Fsflag object to the current service fsflag list */ static void addfsflag(FsFlag_T ff) { assert(ff); FsFlag_T f; NEW(f); f->action = ff->action; f->next = current->fsflaglist; current->fsflaglist = f; reset_fsflagset(); } /* * Add a new Nonexist object to the current service list */ static void addnonexist(NonExist_T ff) { assert(ff); NonExist_T f; NEW(f); f->action = ff->action; f->next = current->nonexistlist; current->nonexistlist = f; reset_nonexistset(); } static void addexist(Exist_T rule) { assert(rule); Exist_T r; NEW(r); r->action = rule->action; r->next = current->existlist; current->existlist = r; reset_existset(); } /* * Set Checksum object in the current service */ static void addchecksum(Checksum_T cs) { assert(cs); cs->initialized = true; if (STR_UNDEF(cs->hash)) { if (cs->type == Hash_Unknown) cs->type = Hash_Default; if (! (Checksum_getChecksum(current->path, cs->type, cs->hash, sizeof(cs->hash)))) { /* If the file doesn't exist, set dummy value */ snprintf(cs->hash, sizeof(cs->hash), cs->type == Hash_Md5 ? "00000000000000000000000000000000" : "0000000000000000000000000000000000000000"); cs->initialized = false; yywarning2("Cannot compute a checksum for file %s", current->path); } } int len = cleanup_hash_string(cs->hash); if (cs->type == Hash_Unknown) { if (len == 32) { cs->type = Hash_Md5; } else if (len == 40) { cs->type = Hash_Sha1; } else { yyerror2("Unknown checksum type [%s] for file %s", cs->hash, current->path); reset_checksumset(); return; } } else if ((cs->type == Hash_Md5 && len != 32) || (cs->type == Hash_Sha1 && len != 40)) { yyerror2("Invalid checksum [%s] for file %s", cs->hash, current->path); reset_checksumset(); return; } Checksum_T c; NEW(c); c->type = cs->type; c->test_changes = cs->test_changes; c->initialized = cs->initialized; c->action = cs->action; snprintf(c->hash, sizeof(c->hash), "%s", cs->hash); current->checksum = c; reset_checksumset(); } /* * Set Perm object in the current service */ static void addperm(Perm_T ps) { assert(ps); Perm_T p; NEW(p); p->action = ps->action; p->test_changes = ps->test_changes; if (p->test_changes) { if (! File_exist(current->path)) DEBUG("The path '%s' used in the PERMISSION statement refer to a non-existing object\n", current->path); else if ((p->perm = File_mod(current->path)) < 0) yyerror2("Cannot get the timestamp for '%s'", current->path); else p->perm &= 07777; } else { p->perm = ps->perm; } current->perm = p; reset_permset(); } static void addlinkstatus(Service_T s, LinkStatus_T L) { assert(L); LinkStatus_T l; // Sanity check: we don't support link up/down tests mix for (l = s->linkstatuslist; l; l = l->next) { if (l->check_invers != L->check_invers) yyerror2("Mixing link up and down tests is not supported"); } if (L->check_invers) s->inverseStatus = true; NEW(l); l->check_invers = L->check_invers; l->action = L->action; l->next = s->linkstatuslist; s->linkstatuslist = l; reset_linkstatusset(); } static void addlinkspeed(Service_T s, LinkSpeed_T L) { assert(L); LinkSpeed_T l; NEW(l); l->action = L->action; l->next = s->linkspeedlist; s->linkspeedlist = l; reset_linkspeedset(); } static void addlinksaturation(Service_T s, LinkSaturation_T L) { assert(L); LinkSaturation_T l; NEW(l); l->operator = L->operator; l->limit = L->limit; l->action = L->action; l->next = s->linksaturationlist; s->linksaturationlist = l; reset_linksaturationset(); } /* * Return Bandwidth object */ static void addbandwidth(Bandwidth_T *list, Bandwidth_T b) { assert(list); assert(b); if (b->rangecount * b->range > 24 * Time_Hour) { yyerror2("Maximum range for total test is 24 hours"); } else if (b->range == Time_Minute && b->rangecount > 60) { yyerror2("Maximum value for [minute(s)] unit is 60"); } else if (b->range == Time_Hour && b->rangecount > 24) { yyerror2("Maximum value for [hour(s)] unit is 24"); } else if (b->range == Time_Day && b->rangecount > 1) { yyerror2("Maximum value for [day(s)] unit is 1"); } else { if (b->range == Time_Day) { // translate last day -> last 24 hours b->rangecount = 24; b->range = Time_Hour; } Bandwidth_T bandwidth; NEW(bandwidth); bandwidth->operator = b->operator; bandwidth->limit = b->limit; bandwidth->rangecount = b->rangecount; bandwidth->range = b->range; bandwidth->action = b->action; bandwidth->next = *list; *list = bandwidth; } reset_bandwidthset(); } static void appendmatch(Match_T *list, Match_T item) { if (*list) { /* Find the end of the list (keep the same patterns order as in the config file) */ Match_T last; for (last = *list; last->next; last = last->next) ; last->next = item; } else { *list = item; } } /* * Set Match object in the current service */ static void addmatch(Match_T ms, int actionnumber, int linenumber) { Match_T m; assert(ms); NEW(m); NEW(m->regex_comp); m->match_string = ms->match_string; m->match_path = ms->match_path ? Str_dup(ms->match_path) : NULL; m->action = ms->action; m->not = ms->not; m->ignore = ms->ignore; m->next = NULL; addeventaction(&(m->action), actionnumber, Action_Ignored); int reg_return = regcomp(m->regex_comp, ms->match_string, REG_NOSUB|REG_EXTENDED); if (reg_return != 0) { char errbuf[STRLEN]; regerror(reg_return, ms->regex_comp, errbuf, STRLEN); if (m->match_path != NULL) yyerror2("Regex '%s' parsing error: %s on line %i of", ms->match_string, errbuf, linenumber); else yyerror("Regex '%s' parsing error: %s", ms->match_string, errbuf); } appendmatch(m->ignore ? ¤t->matchignorelist : ¤t->matchlist, m); } static void addmatchpath(Match_T ms, Action_Type actionnumber) { assert(ms->match_path); FILE *handle = fopen(ms->match_path, "r"); if (handle == NULL) { yyerror2("Cannot read regex match file (%s)", ms->match_path); return; } // The addeventaction() called from addmatch() will reset the command1 to NULL, but we need to duplicate the command for each line, thus need to save it here command_t savecommand = command1; for (int linenumber = 1; ! feof(handle); linenumber++) { char buf[2048]; if (! fgets(buf, sizeof(buf), handle)) continue; size_t len = strlen(buf); if (len == 0 || buf[0] == '\n') continue; if (buf[len - 1] == '\n') buf[len - 1] = 0; ms->match_string = Str_dup(buf); if (actionnumber == Action_Exec) { if (command1 == NULL) { assert(savecommand); command1 = copycommand(savecommand); } } addmatch(ms, actionnumber, linenumber); } if (actionnumber == Action_Exec && savecommand) gccmd(&savecommand); fclose(handle); } /* * Set output change object in the current service */ static void addoutputchange(bool check_invers, Action_Type failed, Action_Type succeeded) { OutputChange_T outputchange; NEW(outputchange); addeventaction(&(outputchange->action), failed, succeeded); outputchange->previous = NULL; outputchange->check_invers = check_invers; outputchange->next = current->outputchangelist; current->outputchangelist = outputchange; } /* * Set exit status test object in the current service */ static void addstatus(Status_T status) { Status_T s; assert(status); NEW(s); s->initialized = status->initialized; s->return_value = status->return_value; s->operator = status->operator; s->action = status->action; s->next = current->statuslist; current->statuslist = s; reset_statusset(); } /* * Set Uid object in the current service */ static Uid_T adduid(Uid_T u) { assert(u); Uid_T uid; NEW(uid); uid->uid = u->uid; uid->action = u->action; reset_uidset(); return uid; } /* * Set Gid object in the current service */ static Gid_T addgid(Gid_T g) { assert(g); Gid_T gid; NEW(gid); gid->gid = g->gid; gid->action = g->action; reset_gidset(); return gid; } /* * Add a new filesystem to the current service's filesystem list */ static void addfilesystem(FileSystem_T ds) { FileSystem_T dev; assert(ds); NEW(dev); dev->resource = ds->resource; dev->operator = ds->operator; dev->limit_absolute = ds->limit_absolute; dev->limit_percent = ds->limit_percent; dev->action = ds->action; dev->next = current->filesystemlist; current->filesystemlist = dev; reset_filesystemset(); } /* * Add a new icmp object to the current service's icmp list */ static void addicmp(Icmp_T is) { Icmp_T icmp; assert(is); NEW(icmp); icmp->family = is->family; icmp->type = is->type; icmp->size = is->size; icmp->count = is->count; icmp->timeout = is->timeout; icmp->action = is->action; icmp->outgoing = is->outgoing; icmp->check_invers = is->check_invers; icmp->is_available = Connection_Init; icmp->responsetime.limit = responsetimeset.limit; icmp->responsetime.current = responsetimeset.current; icmp->responsetime.operator = responsetimeset.operator; icmp->next = current->icmplist; current->icmplist = icmp; reset_responsetimeset(); reset_icmpset(); } /* * Set EventAction object */ static void addeventaction(EventAction_T *_ea, Action_Type failed, Action_Type succeeded) { EventAction_T ea; assert(_ea); NEW(ea); NEW(ea->failed); NEW(ea->succeeded); ea->failed->id = failed; ea->failed->repeat = repeat1; ea->failed->count = rate1.count; ea->failed->cycles = rate1.cycles; if (failed == Action_Exec) { assert(command1); ea->failed->exec = command1; command1 = NULL; } ea->succeeded->id = succeeded; ea->succeeded->repeat = repeat2; ea->succeeded->count = rate2.count; ea->succeeded->cycles = rate2.cycles; if (succeeded == Action_Exec) { assert(command2); ea->succeeded->exec = command2; command2 = NULL; } *_ea = ea; reset_rateset(&rate); reset_rateset(&rate1); reset_rateset(&rate2); repeat = repeat1 = repeat2 = 0; } /* * Add a generic protocol handler to */ static void addgeneric(Port_T port, char *send, char *expect) { Generic_T g = port->parameters.generic.sendexpect; if (! g) { NEW(g); port->parameters.generic.sendexpect = g; } else { while (g->next) g = g->next; NEW(g->next); g = g->next; } if (send) { g->send = send; g->expect = NULL; } else if (expect) { int reg_return; NEW(g->expect); reg_return = regcomp(g->expect, expect, REG_NOSUB|REG_EXTENDED); FREE(expect); if (reg_return != 0) { char errbuf[STRLEN]; regerror(reg_return, g->expect, errbuf, STRLEN); yyerror2("Regex parsing error: %s", errbuf); } g->send = NULL; } } /* * Add the current command object to the current service object's * start or stop program. */ static void addcommand(int what, unsigned int cmdtimeout) { switch (what) { case START: current->start = command; break; case STOP: current->stop = command; break; case RESTART: current->restart = command; break; } command->timeout = cmdtimeout; command = NULL; } /* * Add a new argument to the argument list */ static void addargument(char *argument) { assert(argument); if (! command) { check_exec(argument); NEW(command); } if (command->length + 1 >= ARGMAX) { yyerror("Exceeded maximum number of program arguments"); FREE(argument); } else { command->arg[command->length++] = argument; command->arg[command->length] = NULL; } } /* * Setup a url request for the current port object */ static void prepare_urlrequest(URL_T U) { assert(U); /* Only the HTTP protocol is supported for URLs currently. See also the lexer if this is to be changed in the future */ portset.protocol = Protocol_get(Protocol_HTTP); if (urlrequest == NULL) NEW(urlrequest); urlrequest->url = U; portset.hostname = Str_dup(U->hostname); portset.target.net.port = U->port; portset.url_request = urlrequest; portset.type = Socket_Tcp; portset.parameters.http.request = Str_cat("%s%s%s", U->path, U->query ? "?" : "", U->query ? U->query : ""); if (IS(U->protocol, "https")) sslset.flags = SSL_Enabled; } /* * Set the url request for a port */ static void seturlrequest(int operator, char *regex) { assert(regex); if (! urlrequest) NEW(urlrequest); urlrequest->operator = operator; int reg_return; NEW(urlrequest->regex); reg_return = regcomp(urlrequest->regex, regex, REG_NOSUB|REG_EXTENDED); if (reg_return != 0) { char errbuf[STRLEN]; regerror(reg_return, urlrequest->regex, errbuf, STRLEN); yyerror2("Regex parsing error: %s", errbuf); } } /* * Add a new data recipient server to the mmonit server list */ static void addmmonit(Mmonit_T mmonit) { assert(mmonit->url); Mmonit_T c; NEW(c); c->url = mmonit->url; c->compress = MmonitCompress_Init; _setSSLOptions(&(c->ssl)); if (IS(c->url->protocol, "https")) { #ifdef HAVE_OPENSSL c->ssl.flags = SSL_Enabled; #else yyerror("SSL check cannot be activated -- SSL disabled"); #endif } c->timeout = mmonit->timeout; c->hostgroups = mmonit->hostgroups; c->next = NULL; if (Run.mmonits) { Mmonit_T C; for (C = Run.mmonits; C->next; C = C->next) /* Empty */ ; C->next = c; } else { Run.mmonits = c; } reset_sslset(); reset_mmonitset(); } /* * Add a new smtp server to the mail server list */ static void addmailserver(MailServer_T mailserver) { MailServer_T s; assert(mailserver->host); NEW(s); s->host = mailserver->host; s->port = mailserver->port; s->username = mailserver->username; s->password = mailserver->password; if (sslset.flags && (mailserver->port == 25 || mailserver->port == 587)) sslset.flags = SSL_StartTLS; _setSSLOptions(&(s->ssl)); s->next = NULL; if (Run.mailservers) { MailServer_T l; for (l = Run.mailservers; l->next; l = l->next) /* empty */; l->next = s; } else { Run.mailservers = s; } reset_mailserverset(); } /* * Return uid if found on the system. If the parameter user is NULL * the uid parameter is used for looking up the user id on the system, * otherwise the user parameter is used. */ static uid_t get_uid(char *user, uid_t uid) { char buf[4096]; struct passwd pwd, *result = NULL; if (user) { if (getpwnam_r(user, &pwd, buf, sizeof(buf), &result) != 0 || ! result) { yyerror2("Requested user not found on the system"); return(0); } } else { if (getpwuid_r(uid, &pwd, buf, sizeof(buf), &result) != 0 || ! result) { yyerror2("Requested uid not found on the system"); return(0); } } return(pwd.pw_uid); } /* * Return gid if found on the system. If the parameter group is NULL * the gid parameter is used for looking up the group id on the system, * otherwise the group parameter is used. */ static gid_t get_gid(char *group, gid_t gid) { struct group *grd; if (group) { grd = getgrnam(group); if (! grd) { yyerror2("Requested group not found on the system"); return(0); } } else { if (! (grd = getgrgid(gid))) { yyerror2("Requested gid not found on the system"); return(0); } } return(grd->gr_gid); } /* * Add a new user id to the current command object. */ static void addeuid(uid_t uid) { if (! getuid()) { command->has_uid = true; command->uid = uid; } else { yyerror("UID statement requires root privileges"); } } /* * Add a new group id to the current command object. */ static void addegid(gid_t gid) { if (! getuid()) { command->has_gid = true; command->gid = gid; } else { yyerror("GID statement requires root privileges"); } } /* * Reset the logfile if changed */ static void setlogfile(char *logfile) { if (Run.files.log) { if (IS(Run.files.log, logfile)) { FREE(logfile); return; } else { FREE(Run.files.log); } } Run.files.log = logfile; } /* * Reset the pidfile if changed */ static void setpidfile(char *pidfile) { if (Run.files.pid) { if (IS(Run.files.pid, pidfile)) { FREE(pidfile); return; } else { FREE(Run.files.pid); } } Run.files.pid = pidfile; } /* * Reset the idfile if changed */ static void setidfile(char *idfile) { if (Run.files.id) { if (IS(Run.files.id, idfile)) { FREE(idfile); return; } else { FREE(Run.files.id); } } Run.files.id = idfile; } /* * Reset the statefile if changed */ static void setstatefile(char *statefile) { if (Run.files.state) { if (IS(Run.files.state, statefile)) { FREE(statefile); return; } else { FREE(Run.files.state); } } Run.files.state = statefile; } /* * Read a apache htpasswd file and add credentials found for username */ static void addhtpasswdentry(char *filename, char *username, Digest_Type dtype) { char *ht_username = NULL; char *ht_passwd = NULL; char buf[STRLEN]; FILE *handle = NULL; int credentials_added = 0; char realpath[PATH_MAX] = {}; assert(filename); // Check that the htpasswd is a real file and not e.g. a directory if (filename[0] != SEPARATOR_CHAR) { if (! File_realPath(filename, realpath)) { yyerror2("Error getting path for the htpasswd file '%s' -- %s\n", filename, STRERROR); return; } } if (! File_isFile(filename)) { yyerror2("The htpasswd file '%s' is not a file", filename); return; } if (! (handle = fopen(filename, "r"))) { if (username) yyerror2("Cannot read htpasswd (%s) for user %s", filename, username); else yyerror2("Cannot read htpasswd (%s)", filename); return; } while (! feof(handle)) { char *colonindex = NULL; if (! fgets(buf, STRLEN, handle)) continue; Str_rtrim(buf); Str_curtail(buf, "#"); if (NULL == (colonindex = strchr(buf, ':'))) continue; ht_passwd = Str_dup(colonindex+1); *colonindex = '\0'; /* In case we have a file in /etc/passwd or /etc/shadow style we * want to remove ":.*$" and Crypt and MD5 hashed dont have a colon */ if ((NULL != (colonindex = strchr(ht_passwd, ':'))) && (dtype != Digest_Cleartext)) *colonindex = '\0'; ht_username = Str_dup(buf); if (username == NULL) { if (addcredentials(ht_username, ht_passwd, dtype, false)) credentials_added++; } else if (Str_cmp(username, ht_username) == 0) { if (addcredentials(ht_username, ht_passwd, dtype, false)) credentials_added++; } else { FREE(ht_passwd); FREE(ht_username); } } if (credentials_added == 0) { if (username == NULL) yywarning2("htpasswd file (%s) has no usable credentials", filename); else yywarning2("htpasswd file (%s) has no usable credentials for user %s", filename, username); } fclose(handle); } #ifdef HAVE_LIBPAM static void addpamauth(char* groupname, int readonly) { Auth_T prev = NULL; assert(groupname); if (! Run.httpd.credentials) NEW(Run.httpd.credentials); Auth_T c = Run.httpd.credentials; do { if (c->groupname != NULL && IS(c->groupname, groupname)) { yywarning2("PAM group %s was added already, entry ignored", groupname); FREE(groupname); return; } prev = c; c = c->next; } while (c != NULL); NEW(prev->next); c = prev->next; c->next = NULL; c->uname = NULL; c->passwd = NULL; c->groupname = groupname; c->digesttype = Digest_Pam; c->is_readonly = readonly; DEBUG("Adding PAM group '%s'\n", groupname); return; } #endif /* * Add Basic Authentication credentials */ static bool addcredentials(char *uname, char *passwd, Digest_Type dtype, bool readonly) { Auth_T c; assert(uname); assert(passwd); if (! Run.httpd.credentials) { NEW(Run.httpd.credentials); c = Run.httpd.credentials; } else { if (Util_getUserCredentials(uname) != NULL) { yywarning2("Credentials for user %s were already added, entry ignored", uname); FREE(uname); FREE(passwd); return false; } c = Run.httpd.credentials; while (c->next != NULL) c = c->next; NEW(c->next); c = c->next; } c->next = NULL; c->uname = uname; c->passwd = passwd; c->groupname = NULL; c->digesttype = dtype; c->is_readonly = readonly; DEBUG("Adding credentials for user '%s'\n", uname); return true; } /* * Set the syslog and the facilities to be used */ static void setsyslog(char *facility) { if (! Run.files.log || ihp.logfile) { ihp.logfile = true; setlogfile(Str_dup("syslog")); Run.flags |= Run_UseSyslog; Run.flags |= Run_Log; } if (facility) { if (IS(facility,"log_local0")) Run.facility = LOG_LOCAL0; else if (IS(facility, "log_local1")) Run.facility = LOG_LOCAL1; else if (IS(facility, "log_local2")) Run.facility = LOG_LOCAL2; else if (IS(facility, "log_local3")) Run.facility = LOG_LOCAL3; else if (IS(facility, "log_local4")) Run.facility = LOG_LOCAL4; else if (IS(facility, "log_local5")) Run.facility = LOG_LOCAL5; else if (IS(facility, "log_local6")) Run.facility = LOG_LOCAL6; else if (IS(facility, "log_local7")) Run.facility = LOG_LOCAL7; else if (IS(facility, "log_daemon")) Run.facility = LOG_DAEMON; else if (IS(facility, "log_user")) Run.facility = LOG_USER; else yyerror2("Invalid syslog facility"); } else { Run.facility = LOG_USER; } } /* * Reset the current sslset for reuse */ static void reset_sslset(void) { memset(&sslset, 0, sizeof(struct SslOptions_T)); sslset.version = sslset.verify = sslset.allowSelfSigned = -1; } /* * Reset the current mailset for reuse */ static void reset_mailset(void) { memset(&mailset, 0, sizeof(struct Mail_T)); } /* * Reset the mailserver set to default values */ static void reset_mailserverset(void) { memset(&mailserverset, 0, sizeof(struct MailServer_T)); mailserverset.port = PORT_SMTP; } /* * Reset the mmonit set to default values */ static void reset_mmonitset(void) { memset(&mmonitset, 0, sizeof(struct Mmonit_T)); mmonitset.timeout = Run.limits.networkTimeout; } /* * Reset the Port set to default values */ static void reset_portset(void) { memset(&portset, 0, sizeof(struct Port_T)); portset.check_invers = false; portset.socket = -1; portset.type = Socket_Tcp; portset.family = Socket_Ip; portset.timeout = Run.limits.networkTimeout; portset.retry = 1; portset.protocol = Protocol_get(Protocol_DEFAULT); urlrequest = NULL; } /* * Reset the Proc set to default values */ static void reset_resourceset(void) { resourceset.resource_id = 0; resourceset.limit = 0; resourceset.action = NULL; resourceset.operator = Operator_Equal; } /* * Reset the Timestamp set to default values */ static void reset_timestampset(void) { timestampset.type = Timestamp_Default; timestampset.operator = Operator_Equal; timestampset.time = 0; timestampset.test_changes = false; timestampset.initialized = false; timestampset.action = NULL; } /* * Reset the ActionRate set to default values */ static void reset_actionrateset(void) { actionrateset.count = 0; actionrateset.cycle = 0; actionrateset.action = NULL; } /* * Reset the Size set to default values */ static void reset_sizeset(void) { sizeset.operator = Operator_Equal; sizeset.size = 0; sizeset.test_changes = false; sizeset.action = NULL; } /* * Reset the NLink set to default values */ static void reset_nlinkset(void) { nlinkset.operator = Operator_Equal; nlinkset.nlink = 0; nlinkset.test_changes = false; nlinkset.action = NULL; } /* * Reset the Uptime set to default values */ static void reset_uptimeset(void) { uptimeset.operator = Operator_Equal; uptimeset.uptime = 0; uptimeset.action = NULL; } static void reset_responsetimeset(void) { responsetimeset.operator = Operator_Less; responsetimeset.current = 0.; responsetimeset.limit = -1.; } static void reset_linkstatusset(void) { linkstatusset.check_invers = false; linkstatusset.action = NULL; } static void reset_linkspeedset(void) { linkspeedset.action = NULL; } static void reset_linksaturationset(void) { linksaturationset.limit = 0.; linksaturationset.operator = Operator_Equal; linksaturationset.action = NULL; } /* * Reset the Bandwidth set to default values */ static void reset_bandwidthset(void) { bandwidthset.operator = Operator_Equal; bandwidthset.limit = 0ULL; bandwidthset.action = NULL; } /* * Reset the Pid set to default values */ static void reset_pidset(void) { pidset.action = NULL; } /* * Reset the PPid set to default values */ static void reset_ppidset(void) { ppidset.action = NULL; } /* * Reset the Fsflag set to default values */ static void reset_fsflagset(void) { fsflagset.action = NULL; } /* * Reset the Nonexist set to default values */ static void reset_nonexistset(void) { nonexistset.action = NULL; } static void reset_existset(void) { existset.action = NULL; } /* * Reset the Checksum set to default values */ static void reset_checksumset(void) { checksumset.type = Hash_Unknown; checksumset.test_changes = false; checksumset.action = NULL; *checksumset.hash = 0; } /* * Reset the Perm set to default values */ static void reset_permset(void) { permset.test_changes = false; permset.perm = 0; permset.action = NULL; } /* * Reset the Status set to default values */ static void reset_statusset(void) { statusset.initialized = false; statusset.return_value = 0; statusset.operator = Operator_Equal; statusset.action = NULL; } /* * Reset the Uid set to default values */ static void reset_uidset(void) { uidset.uid = 0; uidset.action = NULL; } /* * Reset the Gid set to default values */ static void reset_gidset(void) { gidset.gid = 0; gidset.action = NULL; } /* * Reset the Filesystem set to default values */ static void reset_filesystemset(void) { filesystemset.resource = 0; filesystemset.operator = Operator_Equal; filesystemset.limit_absolute = -1; filesystemset.limit_percent = -1.; filesystemset.action = NULL; } /* * Reset the ICMP set to default values */ static void reset_icmpset(void) { memset(&icmpset, 0, sizeof(struct Icmp_T)); icmpset.type = ICMP_ECHO; icmpset.size = ICMP_SIZE; icmpset.count = ICMP_ATTEMPT_COUNT; icmpset.timeout = Run.limits.networkTimeout; } /* * Reset the Rate set to default values */ static void reset_rateset(struct rate_t *r) { r->count = 1; r->cycles = 1; } /* ---------------------------------------------------------------- Checkers */ /* * Check for unique service name */ static void check_name(char *name) { assert(name); if (Util_existService(name) || (current && IS(name, current->name))) yyerror2("Service name conflict, %s already defined", name); if (name && *name == '/') yyerror2("Service name '%s' must not start with '/' -- ", name); } /* * Permission statement semantic check */ static int check_perm(int perm) { int result; char *status; char buf[STRLEN]; snprintf(buf, STRLEN, "%d", perm); result = (int)strtol(buf, &status, 8); if (*status != '\0' || result < 0 || result > 07777) yyerror2("Permission statements must have an octal value between 0 and 7777"); return result; } /* * Check the dependency graph for errors * by doing a topological sort, thereby finding any cycles. * Assures that graph is a Directed Acyclic Graph (DAG). */ static void check_depend(void) { Service_T depends_on = NULL; Service_T* dlt = &depend_list; /* the current tail of it */ bool done; /* no unvisited nodes left? */ bool found_some; /* last iteration found anything new ? */ depend_list = NULL; /* depend_list will be the topological sorted Service_List */ do { done = true; found_some = false; for (Service_T s = Service_List; s; s = s->next) { Dependant_T d; if (s->visited) continue; done = false; // still unvisited nodes depends_on = NULL; for (d = s->dependantlist; d; d = d->next) { Service_T dp = Util_getService(d->dependant); if (! dp) { Log_error("Depending service '%s' is not defined in the control file\n", d->dependant); exit(1); } if (! dp->visited) { depends_on = dp; } } if (! depends_on) { s->visited = true; found_some = true; *dlt = s; dlt = &s->next_depend; } } } while (found_some && ! done); if (! done) { assert(depends_on); Log_error("Found a depend loop in the control file involving the service '%s'\n", depends_on->name); exit(1); } assert(depend_list); Service_List = depend_list; for (Service_T s = depend_list; s; s = s->next_depend) s->next = s->next_depend; } // Check and warn if the executable does not exist static void check_exec(char *exec) { if (! File_exist(exec)) yywarning2("Program does not exist:"); else if (! File_isExecutable(exec)) yywarning2("Program is not executable:"); } /* Return a valid max forward value for SIP header */ static int verifyMaxForward(int mf) { if (mf == 0) { return INT_MAX; // Differentiate uninitialized (0) and explicit zero } else if (mf > 0 && mf <= 255) { return mf; } yywarning2("SIP max forward is outside the range [0..255]. Setting max forward to 70"); return 70; } /* -------------------------------------------------------------------- Misc */ /* * Cleans up a hash string, tolower and remove byte separators */ static int cleanup_hash_string(char *hashstring) { int i = 0, j = 0; assert(hashstring); while (hashstring[i]) { if (isxdigit((int)hashstring[i])) { hashstring[j] = tolower((int)hashstring[i]); j++; } i++; } hashstring[j] = 0; return j; } /* Return deep copy of the command */ static command_t copycommand(command_t source) { int i; command_t copy = NULL; NEW(copy); copy->length = source->length; copy->has_uid = source->has_uid; copy->uid = source->uid; copy->has_gid = source->has_gid; copy->gid = source->gid; copy->timeout = source->timeout; for (i = 0; i < copy->length; i++) copy->arg[i] = Str_dup(source->arg[i]); copy->arg[copy->length] = NULL; return copy; } static void _setPEM(char **store, char *path, const char *description, bool isFile) { if (*store) { yyerror2("Duplicate %s", description); FREE(path); } else if (! File_exist(path)) { yyerror2("%s doesn't exist", description); FREE(path); } else if (! (isFile ? File_isFile(path) : File_isDirectory(path))) { yyerror2("%s is not a %s", description, isFile ? "file" : "directory"); FREE(path); } else if (! File_isReadable(path)) { yyerror2("Cannot read %s", description); FREE(path); } else { sslset.flags = SSL_Enabled; *store = path; } } static void _setSSLOptions(SslOptions_T options) { options->allowSelfSigned = sslset.allowSelfSigned; options->CACertificateFile = sslset.CACertificateFile; options->CACertificatePath = sslset.CACertificatePath; options->checksum = sslset.checksum; options->checksumType = sslset.checksumType; options->ciphers = sslset.ciphers; options->clientpemfile = sslset.clientpemfile; options->flags = sslset.flags; options->pemfile = sslset.pemfile; options->pemchain = sslset.pemchain; options->pemkey = sslset.pemkey; options->verify = sslset.verify; options->version = sslset.version; reset_sslset(); } #ifdef HAVE_OPENSSL static void _setSSLVersion(short version) { sslset.flags = SSL_Enabled; if (sslset.version == -1) sslset.version = version; else sslset.version |= version; } #endif static void _unsetSSLVersion(short version) { if (sslset.version != -1) sslset.version &= ~version; } static void addsecurityattribute(char *value, Action_Type failed, Action_Type succeeded) { SecurityAttribute_T attr; NEW(attr); addeventaction(&(attr->action), failed, succeeded); attr->attribute = value; attr->next = current->secattrlist; current->secattrlist = attr; } static void addfiledescriptors(Operator_Type operator, bool total, long long value_absolute, float value_percent, Action_Type failed, Action_Type succeeded) { Filedescriptors_T fds; NEW(fds); addeventaction(&(fds->action), failed, succeeded); fds->total = total; fds->limit_absolute = value_absolute; fds->limit_percent = value_percent; fds->operator = operator; fds->next = current->filedescriptorslist; current->filedescriptorslist = fds; } static void _sanityCheckEveryStatement(Service_T s) { if (s->every.type != Every_Initializing) { yywarning2("The 'every' statement can be specified only once, the last value will be used\n"); switch (s->every.type) { case Every_Cron: case Every_NotInCron: FREE(s->every.spec.cron); break; default: break; } } } // Turn back on unreachable code warnings #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic pop #endif monit-5.35.2/src/md5.h0000644000016400001720000000615015007061157011301 00000000000000/* Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com * Sub-licensed with modifications under AGPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MD5_H #define MD5_H /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is * defined as non-zero, the code will be compiled to run only on big-endian * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ typedef unsigned char md5_byte_t; /* 8-bit byte */ typedef unsigned int md5_word_t; /* 32-bit word */ /* Define the context of the MD5 Algorithm. */ typedef struct md5_context_s { md5_word_t count[2]; /* message length in bits, lsw first */ md5_word_t abcd[4]; /* digest buffer */ md5_byte_t buf[64]; /* accumulate block */ } md5_context_t; /* Initialize the algorithm. */ void md5_init(md5_context_t *pms); /* Append a string to the message. */ void md5_append(md5_context_t *pms, const md5_byte_t *data, int nbytes); /* Finish the message and return the digest. */ void md5_finish(md5_context_t *pms, md5_byte_t digest[16]); #endif monit-5.35.2/src/validate.c0000644000016400001720000041452415007061157012410 00000000000000 /* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_SETJMP_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_IFADDRS_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_NETINET_IN_SYSTM_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_NETINET_IP_H #include #endif #ifdef HAVE_NETINET_IP_ICMP_H #include #endif #include "monit.h" #include "alert.h" #include "event.h" #include "device.h" #include "net/net.h" #include "SystemInfo.h" #include "ProcessTree.h" #include "protocol.h" #include "md5.h" #include "sha1.h" #include "checksum.h" // libmonit #include "system/Time.h" #include "util/Fmt.h" #include "io/File.h" #include "io/InputStream.h" #include "exceptions/AssertException.h" /** * Implementation of validation engine * * @file */ /* ----------------------------------------------------------------- Private */ /** * Read program output. The output is saved to StringBuffer up to Run.limits.programOutput, * remaining bytes are dropped (must read whole output so the program doesn't hang on full * stdout / stderr pipe). */ static void _programOutput(InputStream_T I, StringBuffer_T S) { int n; char buf[STRLEN]; InputStream_setTimeout(I, 0); do { n = InputStream_readBytes(I, buf, sizeof(buf) - 1); if (n > 0 && StringBuffer_length(S) < Run.limits.programOutput) { buf[n] = 0; StringBuffer_append(S, "%s", buf); } } while (n > 0); } /** * Test the connection and protocol */ static State_Type _checkConnection(Service_T s, Port_T p) { assert(s); assert(p); volatile int retry_count = p->retry; volatile State_Type rv = State_Succeeded; char buf[STRLEN]; char report[1024] = {}; retry: TRY { Socket_test(p); rv = p->check_invers ? State_Failed : State_Succeeded; DEBUG("'%s' succeeded testing protocol [%s] at %s [response time %s]\n", s->name, p->protocol->name, Util_portDescription(p, buf, sizeof(buf)), Fmt_time2str(p->responsetime.current, (char[11]){})); } ELSE { rv = p->check_invers ? State_Succeeded : State_Failed; snprintf(report, sizeof(report), "failed protocol test [%s] at %s -- %s", p->protocol->name, Util_portDescription(p, buf, sizeof(buf)), Exception_frame.message); } END_TRY; if ((rv == State_Failed && ! p->check_invers) || (rv == State_Succeeded && p->check_invers)) { if (retry_count-- > 1) { Log_warning("'%s' %s (attempt %d/%d)\n", s->name, report, p->retry - retry_count, p->retry); goto retry; } Event_post(s, Event_Connection, p->check_invers ? State_Succeeded : State_Failed, p->action, "%s", report); } else { Event_post(s, Event_Connection, p->check_invers ? State_Failed : State_Succeeded, p->action, "connection succeeded to %s", Util_portDescription(p, buf, sizeof(buf))); } if (p->responsetime.limit > -1.) { if (Util_evalDoubleQExpression(p->responsetime.operator, p->responsetime.current, p->responsetime.limit)) { Event_post(s, Event_Speed, State_Succeeded, p->action, "response time %s succeeded [time %s %s]", Fmt_time2str(p->responsetime.current, (char[11]){}), OperatorShort_Names[p->responsetime.operator], Fmt_time2str(p->responsetime.limit, (char[11]){})); } else { rv = State_Failed; Event_post(s, Event_Speed, State_Failed, p->action, "response time %s doesn't match limit [time %s %s]", Fmt_time2str(p->responsetime.current, (char[11]){}), OperatorShort_Names[p->responsetime.operator], Fmt_time2str(p->responsetime.limit, (char[11]){})); } } if (p->target.net.ssl.options.flags && p->target.net.ssl.certificate.validDays >= 0 && p->target.net.ssl.certificate.minimumDays > 0) { if (p->target.net.ssl.certificate.validDays < p->target.net.ssl.certificate.minimumDays) { Event_post(s, Event_Timestamp, State_Failed, p->action, "certificate expiry in %d days matches check limit [valid > %d days]", p->target.net.ssl.certificate.validDays, p->target.net.ssl.certificate.minimumDays); rv = State_Failed; } else { Event_post(s, Event_Timestamp, State_Succeeded, p->action, "certificate valid days test succeeded [valid for %d days]", p->target.net.ssl.certificate.validDays); } } return rv; } /** * Test process state (e.g. Zombie) */ static State_Type _checkProcessState(Service_T s) { assert(s); if (s->inf.process->zombie) { Event_post(s, Event_Data, State_Failed, s->action_DATA, "process with pid %d is a zombie", s->inf.process->pid); return State_Failed; } Event_post(s, Event_Data, State_Succeeded, s->action_DATA, "zombie check succeeded"); return State_Succeeded; } /** * Test process pid for possible change since last cycle */ static State_Type _checkProcessPid(Service_T s) { assert(s); if (s->inf.process->_pid < 0 || s->inf.process->pid < 0) // process pid was not initialized yet return State_Init; if (s->inf.process->_pid != s->inf.process->pid) { for (Pid_T l = s->pidlist; l; l = l->next) Event_post(s, Event_Pid, State_Changed, l->action, "process PID changed from %d to %d", s->inf.process->_pid, s->inf.process->pid); return State_Changed; } for (Pid_T l = s->pidlist; l; l = l->next) Event_post(s, Event_Pid, State_ChangedNot, l->action, "process PID has not changed since last cycle"); return State_ChangedNot; } /** * Test process ppid for possible change since last cycle */ static State_Type _checkProcessPpid(Service_T s) { assert(s); if (s->inf.process->_ppid < 0 || s->inf.process->ppid < 0) // process ppid was not initialized yet return State_Init; if (s->inf.process->_ppid != s->inf.process->ppid) { for (Pid_T l = s->ppidlist; l; l = l->next) Event_post(s, Event_PPid, State_Changed, l->action, "process PPID changed from %d to %d", s->inf.process->_ppid, s->inf.process->ppid); return State_Changed; } for (Pid_T l = s->ppidlist; l; l = l->next) Event_post(s, Event_PPid, State_ChangedNot, l->action, "process PPID has not changed since last cycle"); return State_ChangedNot; } static State_Type _checkLoadAverage(Resource_T r, double loadavg, const char *name, char report[STRLEN]) { if (Util_evalDoubleQExpression(r->operator, loadavg, r->limit)) { snprintf(report, STRLEN, "%s of %.1f matches resource limit [%s %s %.1f]", name, loadavg, name, OperatorShort_Names[r->operator], r->limit); return State_Failed; } snprintf(report, STRLEN, "%s check succeeded [current %s = %.1f]", name, name, loadavg); return State_Succeeded; } /** * Check process resources */ static State_Type _checkProcessResources(Service_T s, Resource_T r) { assert(s); assert(r); State_Type rv = State_Succeeded; char report[STRLEN] = {}, buf1[10], buf2[10]; switch (r->resource_id) { case Resource_CpuPercent: if (s->inf.process->cpu_percent < 0.) { DEBUG("'%s' cpu usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->cpu_percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu usage of %.1f%% matches resource limit [cpu usage %s %.1f%%]", s->inf.process->cpu_percent, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu usage check succeeded [current cpu usage = %.1f%%]", s->inf.process->cpu_percent); } break; case Resource_CpuPercentTotal: if (s->inf.process->total_cpu_percent < 0.) { DEBUG("'%s' total cpu usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->total_cpu_percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "total cpu usage of %.1f%% matches resource limit [cpu usage %s %.1f%%]", s->inf.process->total_cpu_percent, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "total cpu usage check succeeded [current cpu usage = %.1f%%]", s->inf.process->total_cpu_percent); } break; case Resource_MemoryPercent: if (s->inf.process->mem_percent < 0.) { DEBUG("'%s' memory usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->mem_percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage %s %.1f%%]", s->inf.process->mem_percent, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "mem usage check succeeded [current mem usage = %.1f%%]", s->inf.process->mem_percent); } break; case Resource_MemoryKbyte: if (s->inf.process->mem == 0) { DEBUG("'%s' process memory usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->mem, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "mem amount of %s matches resource limit [mem amount %s %s]", Fmt_bytes2str(s->inf.process->mem, buf1), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, buf2)); } else { snprintf(report, STRLEN, "mem amount check succeeded [current mem amount = %s]", Fmt_bytes2str(s->inf.process->mem, buf1)); } break; case Resource_Threads: if (s->inf.process->threads < 0) { DEBUG("'%s' process threads count check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->threads, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "threads count %i matches resource limit [threads %s %.0f]", s->inf.process->threads, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "threads check succeeded [current threads = %i]", s->inf.process->threads); } break; case Resource_Children: if (s->inf.process->children < 0) { DEBUG("'%s' process children count check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->children, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "children count %i matches resource limit [children %s %.0f]", s->inf.process->children, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "children check succeeded [current children = %i]", s->inf.process->children); } break; case Resource_MemoryKbyteTotal: if (s->inf.process->total_mem == 0) { DEBUG("'%s' process total memory usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->total_mem, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "total mem amount of %s matches resource limit [total mem amount %s %s]", Fmt_bytes2str(s->inf.process->total_mem, buf1), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, buf2)); } else { snprintf(report, STRLEN, "total mem amount check succeeded [current total mem amount = %s]", Fmt_bytes2str(s->inf.process->total_mem, buf1)); } break; case Resource_MemoryPercentTotal: if (s->inf.process->total_mem_percent < 0.) { DEBUG("'%s' total memory usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, s->inf.process->total_mem_percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "total mem amount of %.1f%% matches resource limit [total mem amount %s %.1f%%]", (float)s->inf.process->total_mem_percent, OperatorShort_Names[r->operator], (float)r->limit); } else { snprintf(report, STRLEN, "total mem amount check succeeded [current total mem amount = %.1f%%]", s->inf.process->total_mem_percent); } break; case Resource_ReadBytes: if (Statistics_initialized(&(s->inf.process->read.bytes))) { double value = Statistics_deltaNormalize(&(s->inf.process->read.bytes)); if (Util_evalDoubleQExpression(r->operator, value, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "read rate %s/s matches resource limit [read %s %s/s]", Fmt_bytes2str(value, (char[10]){}), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, (char[10]){})); } else { snprintf(report, STRLEN, "read rate test succeeded [current read = %s/s]", Fmt_bytes2str(value, (char[10]){})); } } else { DEBUG("'%s' warning -- no data are available for bytes read rate test\n", s->name); return State_Init; } break; case Resource_ReadBytesPhysical: if (Statistics_initialized(&(s->inf.process->read.bytesPhysical))) { double value = Statistics_deltaNormalize(&(s->inf.process->read.bytesPhysical)); if (Util_evalDoubleQExpression(r->operator, value, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "physical read activity %s/s matches resource limit [read %s %s/s]", Fmt_bytes2str(value, (char[10]){}), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, (char[10]){})); } else { snprintf(report, STRLEN, "physical read activity test succeeded [current read = %s/s]", Fmt_bytes2str(value, (char[10]){})); } } else { DEBUG("'%s' warning -- no data are available for physical read activity test\n", s->name); return State_Init; } break; case Resource_ReadOperations: if (Statistics_initialized(&(s->inf.process->read.operations))) { double value = Statistics_deltaNormalize(&(s->inf.process->read.operations)); if (Util_evalDoubleQExpression(r->operator, value, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "read rate %.1f operations/s matches resource limit [read %s %.0f operations/s]", value, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "read rate test succeeded [current read = %.1f operations/s]", value); } } else { DEBUG("'%s' warning -- no data are available for read rate test\n", s->name); return State_Init; } break; case Resource_WriteBytes: if (Statistics_initialized(&(s->inf.process->write.bytes))) { double value = Statistics_deltaNormalize(&(s->inf.process->write.bytes)); if (Util_evalDoubleQExpression(r->operator, value, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "write rate %s/s matches resource limit [write %s %s/s]", Fmt_bytes2str(value, (char[10]){}), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, (char[10]){})); } else { snprintf(report, STRLEN, "write rate test succeeded [current write = %s/s]", Fmt_bytes2str(value, (char[10]){})); } } else { DEBUG("'%s' warning -- no data are available for bytes write rate test\n", s->name); return State_Init; } break; case Resource_WriteBytesPhysical: if (Statistics_initialized(&(s->inf.process->write.bytesPhysical))) { double value = Statistics_deltaNormalize(&(s->inf.process->write.bytesPhysical)); if (Util_evalDoubleQExpression(r->operator, value, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "physical write activity %s/s matches resource limit [write %s %s/s]", Fmt_bytes2str(value, (char[10]){}), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, (char[10]){})); } else { snprintf(report, STRLEN, "physical write activity test succeeded [current write = %s/s]", Fmt_bytes2str(value, (char[10]){})); } } else { DEBUG("'%s' warning -- no data are available for physical write activity test\n", s->name); return State_Init; } break; case Resource_WriteOperations: if (Statistics_initialized(&(s->inf.process->write.operations))) { double value = Statistics_deltaNormalize(&(s->inf.process->write.operations)); if (Util_evalDoubleQExpression(r->operator, value, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "write rate %.1f operations/s matches resource limit [write %s %.0f operations/s]", value, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "write rate test succeeded [current write = %.1f operations/s]", value); } } else { DEBUG("'%s' warning -- no data are available for write rate test\n", s->name); return State_Init; } break; case Resource_LoadAverage1m: rv = _checkLoadAverage(r, System_Info.loadavg[0], "loadavg (1min)", report); break; case Resource_LoadAverage5m: rv = _checkLoadAverage(r, System_Info.loadavg[1], "loadavg (5min)", report); break; case Resource_LoadAverage15m: rv = _checkLoadAverage(r, System_Info.loadavg[2], "loadavg (15min)", report); break; case Resource_LoadAveragePerCore1m: rv = _checkLoadAverage(r, System_Info.loadavg[0] / (double)System_Info.cpu.count, "loadavg per core (1min)", report); break; case Resource_LoadAveragePerCore5m: rv = _checkLoadAverage(r, System_Info.loadavg[1] / (double)System_Info.cpu.count, "loadavg per core (5min)", report); break; case Resource_LoadAveragePerCore15m: rv = _checkLoadAverage(r, System_Info.loadavg[2] / (double)System_Info.cpu.count, "loadavg per core (15min)", report); break; default: Log_error("'%s' error -- unknown resource ID: [%d]\n", s->name, r->resource_id); return State_Failed; } Event_post(s, Event_Resource, rv, r->action, "%s", report); return rv; } static State_Type _checkSystemResources(Service_T s, Resource_T r) { assert(s); assert(r); State_Type rv = State_Succeeded; char report[STRLEN] = {}, buf1[10], buf2[10]; switch (r->resource_id) { case Resource_CpuPercent: { float cpu = (System_Info.cpu.usage.system > 0. ? System_Info.cpu.usage.system : 0.) + (System_Info.cpu.usage.user > 0. ? System_Info.cpu.usage.user : 0.); if (cpu < 0.) { DEBUG("'%s' cpu usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, cpu, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu usage of %.1f%% matches resource limit [cpu usage %s %.1f%%]", cpu, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu usage check succeeded [current cpu usage = %.1f%%]", cpu); } } break; case Resource_CpuUser: if (System_Info.cpu.usage.user < 0.) { DEBUG("'%s' cpu user usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.user, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu user usage of %.1f%% matches resource limit [cpu user usage %s %.1f%%]", System_Info.cpu.usage.user, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu user usage check succeeded [current cpu user usage = %.1f%%]", System_Info.cpu.usage.user); } break; case Resource_CpuSystem: if (System_Info.cpu.usage.system < 0.) { DEBUG("'%s' cpu system usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.system, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu system usage of %.1f%% matches resource limit [cpu system usage %s %.1f%%]", System_Info.cpu.usage.system, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu system usage check succeeded [current cpu system usage = %.1f%%]", System_Info.cpu.usage.system); } break; case Resource_CpuWait: if (System_Info.statisticsAvailable & Statistics_CpuIOWait) { if (System_Info.cpu.usage.iowait < 0.) { DEBUG("'%s' cpu I/O wait check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.iowait, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu I/O wait of %.1f%% matches resource limit [cpu I/O wait %s %.1f%%]", System_Info.cpu.usage.iowait, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu I/O wait check succeeded [current cpu I/O wait = %.1f%%]", System_Info.cpu.usage.iowait); } } else { Log_warning("Cannot test cpu I/O wait usage as the statistics is not available on this system\n"); } break; case Resource_CpuNice: if (System_Info.statisticsAvailable & Statistics_CpuNice) { if (System_Info.cpu.usage.nice < 0.) { DEBUG("'%s' cpu nice usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.nice, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu nice usage of %.1f%% matches resource limit [cpu nice usage %s %.1f%%]", System_Info.cpu.usage.nice, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu nice usage check succeeded [current cpu nice usage = %.1f%%]", System_Info.cpu.usage.nice); } } else { Log_warning("Cannot test cpu nice usage as the statistics is not available on this system\n"); } break; case Resource_CpuHardIRQ: if (System_Info.statisticsAvailable & Statistics_CpuHardIRQ) { if (System_Info.cpu.usage.hardirq < 0.) { DEBUG("'%s' cpu hardware IRQ usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.hardirq, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu hardware IRQ usage of %.1f%% matches resource limit [cpu hardware IRQ usage %s %.1f%%]", System_Info.cpu.usage.hardirq, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu hardware IRQ usage check succeeded [current cpu hardware IRQ usage = %.1f%%]", System_Info.cpu.usage.hardirq); } } else { Log_warning("Cannot test cpu hardware IRQ usage as the statistics is not available on this system\n"); } break; case Resource_CpuSoftIRQ: if (System_Info.statisticsAvailable & Statistics_CpuSoftIRQ) { if (System_Info.cpu.usage.softirq < 0.) { DEBUG("'%s' cpu software IRQ usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.softirq, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu software IRQ usage of %.1f%% matches resource limit [cpu software IRQ usage %s %.1f%%]", System_Info.cpu.usage.softirq, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu software IRQ usage check succeeded [current cpu software IRQ usage = %.1f%%]", System_Info.cpu.usage.softirq); } } else { Log_warning("Cannot test cpu software IRQ usage as the statistics is not available on this system\n"); } break; case Resource_CpuSteal: if (System_Info.statisticsAvailable & Statistics_CpuSteal) { if (System_Info.cpu.usage.steal < 0.) { DEBUG("'%s' cpu steal usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.steal, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu steal usage of %.1f%% matches resource limit [cpu steal usage %s %.1f%%]", System_Info.cpu.usage.steal, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu steal usage check succeeded [current cpu steal usage = %.1f%%]", System_Info.cpu.usage.steal); } } else { Log_warning("Cannot test cpu steal usage as the statistics is not available on this system\n"); } break; case Resource_CpuGuest: if (System_Info.statisticsAvailable & Statistics_CpuGuest) { if (System_Info.cpu.usage.guest < 0.) { DEBUG("'%s' cpu guest usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.guest, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu guest usage of %.1f%% matches resource limit [cpu guest usage %s %.1f%%]", System_Info.cpu.usage.guest, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu guest usage check succeeded [current cpu guest usage = %.1f%%]", System_Info.cpu.usage.guest); } } else { Log_warning("Cannot test cpu guest usage as the statistics is not available on this system\n"); } break; case Resource_CpuGuestNice: if (System_Info.statisticsAvailable & Statistics_CpuGuestNice) { if (System_Info.cpu.usage.guest_nice < 0.) { DEBUG("'%s' cpu guest nice usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, System_Info.cpu.usage.guest_nice, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu guest nice usage of %.1f%% matches resource limit [cpu guest nice usage %s %.1f%%]", System_Info.cpu.usage.guest_nice, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu guest nice usage check succeeded [current cpu guest nice usage = %.1f%%]", System_Info.cpu.usage.guest_nice); } } else { Log_warning("Cannot test cpu guestnice usage as the statistics is not available on this system\n"); } break; case Resource_MemoryPercent: if (Util_evalDoubleQExpression(r->operator, System_Info.memory.usage.percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage %s %.1f%%]", System_Info.memory.usage.percent, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "mem usage check succeeded [current mem usage = %.1f%%]", System_Info.memory.usage.percent); } break; case Resource_MemoryKbyte: if (Util_evalDoubleQExpression(r->operator, System_Info.memory.usage.bytes, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "mem amount of %s matches resource limit [mem amount %s %s]", Fmt_bytes2str(System_Info.memory.usage.bytes, buf1), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, buf2)); } else { snprintf(report, STRLEN, "mem amount check succeeded [current mem amount = %s]", Fmt_bytes2str(System_Info.memory.usage.bytes, buf1)); } break; case Resource_SwapPercent: if (Util_evalDoubleQExpression(r->operator, System_Info.swap.usage.percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "swap usage of %.1f%% matches resource limit [swap usage %s %.1f%%]", System_Info.swap.usage.percent, OperatorShort_Names[r->operator], r->limit); } else { snprintf(report, STRLEN, "swap usage check succeeded [current swap usage = %.1f%%]", System_Info.swap.usage.percent); } break; case Resource_SwapKbyte: if (s->type == Service_System) { if (Util_evalDoubleQExpression(r->operator, System_Info.swap.usage.bytes, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "swap amount of %s matches resource limit [swap amount %s %s]", Fmt_bytes2str(System_Info.swap.usage.bytes, buf1), OperatorShort_Names[r->operator], Fmt_bytes2str(r->limit, buf2)); } else { snprintf(report, STRLEN, "swap amount check succeeded [current swap amount = %s]", Fmt_bytes2str(System_Info.swap.usage.bytes, buf1)); } } break; case Resource_LoadAverage1m: rv = _checkLoadAverage(r, System_Info.loadavg[0], "loadavg (1min)", report); break; case Resource_LoadAverage5m: rv = _checkLoadAverage(r, System_Info.loadavg[1], "loadavg (5min)", report); break; case Resource_LoadAverage15m: rv = _checkLoadAverage(r, System_Info.loadavg[2], "loadavg (15min)", report); break; case Resource_LoadAveragePerCore1m: rv = _checkLoadAverage(r, System_Info.loadavg[0] / (double)System_Info.cpu.count, "loadavg per core (1min)", report); break; case Resource_LoadAveragePerCore5m: rv = _checkLoadAverage(r, System_Info.loadavg[1] / (double)System_Info.cpu.count, "loadavg per core (5min)", report); break; case Resource_LoadAveragePerCore15m: rv = _checkLoadAverage(r, System_Info.loadavg[2] / (double)System_Info.cpu.count, "loadavg per core (15min)", report); break; default: Log_error("'%s' error -- unknown resource ID: [%d]\n", s->name, r->resource_id); return State_Failed; } Event_post(s, Event_Resource, rv, r->action, "%s", report); return rv; } /** * Test for associated path checksum change */ static State_Type _checkChecksum(Service_T s) { assert(s); assert(s->path); State_Type rv = State_Succeeded; if (s->checksum) { Checksum_T cs = s->checksum; if (Checksum_getChecksum(s->path, cs->type, s->inf.file->cs_sum, sizeof(s->inf.file->cs_sum))) { Event_post(s, Event_Data, State_Succeeded, s->action_DATA, "checksum %s", s->inf.file->cs_sum); if (! cs->initialized) { cs->initialized = true; snprintf(cs->hash, sizeof(cs->hash), "%s", s->inf.file->cs_sum); } int changed; switch (cs->type) { case Hash_Md5: changed = strncmp(cs->hash, s->inf.file->cs_sum, 32); break; case Hash_Sha1: changed = strncmp(cs->hash, s->inf.file->cs_sum, 40); break; default: Log_error("'%s' unknown hash type (%d)\n", s->name, cs->type); *s->inf.file->cs_sum = 0; return State_Failed; } if (changed) { if (cs->test_changes) { rv = State_Changed; /* reset expected value for next cycle */ snprintf(cs->hash, sizeof(cs->hash), "%s", s->inf.file->cs_sum); /* if we are testing for changes only, the value is variable */ Event_post(s, Event_Checksum, State_Changed, cs->action, "checksum changed to %s", s->inf.file->cs_sum); } else { /* we are testing constant value for failed or succeeded state */ rv = State_Failed; Event_post(s, Event_Checksum, State_Failed, cs->action, "checksum failed, expected %s got %s", cs->hash, s->inf.file->cs_sum); } } else if (cs->test_changes) { rv = State_ChangedNot; Event_post(s, Event_Checksum, State_ChangedNot, cs->action, "checksum has not changed"); } else { Event_post(s, Event_Checksum, State_Succeeded, cs->action, "checksum is valid"); } return rv; } Event_post(s, Event_Data, State_Failed, s->action_DATA, "cannot compute checksum for %s", s->path); return State_Failed; } return rv; } /** * Test for associated path permission change */ static State_Type _checkPerm(Service_T s, int mode) { assert(s); if (s->perm) { if (mode >= 0) { mode_t m = mode & 07777; if (m != (mode_t)s->perm->perm) { if (s->perm->test_changes) { Event_post(s, Event_Permission, State_Changed, s->perm->action, "permission for %s changed from %04o to %04o", s->path, s->perm->perm, m); s->perm->perm = m; return State_Changed; } else { Event_post(s, Event_Permission, State_Failed, s->perm->action, "permission test failed for %s [current permission %04o]", s->path, m); return State_Failed; } } else { if (s->perm->test_changes) { Event_post(s, Event_Permission, State_ChangedNot, s->perm->action, "permission not changed for %s", s->path); return State_ChangedNot; } else { Event_post(s, Event_Permission, State_Succeeded, s->perm->action, "permission test succeeded [current permission %04o]", m); return State_Succeeded; } } } return State_Init; } return State_Succeeded; } /** * Test UID of file or process */ static State_Type _checkUid(Service_T s, int uid) { assert(s); if (s->uid) { if (uid >= 0) { if ((uid_t)uid != s->uid->uid) { Event_post(s, Event_Uid, State_Failed, s->uid->action, "uid test failed for %s -- current uid is %d", s->name, uid); return State_Failed; } else { Event_post(s, Event_Uid, State_Succeeded, s->uid->action, "uid test succeeded [current uid = %d]", uid); return State_Succeeded; } } return State_Init; } return State_Succeeded; } /** * Test effective UID of process */ static State_Type _checkEuid(Service_T s, int euid) { assert(s); if (s->euid) { if (euid >= 0) { if ((uid_t)euid != s->euid->uid) { Event_post(s, Event_Uid, State_Failed, s->euid->action, "euid test failed for %s -- current euid is %d", s->name, euid); return State_Failed; } else { Event_post(s, Event_Uid, State_Succeeded, s->euid->action, "euid test succeeded [current euid = %d]", euid); return State_Succeeded; } } return State_Init; } return State_Succeeded; } static State_Type _checkSecurityAttribute(Service_T s, char *attribute) { assert(s); State_Type rv = State_Succeeded; const char *attr = NVLSTR(attribute); for (SecurityAttribute_T a = s->secattrlist; a; a = a->next) { if (IS(attr, a->attribute)) { Event_post(s, Event_Invalid, State_Succeeded, a->action, "Security attribute test succeeded [current attribute = '%s']", attr); } else { rv = State_Failed; Event_post(s, Event_Invalid, State_Failed, a->action, "Security attribute test failed for %s -- current attribute is '%s'", s->name, attr); } } return rv; } static State_Type _checkSystemFiledescriptors(Service_T s) { assert(s); State_Type rv = State_Succeeded; if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem) { for (Filedescriptors_T o = s->filedescriptorslist; o; o = o->next) { if (o->limit_absolute > -1LL) { if (Util_evalQExpression(o->operator, System_Info.filedescriptors.allocated, o->limit_absolute)) { rv = State_Failed; Event_post(s, Event_Resource, State_Failed, o->action, "filedescriptors usage of %lld matches limit [filedescriptors %s %lld]", System_Info.filedescriptors.allocated, OperatorShort_Names[o->operator], o->limit_absolute); } else { Event_post(s, Event_Resource, State_Succeeded, o->action, "filedescriptors test succeeded [current filedescriptors usage = %lld]", System_Info.filedescriptors.allocated); } } else { float usage = System_Info.filedescriptors.maximum > 0 ? ((float)100 * (float)System_Info.filedescriptors.allocated / (float)System_Info.filedescriptors.maximum) : 0; if (Util_evalDoubleQExpression(o->operator, usage, o->limit_percent)) { rv = State_Failed; Event_post(s, Event_Resource, State_Failed, o->action, "filedescriptors usage of %.1f%% matches limit [filedescriptors %s %.1f%%]", usage, OperatorShort_Names[o->operator], o->limit_percent); } else { Event_post(s, Event_Resource, State_Succeeded, o->action, "filedescriptors usage test succeeded [current filedescriptors usage = %.1f%%]", usage); } } } } else if (s->filedescriptorslist) { Log_warning("Cannot test filesdescriptors usage as the statistics is not available on this system\n"); } return rv; } static State_Type _checkProcessFiledescriptors(Service_T s) { assert(s); State_Type rv = State_Succeeded; for (Filedescriptors_T o = s->filedescriptorslist; o; o = o->next) { if (o->total) { if (Util_evalQExpression(o->operator, s->inf.process->filedescriptors.openTotal, o->limit_absolute)) { rv = State_Failed; Event_post(s, Event_Resource, State_Failed, o->action, "total filedescriptors usage of %lld matches limit [filedescriptors %s %lld]", s->inf.process->filedescriptors.openTotal, OperatorShort_Names[o->operator], o->limit_absolute); } else { Event_post(s, Event_Resource, State_Succeeded, o->action, "total filedescriptors usage test succeeded [current filedescriptors usage = %lld]", s->inf.process->filedescriptors.openTotal); } } else { if (o->limit_absolute > -1LL) { if (Util_evalQExpression(o->operator, s->inf.process->filedescriptors.open, o->limit_absolute)) { rv = State_Failed; Event_post(s, Event_Resource, State_Failed, o->action, "filedescriptors usage of %lld matches limit [filedescriptors %s %lld]", s->inf.process->filedescriptors.open, OperatorShort_Names[o->operator], o->limit_absolute); } else { Event_post(s, Event_Resource, State_Succeeded, o->action, "filedescriptors test succeeded [current filedescriptors usage = %lld]", s->inf.process->filedescriptors.open); } } else { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcessMax) { long long limit = s->inf.process->filedescriptors.limit.soft < s->inf.process->filedescriptors.limit.hard ? s->inf.process->filedescriptors.limit.soft : s->inf.process->filedescriptors.limit.hard; float usage = limit > 0 ? (float)100 * (float)s->inf.process->filedescriptors.open / (float)limit : 0; if (Util_evalDoubleQExpression(o->operator, usage, o->limit_percent)) { rv = State_Failed; Event_post(s, Event_Resource, State_Failed, o->action, "filedescriptors usage of %.1f%% matches limit [filedescriptors %s %.1f%%]", usage, OperatorShort_Names[o->operator], o->limit_percent); } else { Event_post(s, Event_Resource, State_Succeeded, o->action, "filedescriptors usage test succeeded [current filedescriptors usage = %.1f%%]", usage); } } else { Log_warning("Cannot compute filesdescriptors usage %% as per-process maximum is not exposed on this system -- filesdecriptors usage test skipped, please switch to testing absolute value\n"); } } } } return rv; } /** * Test GID of file or process */ static State_Type _checkGid(Service_T s, int gid) { assert(s); if (s->gid) { if (gid >= 0) { if ((gid_t)gid != s->gid->gid) { Event_post(s, Event_Gid, State_Failed, s->gid->action, "gid test failed for %s -- current gid is %d", s->name, gid); return State_Failed; } else { Event_post(s, Event_Gid, State_Succeeded, s->gid->action, "gid test succeeded [current gid = %d]", gid); return State_Succeeded; } } return State_Init; } return State_Succeeded; } static State_Type _checkTimestamp(Service_T s, Timestamp_T t, time_t timestamp) { State_Type rv = State_Succeeded; if (t->test_changes) { if (! t->initialized) { t->initialized = true; t->lastTimestamp = timestamp; } else { if (t->lastTimestamp != timestamp) { rv = State_Changed; Event_post(s, Event_Timestamp, State_Changed, t->action, "%s for %s changed from %s to %s", Timestamp_Names[t->type], s->path, t->lastTimestamp ? Time_localStr(t->lastTimestamp, (char[26]){}) : "N/A", Time_localStr(timestamp, (char[26]){})); t->lastTimestamp = timestamp; // reset expected value for next cycle } else { Event_post(s, Event_Timestamp, State_ChangedNot, t->action, "%s was not changed for %s", Timestamp_Names[t->type], s->path); } } } else { /* we are testing constant value for failed or succeeded state */ if (Util_evalQExpression(t->operator, Time_now() - timestamp, t->time)) { rv = State_Failed; Event_post(s, Event_Timestamp, State_Failed, t->action, "%s for %s failed -- current %s is %s", Timestamp_Names[t->type], s->path, Timestamp_Names[t->type], Time_localStr(timestamp, (char[26]){})); } else { Event_post(s, Event_Timestamp, State_Succeeded, t->action, "%s test succeeded for %s [current %s is %s]", Timestamp_Names[t->type], s->path, Timestamp_Names[t->type], Time_localStr(timestamp, (char[26]){})); } } return rv; } /** * Validate timestamps of a service s */ static State_Type _checkTimestamps(Service_T s, time_t atime, time_t ctime, time_t mtime) { assert(s); if (atime > 0 && ctime > 0 && mtime > 0) { State_Type rv; int failed = 0, changed = 0; for (Timestamp_T t = s->timestamplist; t; t = t->next) { switch (t->type) { case Timestamp_Access: rv = _checkTimestamp(s, t, atime); break; case Timestamp_Change: rv = _checkTimestamp(s, t, ctime); break; case Timestamp_Modification: rv = _checkTimestamp(s, t, mtime); break; default: rv = _checkTimestamp(s, t, MAX(mtime, ctime)); break; } if (rv == State_Failed) { failed++; } else if (rv == State_Changed) { changed++; } } return failed ? State_Failed : (changed ? State_Changed : State_Succeeded); } return State_Init; } /** * Test size */ static State_Type _checkSize(Service_T s, off_t size) { assert(s); if (size >= 0) { State_Type rv = State_Succeeded; if (s->sizelist) { char buf[10]; for (Size_T sl = s->sizelist; sl; sl = sl->next) { /* if we are testing for changes only, the value is variable */ if (sl->test_changes) { if (! sl->initialized) { /* the size was not initialized during monit start, so set the size now * and allow further size change testing */ sl->initialized = true; sl->size = size; } else { if ((off_t)sl->size != size) { rv = State_Changed; Event_post(s, Event_Size, State_Changed, sl->action, "size for %s changed to %s", s->path, Fmt_bytes2str(size, buf)); /* reset expected value for next cycle */ sl->size = size; } else { Event_post(s, Event_Size, State_ChangedNot, sl->action, "size has not changed [current size = %s]", Fmt_bytes2str(size, buf)); } } } else { /* we are testing constant value for failed or succeeded state */ if (Util_evalQExpression(sl->operator, size, sl->size)) { rv = State_Failed; Event_post(s, Event_Size, State_Failed, sl->action, "size test failed for %s -- current size is %s", s->path, Fmt_bytes2str(size, buf)); } else { Event_post(s, Event_Size, State_Succeeded, sl->action, "size check succeeded [current size = %s]", Fmt_bytes2str(size, buf)); } } } } return rv; } else { return State_Init; } } /** * Test hardlink * The number of used hard links does not fit to nlink_t, sometimes. */ static State_Type _checkHardlink(Service_T s, long long nlink) { assert(s); if (nlink >= 0) { State_Type rv = State_Succeeded; if (s->nlinklist) { for (NLink_T sl = s->nlinklist; sl; sl = sl->next) { /* if we are testing for changes only, the value is variable */ if (sl->test_changes) { if (! sl->initialized) { /* the size was not initialized during monit start, so set the size now * and allow further size change testing */ sl->initialized = true; sl->nlink = nlink; } else { if ((long long)sl->nlink != nlink) { rv = State_Changed; Event_post(s, Event_Resource, State_Changed, sl->action, "hardlink for %s changed to %llu", s->path, (unsigned long long)nlink); /* reset expected value for next cycle */ sl->nlink = nlink; } else { Event_post(s, Event_Resource, State_ChangedNot, sl->action, "hardlink has not changed [current hardlink = %llu]", (unsigned long long)nlink); } } } else { /* we are testing constant value for failed or succeeded state */ if (Util_evalQExpression(sl->operator, nlink, sl->nlink)) { rv = State_Failed; Event_post(s, Event_Resource, State_Failed, sl->action, "hardlink test failed for %s -- current hardlink is %llu", s->path, (unsigned long long)nlink); } else { Event_post(s, Event_Resource, State_Succeeded, sl->action, "hardlink check succeeded [current hardlink = %llu]", (unsigned long long)nlink); } } } } return rv; } else { return State_Init; } } /** * Test uptime */ static State_Type _checkUptime(Service_T s, long long uptime) { assert(s); State_Type rv = State_Succeeded; if (uptime < 0) return State_Init; for (Uptime_T ul = s->uptimelist; ul; ul = ul->next) { if (Util_evalQExpression(ul->operator, uptime, ul->uptime)) { rv = State_Failed; Event_post(s, Event_Uptime, State_Failed, ul->action, "uptime test failed for %s -- current uptime is %s", Fmt_time2str(ul->uptime, (char[11]){}), Fmt_time2str(uptime, (char[11]){})); } else { Event_post(s, Event_Uptime, State_Succeeded, ul->action, "uptime test succeeded [current uptime = %s]", Fmt_time2str(uptime, (char[11]){})); } } return rv; } static int _checkPattern(Match_T pattern, const char *line) { return regexec(pattern->regex_comp, line, 0, NULL, 0); } /** * Match content. * * The test compares only the lines terminated with \n. * * In the case that line with missing \n is read, the test stops, as we suppose that the file contains only partial line and the rest of it is yet stored in the buffer of the application which writes to the file. * The test will resume at the beginning of the incomplete line during the next cycle, allowing the writer to finish the write. * * We test only Run.limits.fileContentBuffer at maximum - in the case that the line is bigger, we read the rest of the line (till '\n') but ignore the characters past the maximum */ static State_Type _checkMatch(Service_T s) { assert(s); /* TODO: https://bitbucket.org/tildeslash/monit/issues/401 Refactor and use mmap instead of naive std file io. mmap can make code simpler, more efficient and support multi-line matching as there is no line-buffer, but the whole file is in the buffer. */ State_Type rv = State_Succeeded; if (s->matchlist) { FILE *file = fopen(s->path, "r"); if (! file) { Log_error("'%s' cannot open file %s: %s\n", s->name, s->path, STRERROR); return State_Failed; } /* FIXME: Refactor: Initialize the filesystems table ahead of file and filesystems test and index it by device id + replace the Str_startsWith() with lookup to the table by device id (obtained via file's stat()). The central filesystems initialization will allow to reduce the statfs() calls in the case that there will be multiple file and/or filesystems tests for the same fs. Temporarily we go with dummy Str_startsWith() as quick fix which will cover 99.9% of use cases without rising the statfs overhead if statfs call would be inlined here. */ if (Str_startsWith(s->path, "/proc")) { s->inf.file->readpos = 0; } else { /* If inode changed or size shrunk -> set read position = 0 */ if (s->inf.file->inode != s->inf.file->inode_prev || s->inf.file->readpos > s->inf.file->size) s->inf.file->readpos = 0; /* Do we need to match? Even if not, go to final, so we can reset the content match error flags in this cycle */ if (s->inf.file->readpos == s->inf.file->size) { DEBUG("'%s' content match skipped - file size nor inode has not changed since last test\n", s->name); goto final1; } } char *line = CALLOC(sizeof(unsigned char), Run.limits.fileContentBuffer); while (true) { next: /* Seek to the read position */ if (fseek(file, (long)s->inf.file->readpos, SEEK_SET)) { rv = State_Failed; Log_error("'%s' cannot seek file %s: %s\n", s->name, s->path, STRERROR); goto final2; } if (! fgets(line, (int)Run.limits.fileContentBuffer, file)) { if (! feof(file)) { rv = State_Failed; Log_error("'%s' cannot read file %s: %s\n", s->name, s->path, STRERROR); } goto final2; } size_t length = strlen(line); if (length == 0) { /* No content: shouldn't happen - empty line will contain at least '\n' */ goto final2; } else if (line[length - 1] != '\n') { if (length < Run.limits.fileContentBuffer - 1) { /* Incomplete line: we gonna read it next time again, allowing the writer to complete the write */ DEBUG("'%s' content match: incomplete line read - no new line at end. (retrying next cycle)\n", s->name); goto final2; } else if (length >= Run.limits.fileContentBuffer - 1) { /* Our read buffer is full: ignore the content past the Run.limits.fileContentBuffer */ int _rv; do { if ((_rv = fgetc(file)) == EOF) goto final2; length++; } while (_rv != '\n'); } } else { /* Remove trailing newline */ line[length - 1] = 0; } /* Set read position to the end of last read */ s->inf.file->readpos += length; /* Check ignores */ for (Match_T ml = s->matchignorelist; ml; ml = ml->next) { if ((_checkPattern(ml, line) == 0) ^ (ml->not)) { /* We match! -> line is ignored! */ DEBUG("'%s' Ignore pattern %s'%s' match on content line\n", s->name, ml->not ? "not " : "", ml->match_string); goto next; } } /* Check non ignores */ for (Match_T ml = s->matchlist; ml; ml = ml->next) { if ((_checkPattern(ml, line) == 0) ^ (ml->not)) { DEBUG("'%s' Pattern %s'%s' match on content line [%s]\n", s->name, ml->not ? "not " : "", ml->match_string, line); /* Save the line for Event_post */ if (! ml->log) ml->log = StringBuffer_create((int)Run.limits.fileContentBuffer); if ((size_t)StringBuffer_length(ml->log) < Run.limits.fileContentBuffer) { StringBuffer_append(ml->log, "%s\n", line); if ((size_t)StringBuffer_length(ml->log) >= Run.limits.fileContentBuffer) StringBuffer_append(ml->log, "...\n"); } } else { DEBUG("'%s' Pattern %s'%s' doesn't match on content line [%s]\n", s->name, ml->not ? "not " : "", ml->match_string, line); } } } final2: FREE(line); final1: if (fclose(file)) { rv = State_Failed; Log_error("'%s' cannot close file %s: %s\n", s->name, s->path, STRERROR); } /* Post process the matches: generate events for particular patterns */ for (Match_T ml = s->matchlist; ml; ml = ml->next) { if (ml->log) { rv = State_Changed; Event_post(s, Event_Content, State_Changed, ml->action, "content match:\n%s", StringBuffer_toString(ml->log)); if (ml->log) { // If the service has dependants, the dependant tests if the parent service (file) is running with no errors before it'll be allowed to start. That recursive check_file() call will // enter the _checkMatch() too and will free the SringBuffer as part of Event_post => must check ml->log here again before free StringBuffer_free(&ml->log); } } else { Event_post(s, Event_Content, State_ChangedNot, ml->action, "content doesn't match"); } } } return rv; } /** * Test filesystem flags for possible change since last cycle */ static State_Type _checkFilesystemFlags(Service_T s) { assert(s); FilesystemFlags_T f = &(s->inf.filesystem->flags); if (*(f->current) && *(f->previous)) { if (! IS(f->previous, f->current)) { for (FsFlag_T l = s->fsflaglist; l; l = l->next) Event_post(s, Event_FsFlag, State_Changed, l->action, "filesystem flags changed from '%s' to '%s'", f->previous, f->current); return State_Changed; } for (FsFlag_T l = s->fsflaglist; l; l = l->next) Event_post(s, Event_FsFlag, State_ChangedNot, l->action, "filesystem flags has not changed [current flags '%s']", f->current); return State_ChangedNot; } return State_Init; } /** * Filesystem test */ static State_Type _checkFilesystemResources(Service_T s, FileSystem_T td) { assert(s); assert(td); if ((td->limit_percent < 0) && (td->limit_absolute < 0)) { Log_error("'%s' error: filesystem limit not set\n", s->name); return State_Failed; } switch (td->resource) { case Resource_Inode: if (s->inf.filesystem->f_files <= 0) { DEBUG("'%s' filesystem doesn't support inodes\n", s->name); return State_Succeeded; } if (td->limit_percent >= 0.) { if (Util_evalDoubleQExpression(td->operator, s->inf.filesystem->inode_percent, td->limit_percent)) { Event_post(s, Event_Resource, State_Failed, td->action, "inode usage %.1f%% matches resource limit [inode usage %s %.1f%%]", s->inf.filesystem->inode_percent, OperatorShort_Names[td->operator], td->limit_percent); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "inode usage test succeeded [current inode usage = %.1f%%]", s->inf.filesystem->inode_percent); } } else { if (Util_evalQExpression(td->operator, s->inf.filesystem->f_filesused, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "inode usage %lld matches resource limit [inode usage %s %lld]", s->inf.filesystem->f_filesused, OperatorShort_Names[td->operator], td->limit_absolute); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "inode usage test succeeded [current inode usage = %lld]", s->inf.filesystem->f_filesused); } } return State_Succeeded; case Resource_InodeFree: if (s->inf.filesystem->f_files <= 0) { DEBUG("'%s' filesystem doesn't support inodes\n", s->name); return State_Succeeded; } if (td->limit_percent >= 0.) { if (Util_evalDoubleQExpression(td->operator, 100. - s->inf.filesystem->inode_percent, td->limit_percent)) { Event_post(s, Event_Resource, State_Failed, td->action, "inode free %.1f%% matches resource limit [inode free %s %.1f%%]", 100. - s->inf.filesystem->inode_percent, OperatorShort_Names[td->operator], td->limit_percent); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "inode free test succeeded [current inode free = %.1f%%]", 100. - s->inf.filesystem->inode_percent); } } else { if (Util_evalQExpression(td->operator, s->inf.filesystem->f_filesfree, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "inode free %lld matches resource limit [inode free %s %lld]", s->inf.filesystem->f_filesfree, OperatorShort_Names[td->operator], td->limit_absolute); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "inode free test succeeded [current inode free = %lld]", s->inf.filesystem->f_filesfree); } } return State_Succeeded; case Resource_Space: if (td->limit_percent >= 0.) { if (Util_evalDoubleQExpression(td->operator, s->inf.filesystem->space_percent, td->limit_percent)) { Event_post(s, Event_Resource, State_Failed, td->action, "space usage %.1f%% matches resource limit [space usage %s %.1f%%]", s->inf.filesystem->space_percent, OperatorShort_Names[td->operator], td->limit_percent); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "space usage test succeeded [current space usage = %.1f%%]", s->inf.filesystem->space_percent); } } else { long long bytesUsed = s->inf.filesystem->f_blocksused * (s->inf.filesystem->f_bsize > 0 ? s->inf.filesystem->f_bsize : 1); char buf1[10]; Fmt_bytes2str(bytesUsed, buf1); if (Util_evalQExpression(td->operator, bytesUsed, td->limit_absolute)) { char buf2[10]; Fmt_bytes2str(td->limit_absolute, buf2); Event_post(s, Event_Resource, State_Failed, td->action, "space usage %s matches resource limit [space usage %s %s]", buf1, OperatorShort_Names[td->operator], buf2); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "space usage test succeeded [current space usage = %s]", buf1); } } return State_Succeeded; case Resource_SpaceFree: if (td->limit_percent >= 0.) { if (Util_evalDoubleQExpression(td->operator, 100. - s->inf.filesystem->space_percent, td->limit_percent)) { Event_post(s, Event_Resource, State_Failed, td->action, "space free %.1f%% matches resource limit [space free %s %.1f%%]", 100. - s->inf.filesystem->space_percent, OperatorShort_Names[td->operator], td->limit_percent); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "space free test succeeded [current space free = %.1f%%]", 100. - s->inf.filesystem->space_percent); } } else { char buf1[10]; long long bytesFreeTotal = s->inf.filesystem->f_blocksfreetotal * (s->inf.filesystem->f_bsize > 0 ? s->inf.filesystem->f_bsize : 1); Fmt_bytes2str(bytesFreeTotal, buf1); if (Util_evalQExpression(td->operator, bytesFreeTotal, td->limit_absolute)) { char buf2[10]; Fmt_bytes2str(td->limit_absolute, buf2); Event_post(s, Event_Resource, State_Failed, td->action, "space free %s matches resource limit [space free %s %s]", buf1, OperatorShort_Names[td->operator], buf2); return State_Failed; } else { Event_post(s, Event_Resource, State_Succeeded, td->action, "space free test succeeded [current space free = %s]", buf1); } } return State_Succeeded; case Resource_ReadBytes: if (Statistics_initialized(&(s->inf.filesystem->read.bytes))) { double value = Statistics_deltaNormalize(&(s->inf.filesystem->read.bytes)); if (Util_evalDoubleQExpression(td->operator, value, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "read rate %s/s matches resource limit [read %s %s/s]", Fmt_bytes2str(value, (char[10]){}), OperatorShort_Names[td->operator], Fmt_bytes2str(td->limit_absolute, (char[10]){})); return State_Failed; } Event_post(s, Event_Resource, State_Succeeded, td->action, "read rate test succeeded [current read = %s/s]", Fmt_bytes2str(value, (char[10]){})); } else { DEBUG("'%s' warning -- no data are available for bytes read rate test\n", s->name); } return State_Succeeded; case Resource_ReadOperations: if (Statistics_initialized(&(s->inf.filesystem->read.operations))) { double value = Statistics_deltaNormalize(&(s->inf.filesystem->read.operations)); if (Util_evalDoubleQExpression(td->operator, value, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "read rate %.1f operations/s matches resource limit [read %s %llu operations/s]", value, OperatorShort_Names[td->operator], td->limit_absolute); return State_Failed; } Event_post(s, Event_Resource, State_Succeeded, td->action, "read rate test succeeded [current read = %.1f operations/s]", value); } else { DEBUG("'%s' warning -- no data are available for read rate test\n", s->name); } return State_Succeeded; case Resource_WriteBytes: if (Statistics_initialized(&(s->inf.filesystem->write.bytes))) { double value = Statistics_deltaNormalize(&(s->inf.filesystem->write.bytes)); if (Util_evalDoubleQExpression(td->operator, value, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "write rate %s/s matches resource limit [write %s %s/s]", Fmt_bytes2str(value, (char[10]){}), OperatorShort_Names[td->operator], Fmt_bytes2str(td->limit_absolute, (char[10]){})); return State_Failed; } Event_post(s, Event_Resource, State_Succeeded, td->action, "write rate test succeeded [current write = %s/s]", Fmt_bytes2str(value, (char[10]){})); } else { DEBUG("'%s' warning -- no data are available for bytes write rate test\n", s->name); } return State_Succeeded; case Resource_WriteOperations: if (Statistics_initialized(&(s->inf.filesystem->write.operations))) { double value = Statistics_deltaNormalize(&(s->inf.filesystem->write.operations)); if (Util_evalDoubleQExpression(td->operator, value, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "write rate %.1f operations/s matches resource limit [write %s %llu operations/s]", value, OperatorShort_Names[td->operator], td->limit_absolute); return State_Failed; } Event_post(s, Event_Resource, State_Succeeded, td->action, "write rate test succeeded [current write = %.1f operations/s]", value); } else { DEBUG("'%s' warning -- no data are available for write rate test\n", s->name); } return State_Succeeded; case Resource_ServiceTime: { double deltaTime = 0.; bool hasReadTime = Statistics_initialized(&(s->inf.filesystem->time.read)); bool hasWriteTime = Statistics_initialized(&(s->inf.filesystem->time.write)); bool hasWaitTime = Statistics_initialized(&(s->inf.filesystem->time.wait)); bool hasRunTime = Statistics_initialized(&(s->inf.filesystem->time.run)); // Some platforms have detailed R/W time (Linux, MacOS), other just total R/W time (*BSD), Solaris has total R/W time with wait/run granularity. To make the test cross-platform and simple, we operate on sum if (! hasReadTime && ! hasWriteTime && ! hasWaitTime && ! hasRunTime) { DEBUG("'%s' warning -- no data are available for service time test\n", s->name); return State_Succeeded; } if (hasReadTime) { deltaTime += Statistics_delta(&(s->inf.filesystem->time.read)); } if (hasWriteTime) { deltaTime += Statistics_delta(&(s->inf.filesystem->time.write)); } if (hasWaitTime) { deltaTime += Statistics_delta(&(s->inf.filesystem->time.wait)); } if (hasRunTime) { deltaTime += Statistics_delta(&(s->inf.filesystem->time.run)); } double deltaOperations = Statistics_delta(&(s->inf.filesystem->read.operations)) + Statistics_delta(&(s->inf.filesystem->write.operations)); double serviceTime = deltaOperations > 0. ? deltaTime / deltaOperations : 0.; if (Util_evalDoubleQExpression(td->operator, serviceTime, td->limit_absolute)) { Event_post(s, Event_Resource, State_Failed, td->action, "service time %s/operation matches resource limit [service time %s %s/operation]", Fmt_time2str(serviceTime, (char[11]){}), OperatorShort_Names[td->operator], Fmt_time2str(td->limit_absolute, (char[11]){})); return State_Failed; } Event_post(s, Event_Resource, State_Succeeded, td->action, "service time test succeeded [current service time = %s/operation]", Fmt_time2str(serviceTime, (char[11]){})); } return State_Succeeded; default: Log_error("'%s' error -- unknown resource type: [%d]\n", s->name, td->resource); return State_Failed; } } static void _checkTimeout(Service_T s) { if (s->actionratelist) { /* Start counting cycles */ if (s->nstart > 0) s->ncycle++; int max = 0; for (ActionRate_T ar = s->actionratelist; ar; ar = ar->next) { if (max < ar->cycle) max = ar->cycle; if (s->nstart >= ar->count && s->ncycle <= ar->cycle) Event_post(s, Event_Timeout, State_Failed, ar->action, "service restarted %d times within %d cycles(s) - %s", s->nstart, s->ncycle, Action_Names[ar->action->failed->id]); } /* Stop counting and reset if the cycle interval is succeeded */ if (s->ncycle > max) { s->ncycle = 0; s->nstart = 0; } } } static bool _incron(Service_T s, time_t now) { if ((now - s->every.last_run) > 59) { // Minute is the lowest resolution, so only run once per minute if (Time_incron(s->every.spec.cron, now) == 1) { s->every.last_run = now; return true; } } return false; } /** * Returns true if validation should be skipped for this service in this cycle, otherwise false. Handle every statement */ static bool _checkSkip(Service_T s) { assert(s); time_t now = Time_now(); if (s->every.type == Every_SkipCycles) { s->every.spec.cycle.counter++; if (s->every.spec.cycle.counter < s->every.spec.cycle.number) { s->monitor |= Monitor_Waiting; DEBUG("'%s' test skipped as current cycle (%d) < every cycle (%d) \n", s->name, s->every.spec.cycle.counter, s->every.spec.cycle.number); return true; } s->every.spec.cycle.counter = 0; } else if (s->every.type == Every_Cron && ! _incron(s, now)) { s->monitor |= Monitor_Waiting; if ((now - s->every.last_run) > 59) DEBUG("'%s' test skipped as current time (%s) does not match every's cron spec \"%s\"\n", s->name, Time_localStr(now, (char[26]){}), s->every.spec.cron); return true; } else if (s->every.type == Every_NotInCron && Time_incron(s->every.spec.cron, now) == 1) { s->monitor |= Monitor_Waiting; if ((now - s->every.last_run) > 59) DEBUG("'%s' test skipped as current time (%s) matches every's cron spec \"not %s\"\n", s->name, Time_localStr(now, (char[26]){}), s->every.spec.cron); return true; } s->monitor &= ~Monitor_Waiting; // Skip if parent is not initialized for (Dependant_T d = s->dependantlist; d; d = d->next ) { Service_T parent = Util_getService(d->dependant); if (parent) { if (parent->monitor != Monitor_Yes) { DEBUG("'%s' test skipped as required service '%s' is %s\n", s->name, parent->name, parent->monitor == Monitor_Init ? "initializing" : "not monitored"); return true; } else if (parent->error) { DEBUG("'%s' test skipped as required service '%s' has errors\n", s->name, parent->name); return true; } } } return false; } /** * Returns true if scheduled action was performed */ static bool _doScheduledAction(Service_T s) { int rv = false; Action_Type action = s->doaction; if (action != Action_Ignored) { rv = control_service(s->name, action); Event_post(s, Event_Action, State_Changed, s->action_ACTION, "%s action %s", Action_Names[action], rv ? "done" : "failed"); } return rv; } /* ---------------------------------------------------------------- Public */ /** * This function contains the main check machinery for monit. The * validate function check services in the service list to see if * they will pass all defined tests. */ int validate(void) { Run.handler_flag = Handler_Succeeded; Event_queue_process(); SystemInfo_update(); ProcessTree_init(ProcessEngine_None); gettimeofday(&System_Info.collected, NULL); /* In the case that at least one action is pending, perform quick loop to handle the actions ASAP */ if (Run.flags & Run_ActionPending) { Run.flags &= ~Run_ActionPending; for (Service_T s = Service_List; s; s = s->next) _doScheduledAction(s); } int errors = 0; /* Check the services */ for (Service_T s = Service_List; s && ! interrupt(); s = s->next) { if (! _doScheduledAction(s) && s->monitor && ! _checkSkip(s)) { _checkTimeout(s); // Can disable monitoring => need to check s->monitor again if (s->monitor) { State_Type state = s->check(s); if (state != State_Init && s->monitor != Monitor_Not) // The monitoring can be disabled by some matching rule in s->check so we have to check again before setting to Monitor_Yes s->monitor = Monitor_Yes; if (state == State_Failed) errors++; gettimeofday(&s->collected, NULL); } } } return errors; } /** * Validate a given process service s. Events are posted according to * its configuration. In case of a fatal event false is returned. */ State_Type check_process(Service_T s) { assert(s); State_Type rv = State_Succeeded; bool checkResources = false; pid_t pid = ProcessTree_findProcess(s); if (! pid) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_NonExist, State_Failed, l->action, "process is not running"); } for (Exist_T l = s->existlist; l; l = l->next) { Event_post(s, Event_Exist, State_Succeeded, l->action, "process is not running"); } return rv; } if (Run.flags & Run_ProcessEngineEnabled) { // Update statistics (event can execute a program and set environment like MONIT_PROCESS_PID) if (! (checkResources = ProcessTree_updateProcess(s, pid))) { Log_error("'%s' failed to get process data\n", s->name); rv = State_Failed; } } for (NonExist_T l = s->nonexistlist; l; l = l->next) { Event_post(s, Event_NonExist, State_Succeeded, l->action, "process is running with pid %d", (int)pid); } for (Exist_T l = s->existlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_Exist, State_Failed, l->action, "process is running with pid %d", (int)pid); } // Double-check the monitoring state: the "if does exist" may call unmonitor/stop, which resets the service object if (s->monitor == Monitor_Not) return rv; /* Reset the exec and timeout errors if active ... the process is running (most probably after manual intervention) */ if (IS_EVENT_SET(s->error, Event_Exec)) Event_post(s, Event_Exec, State_Succeeded, s->action_EXEC, "process is running after previous exec error (slow starting or manually recovered?)"); if (IS_EVENT_SET(s->error, Event_Timeout)) for (ActionRate_T ar = s->actionratelist; ar; ar = ar->next) Event_post(s, Event_Timeout, State_Succeeded, ar->action, "process is running after previous restart timeout (manually recovered?)"); if (checkResources) { if (_checkProcessState(s) == State_Failed) rv = State_Failed; if (_checkProcessPid(s) == State_Failed) rv = State_Failed; if (_checkProcessPpid(s) == State_Failed) rv = State_Failed; if (_checkUid(s, s->inf.process->uid) == State_Failed) rv = State_Failed; if (_checkEuid(s, s->inf.process->euid) == State_Failed) rv = State_Failed; if (_checkGid(s, s->inf.process->gid) == State_Failed) rv = State_Failed; if (_checkUptime(s, s->inf.process->uptime) == State_Failed) rv = State_Failed; if (_checkSecurityAttribute(s, s->inf.process->secattr) == State_Failed) rv = State_Failed; if (_checkProcessFiledescriptors(s) == State_Failed) rv = State_Failed; for (Resource_T pr = s->resourcelist; pr; pr = pr->next) if (_checkProcessResources(s, pr) == State_Failed) rv = State_Failed; } long long uptimeMilli = (long long)(s->inf.process->uptime) * 1000LL; for (Port_T pp = s->portlist; pp; pp = pp->next) { //FIXME: instead of pause, try to test, but ignore any errors in the start timeout timeframe ... will allow to display the port response time as soon as available, instead of waiting for 30+ seconds /* pause port tests in the start timeout timeframe while the process is starting (it may take some time to the process before it starts accepting connections) */ if (! s->start || uptimeMilli > s->start->timeout) { if (_checkConnection(s, pp) == State_Failed) rv = State_Failed; } else { pp->is_available = Connection_Init; DEBUG("'%s' connection test paused for %s while the process is starting\n", s->name, Fmt_time2str(s->start->timeout - (uptimeMilli < 0 ? 0 : uptimeMilli), (char[11]){})); } } for (Port_T pp = s->socketlist; pp; pp = pp->next) { //FIXME: instead of pause, try to test, but ignore any errors in the start timeout timeframe ... will allow to display the port response time as soon as available, instead of waiting for 30+ seconds /* pause socket tests in the start timeout timeframe while the process is starting (it may take some time to the process before it starts accepting connections) */ if (! s->start || uptimeMilli > s->start->timeout) { if (_checkConnection(s, pp) == State_Failed) rv = State_Failed; } else { pp->is_available = Connection_Init; DEBUG("'%s' connection test paused for %s while the process is starting\n", s->name, Fmt_time2str(s->start->timeout - (uptimeMilli < 0 ? 0 : uptimeMilli), (char[11]){})); } } return rv; } /** * Validate a given filesystem service s. Events are posted according to * its configuration. In case of a fatal event false is returned. */ State_Type check_filesystem(Service_T s) { assert(s); State_Type rv = State_Succeeded; if (! filesystem_usage(s)) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_NonExist, State_Failed, l->action, "unable to read filesystem '%s' state", s->path); } for (Exist_T l = s->existlist; l; l = l->next) { Event_post(s, Event_Exist, State_Succeeded, l->action, "filesystem '%s' doesn't exist", s->path); } return rv; } for (NonExist_T l = s->nonexistlist; l; l = l->next) { Event_post(s, Event_NonExist, State_Succeeded, l->action, "succeeded getting filesystem statistics for '%s'", s->path); } for (Exist_T l = s->existlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_Exist, State_Failed, l->action, "filesystem '%s' exists", s->path); } // Double-check the monitoring state: the "if does exist" may call unmonitor/stop, which resets the service object if (s->monitor == Monitor_Not) return rv; if (_checkPerm(s, s->inf.filesystem->mode) == State_Failed) rv = State_Failed; if (_checkUid(s, s->inf.filesystem->uid) == State_Failed) rv = State_Failed; if (_checkGid(s, s->inf.filesystem->gid) == State_Failed) rv = State_Failed; if (_checkFilesystemFlags(s) == State_Failed) rv = State_Failed; for (FileSystem_T fs = s->filesystemlist; fs; fs = fs->next) if (_checkFilesystemResources(s, fs) == State_Failed) rv = State_Failed; return rv; } /** * Validate a given file service s. Events are posted according to * its configuration. In case of a fatal event false is returned. */ State_Type check_file(Service_T s) { assert(s); struct stat stat_buf; State_Type rv = State_Succeeded; if (stat(s->path, &stat_buf) != 0) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_NonExist, State_Failed, l->action, "file doesn't exist"); } for (Exist_T l = s->existlist; l; l = l->next) { Event_post(s, Event_Exist, State_Succeeded, l->action, "file doesn't exist"); } return rv; } else { s->inf.file->mode = stat_buf.st_mode; if (s->inf.file->inode) { s->inf.file->inode_prev = s->inf.file->inode; } else { // Seek to the end of the file the first time we see it => skip existing content (files which passed the test at least once have inode always set via state file) DEBUG("'%s' seeking to the end of the file\n", s->name); s->inf.file->readpos = stat_buf.st_size; s->inf.file->inode_prev = stat_buf.st_ino; } s->inf.file->inode = stat_buf.st_ino; s->inf.file->uid = stat_buf.st_uid; s->inf.file->gid = stat_buf.st_gid; s->inf.file->size = stat_buf.st_size; s->inf.file->nlink = stat_buf.st_nlink; s->inf.file->timestamp.access = stat_buf.st_atime; s->inf.file->timestamp.change = stat_buf.st_ctime; s->inf.file->timestamp.modify = stat_buf.st_mtime; for (NonExist_T l = s->nonexistlist; l; l = l->next) { Event_post(s, Event_NonExist, State_Succeeded, l->action, "file exists"); } for (Exist_T l = s->existlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_Exist, State_Failed, l->action, "file exists"); } } // Double-check the monitoring state: the "if does exist" may call unmonitor/stop, which resets the service object if (s->monitor == Monitor_Not) return rv; if (! S_ISREG(s->inf.file->mode) && ! S_ISSOCK(s->inf.file->mode)) { Event_post(s, Event_Invalid, State_Failed, s->action_INVALID, "is neither a regular file nor a socket"); return State_Failed; } else { Event_post(s, Event_Invalid, State_Succeeded, s->action_INVALID, "is a regular %s", S_ISSOCK(s->inf.file->mode) ? "socket" : "file"); } if (_checkChecksum(s) == State_Failed) rv = State_Failed; if (_checkPerm(s, s->inf.file->mode) == State_Failed) rv = State_Failed; if (_checkUid(s, s->inf.file->uid) == State_Failed) rv = State_Failed; if (_checkGid(s, s->inf.file->gid) == State_Failed) rv = State_Failed; if (_checkSize(s, s->inf.file->size) == State_Failed) rv = State_Failed; if (_checkHardlink(s, s->inf.file->nlink) == State_Failed) rv = State_Failed; if (_checkTimestamps(s, s->inf.file->timestamp.access, s->inf.file->timestamp.change, s->inf.file->timestamp.modify) == State_Failed) rv = State_Failed; if (_checkMatch(s) == State_Failed) rv = State_Failed; return rv; } /** * Validate a given directory service s. Events are posted according to * its configuration. In case of a fatal event false is returned. */ State_Type check_directory(Service_T s) { assert(s); struct stat stat_buf; State_Type rv = State_Succeeded; if (stat(s->path, &stat_buf) != 0) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_NonExist, State_Failed, l->action, "directory doesn't exist"); } for (Exist_T l = s->existlist; l; l = l->next) { Event_post(s, Event_Exist, State_Succeeded, l->action, "directory doesn't exist"); } return rv; } else { s->inf.directory->mode = stat_buf.st_mode; s->inf.directory->uid = stat_buf.st_uid; s->inf.directory->gid = stat_buf.st_gid; s->inf.directory->nlink = stat_buf.st_nlink; s->inf.directory->timestamp.access = stat_buf.st_atime; s->inf.directory->timestamp.change = stat_buf.st_ctime; s->inf.directory->timestamp.modify = stat_buf.st_mtime; for (NonExist_T l = s->nonexistlist; l; l = l->next) { Event_post(s, Event_NonExist, State_Succeeded, l->action, "directory exists"); } for (Exist_T l = s->existlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_Exist, State_Failed, l->action, "directory exists"); } } // Double-check the monitoring state: the "if does exist" may call unmonitor/stop, which resets the service object if (s->monitor == Monitor_Not) return rv; if (! S_ISDIR(s->inf.directory->mode)) { Event_post(s, Event_Invalid, State_Failed, s->action_INVALID, "is not directory"); return State_Failed; } else { Event_post(s, Event_Invalid, State_Succeeded, s->action_INVALID, "is directory"); } if (_checkPerm(s, s->inf.directory->mode) == State_Failed) rv = State_Failed; if (_checkUid(s, s->inf.directory->uid) == State_Failed) rv = State_Failed; if (_checkGid(s, s->inf.directory->gid) == State_Failed) rv = State_Failed; if (_checkHardlink(s, s->inf.directory->nlink) == State_Failed) rv = State_Failed; if (_checkTimestamps(s, s->inf.directory->timestamp.access, s->inf.directory->timestamp.change, s->inf.directory->timestamp.modify) == State_Failed) rv = State_Failed; return rv; } /** * Validate a given fifo service s. Events are posted according to * its configuration. In case of a fatal event false is returned. */ State_Type check_fifo(Service_T s) { assert(s); struct stat stat_buf; State_Type rv = State_Succeeded; if (stat(s->path, &stat_buf) != 0) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_NonExist, State_Failed, l->action, "fifo doesn't exist"); } for (Exist_T l = s->existlist; l; l = l->next) { Event_post(s, Event_Exist, State_Succeeded, l->action, "fifo doesn't exist"); } return rv; } else { s->inf.fifo->mode = stat_buf.st_mode; s->inf.fifo->uid = stat_buf.st_uid; s->inf.fifo->gid = stat_buf.st_gid; s->inf.fifo->nlink = stat_buf.st_nlink; s->inf.fifo->timestamp.access = stat_buf.st_atime; s->inf.fifo->timestamp.change = stat_buf.st_ctime; s->inf.fifo->timestamp.modify = stat_buf.st_mtime; for (NonExist_T l = s->nonexistlist; l; l = l->next) { Event_post(s, Event_NonExist, State_Succeeded, l->action, "fifo exists"); } for (Exist_T l = s->existlist; l; l = l->next) { rv = State_Failed; Event_post(s, Event_Exist, State_Failed, l->action, "fifo exists"); } } // Double-check the monitoring state: the "if does exist" may call unmonitor/stop, which resets the service object if (s->monitor == Monitor_Not) return rv; if (! S_ISFIFO(s->inf.fifo->mode)) { Event_post(s, Event_Invalid, State_Failed, s->action_INVALID, "is not fifo"); return State_Failed; } else { Event_post(s, Event_Invalid, State_Succeeded, s->action_INVALID, "is fifo"); } if (_checkPerm(s, s->inf.fifo->mode) == State_Failed) rv = State_Failed; if (_checkUid(s, s->inf.fifo->uid) == State_Failed) rv = State_Failed; if (_checkGid(s, s->inf.fifo->gid) == State_Failed) rv = State_Failed; if (_checkHardlink(s, s->inf.fifo->nlink) == State_Failed) rv = State_Failed; if (_checkTimestamps(s, s->inf.fifo->timestamp.access, s->inf.fifo->timestamp.change, s->inf.fifo->timestamp.modify) == State_Failed) rv = State_Failed; return rv; } /** * Validate a program status. Events are posted according to * its configuration. In case of a fatal event false is returned. */ State_Type check_program(Service_T s) { assert(s); assert(s->program); State_Type rv = State_Succeeded; time_t now = Time_now(); Process_T P = s->program->P; if (P) { // Process program output _programOutput(Process_errorStream(P), s->program->inprogressOutput); _programOutput(Process_inputStream(P), s->program->inprogressOutput); // Is the program still running? if (Process_exitStatus(P) < 0) { long long execution_time = (now - s->program->started) * 1000; if (execution_time > s->program->timeout) { // Program timed out rv = State_Failed; Log_error("'%s' program timed out after %s. Killing program with pid %ld\n", s->name, Fmt_time2str(execution_time, (char[11]){}), (long)Process_pid(P)); if (Process_kill(P)) { Process_waitFor(P); } else { Log_error("'%s' kill attempt of timed out pid %ld failed -- skip results evaluation\n", s->name, (long)Process_pid(P)); Process_free(&s->program->P); return State_Init; } // Fall-through with P and evaluate exit value below. } else { // Defer test of exit value until program exit or timeout DEBUG("'%s' status check deferred - waiting on program to exit\n", s->name); return State_Init; } } s->program->exitStatus = Process_exitStatus(P); // Copy exit status to the Program object for status display (CLI, http API), as the Process will be freed StringBuffer_trim(s->program->inprogressOutput); // Swap program output (instance finished) const char *lastOutput = StringBuffer_toString(s->program->inprogressOutput); StringBuffer_clear(s->program->lastOutput); StringBuffer_append(s->program->lastOutput, "%s", lastOutput); // Evaluate program's exit status against our status checks. const char *output = StringBuffer_length(s->program->inprogressOutput) ? StringBuffer_toString(s->program->inprogressOutput) : "no output"; for (Status_T status = s->statuslist; status; status = status->next) { if (status->operator == Operator_Changed) { if (status->initialized) { if (Util_evalQExpression(status->operator, s->program->exitStatus, status->return_value)) { Event_post(s, Event_Status, State_Changed, status->action, "status changed (%d -> %d) -- %s", status->return_value, s->program->exitStatus, output); status->return_value = s->program->exitStatus; } else { Event_post(s, Event_Status, State_ChangedNot, status->action, "status didn't change (%d) -- %s", s->program->exitStatus, output); } } else { status->initialized = true; status->return_value = s->program->exitStatus; } } else { if (Util_evalQExpression(status->operator, s->program->exitStatus, status->return_value)) { rv = State_Failed; Event_post(s, Event_Status, State_Failed, status->action, "status failed (%d) -- %s", s->program->exitStatus, output); } else { Event_post(s, Event_Status, State_Succeeded, status->action, "status succeeded (%d) -- %s", s->program->exitStatus, output); } } } // Check the program content (we check the whole program output at once, not line-by-line) for (Match_T ml = s->matchlist; ml; ml = ml->next) { if ((_checkPattern(ml, lastOutput) == 0) ^ (ml->not)) Event_post(s, Event_Content, State_Changed, ml->action, "content match on program output:\n%s\n", lastOutput); else Event_post(s, Event_Content, State_ChangedNot, ml->action, "content doesn't match on program output:\n%s", lastOutput); } // Check if the program output content changed for (OutputChange_T oc = s->outputchangelist; oc; oc = oc->next) { if (!oc->previous) { oc->previous = Str_dup(lastOutput); } else if (strcmp(oc->previous, lastOutput) == 0) { Event_post(s, Event_Content, oc->check_invers ? State_Failed : State_Succeeded, oc->action, "content remained the same:\n<<<<<<< Begin\n%s\n>>>>>>> End", lastOutput); } else { Event_post(s, Event_Content, oc->check_invers ? State_Succeeded : State_Failed, oc->action, "content changed:\n<<<<<<< Begin previous\n%s\n======= End previous - Begin current\n%s\n>>>>>>> End current", oc->previous, lastOutput); FREE(oc->previous); oc->previous = Str_dup(lastOutput); } } Process_free(&s->program->P); } else { rv = State_Init; } if (s->monitor != Monitor_Not) { // The status evaluation may disable service monitoring // Start program StringBuffer_clear(s->program->inprogressOutput); s->program->P = Command_execute(s->program->C); if (! s->program->P) { rv = State_Failed; Event_post(s, Event_Status, State_Failed, s->action_EXEC, "failed to execute '%s' -- %s", s->path, STRERROR); } else { Event_post(s, Event_Status, State_Succeeded, s->action_EXEC, "program started"); s->program->started = now; } } return rv; } /** * Validate a remote service. * @param s The remote service to validate * @return false if there was an error otherwise true */ State_Type check_remote_host(Service_T s) { assert(s); State_Type rv = State_Succeeded; Icmp_T last_ping = NULL; /* Test each icmp type in the service's icmplist */ for (Icmp_T icmp = s->icmplist; icmp; icmp = icmp->next) { switch (icmp->type) { case ICMP_ECHO: icmp->responsetime.current = icmp_echo(s->path, icmp->family, &(icmp->outgoing), icmp->size, icmp->timeout, icmp->count); if (icmp->responsetime.current == -2) { icmp->is_available = Connection_Init; #ifdef SOLARIS DEBUG("'%s' ping test skipped -- the monit user has no permission to create raw socket, please add net_icmpaccess privilege or run monit as root\n", s->name); #elif defined LINUX DEBUG("'%s' ping test skipped -- the monit user has no permission to create raw socket, please add CAP_NET_RAW capability or run monit as root\n", s->name); #else DEBUG("'%s' ping test skipped -- the monit user has no permission to create raw socket, please run monit as root\n", s->name); #endif } else if (icmp->responsetime.current == -1) { rv = icmp->check_invers ? State_Succeeded : State_Failed; icmp->is_available = Connection_Failed; Event_post(s, Event_Icmp, rv, icmp->action, "ping test failed"); } else { rv = icmp->check_invers ? State_Failed : State_Succeeded; icmp->is_available = Connection_Ok; Event_post(s, Event_Icmp, rv, icmp->action, "ping test succeeded [response time %s]", Fmt_time2str(icmp->responsetime.current, (char[11]){})); // Check response time if (icmp->responsetime.limit > -1.) { if (Util_evalDoubleQExpression(icmp->responsetime.operator, icmp->responsetime.current, icmp->responsetime.limit)) { Event_post(s, Event_Speed, State_Succeeded, icmp->action, "response time %s succeeded [time %s %s]", Fmt_time2str(icmp->responsetime.current, (char[11]){}), OperatorShort_Names[icmp->responsetime.operator], Fmt_time2str(icmp->responsetime.limit, (char[11]){})); } else { rv = State_Failed; Event_post(s, Event_Speed, State_Failed, icmp->action, "response time %s doesn't match limit [time %s %s]", Fmt_time2str(icmp->responsetime.current, (char[11]){}), OperatorShort_Names[icmp->responsetime.operator], Fmt_time2str(icmp->responsetime.limit, (char[11]){})); } } } last_ping = icmp; break; default: Log_error("'%s' error -- unknown ICMP type: [%d]\n", s->name, icmp->type); return State_Failed; } } /* If we could not ping the host we assume it's down and do not continue to check any port connections */ if (last_ping && last_ping->is_available == Connection_Failed && s->portlist) { DEBUG("'%s' icmp ping failed, skipping any port connection tests\n", s->name); return State_Failed; } /* Test each host:port and protocol in the service's portlist */ for (Port_T p = s->portlist; p; p = p->next) if (_checkConnection(s, p) == State_Failed) rv = State_Failed; return rv; } /** * Validate the general system indicators. In case of a fatal event * false is returned. */ State_Type check_system(Service_T s) { assert(s); State_Type rv = State_Succeeded; for (Resource_T r = s->resourcelist; r; r = r->next) if (_checkSystemResources(s, r) == State_Failed) rv = State_Failed; if (_checkUptime(s, Time_now() - System_Info.booted) == State_Failed) rv = State_Failed; if ( System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem ) { if (_checkSystemFiledescriptors(s) == State_Failed) rv = State_Failed; } return rv; } State_Type check_net(Service_T s) { volatile State_Type rv = State_Succeeded; volatile bool havedata = true; // Get link statistics TRY { Link_update(s->inf.net->stats); } ELSE { havedata = false; for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) { rv = link->check_invers ? State_Succeeded : State_Failed; Event_post(s, Event_Link, link->check_invers ? State_Succeeded : State_Failed, link->action, "link data collection failed -- %s", Exception_frame.message); } } END_TRY; // State if (! havedata) { return s->inverseStatus ? State_Succeeded : State_Failed; // No data, event handled in the TRY-ELSE loop already, terminate remaining tests } else if (! Link_getState(s->inf.net->stats)) { for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) { Event_post(s, Event_Link, link->check_invers ? State_Succeeded : State_Failed, link->action, "link down"); } return s->inverseStatus ? State_Succeeded : State_Failed; // Link is down, terminate remaining tests } else { for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) Event_post(s, Event_Link, link->check_invers ? State_Failed : State_Succeeded, link->action, "link up"); } if (! s->inverseStatus) { //FIXME: these tests share the same class (Event_Link), so if "link up" test is set, it would set the state to failure, but these tests will reset it back to success. When we'll add more event types, // we shoud assign a new type for link in/out errors and then we can perform these tests even if "link up" is set // Link errors long long oerrors = Link_getErrorsOutPerSecond(s->inf.net->stats); if (oerrors >= 0) { for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) { if (oerrors > 0) { rv = State_Failed; Event_post(s, Event_Link, State_Failed, link->action, "%lld upload errors detected", oerrors); } else { Event_post(s, Event_Link, State_Succeeded, link->action, "upload errors check succeeded"); } } } long long ierrors = Link_getErrorsInPerSecond(s->inf.net->stats); if (ierrors >= 0) { for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) { if (ierrors > 0) { rv = State_Failed; Event_post(s, Event_Link, State_Failed, link->action, "%lld download errors detected", ierrors); } else { Event_post(s, Event_Link, State_Succeeded, link->action, "download errors check succeeded"); } } } } // Link speed int duplex = Link_getDuplex(s->inf.net->stats); long long speed = Link_getSpeed(s->inf.net->stats); for (LinkSpeed_T link = s->linkspeedlist; link; link = link->next) { if (speed > 0 && link->speed) { if (duplex > -1 && duplex != link->duplex) Event_post(s, Event_Speed, State_Changed, link->action, "link mode is now %s-duplex", duplex ? "full" : "half"); else Event_post(s, Event_Speed, State_ChangedNot, link->action, "link mode has not changed since last cycle [current mode is %s-duplex]", duplex ? "full" : "half"); if (speed != link->speed) Event_post(s, Event_Speed, State_Changed, link->action, "link speed changed to %.0lf Mb/s", (double)speed / 1000000.); else Event_post(s, Event_Speed, State_ChangedNot, link->action, "link speed has not changed since last cycle [current speed = %.0lf Mb/s]", (double)speed / 1000000.); } link->duplex = duplex; link->speed = speed; } // Link saturation double osaturation = Link_getSaturationOutPerSecond(s->inf.net->stats); double isaturation = Link_getSaturationInPerSecond(s->inf.net->stats); if (osaturation >= 0. && isaturation >= 0.) { for (LinkSaturation_T link = s->linksaturationlist; link; link = link->next) { if (duplex) { if (Util_evalDoubleQExpression(link->operator, osaturation, link->limit)) Event_post(s, Event_Saturation, State_Failed, link->action, "link upload saturation of %.1f%% matches limit [saturation %s %.1f%%]", osaturation, OperatorShort_Names[link->operator], link->limit); else Event_post(s, Event_Saturation, State_Succeeded, link->action, "link upload saturation check succeeded [current upload saturation %.1f%%]", osaturation); if (Util_evalDoubleQExpression(link->operator, isaturation, link->limit)) Event_post(s, Event_Saturation, State_Failed, link->action, "link download saturation of %.1f%% matches limit [saturation %s %.1f%%]", isaturation, OperatorShort_Names[link->operator], link->limit); else Event_post(s, Event_Saturation, State_Succeeded, link->action, "link download saturation check succeeded [current download saturation %.1f%%]", isaturation); } else { double iosaturation = osaturation + isaturation; if (Util_evalDoubleQExpression(link->operator, iosaturation, link->limit)) Event_post(s, Event_Saturation, State_Failed, link->action, "link saturation of %.1f%% matches limit [saturation %s %.1f%%]", iosaturation, OperatorShort_Names[link->operator], link->limit); else Event_post(s, Event_Saturation, State_Succeeded, link->action, "link saturation check succeeded [current saturation %.1f%%]", iosaturation); } } } // Upload char buf1[10], buf2[10]; for (Bandwidth_T upload = s->uploadbyteslist; upload; upload = upload->next) { long long obytes; switch (upload->range) { case Time_Minute: obytes = Link_getBytesOutPerMinute(s->inf.net->stats, upload->rangecount); break; case Time_Hour: if (upload->rangecount == 1) // Use precise minutes range for "last hour" obytes = Link_getBytesOutPerMinute(s->inf.net->stats, 60); else obytes = Link_getBytesOutPerHour(s->inf.net->stats, upload->rangecount); break; default: obytes = Link_getBytesOutPerSecond(s->inf.net->stats); break; } if (obytes >= 0 && Util_evalQExpression(upload->operator, obytes, upload->limit)) Event_post(s, Event_ByteOut, State_Failed, upload->action, "%supload %s matches limit [upload rate %s %s in last %d %s]", upload->range != Time_Second ? "total " : "", Fmt_bytes2str(obytes, buf1), OperatorShort_Names[upload->operator], Fmt_bytes2str(upload->limit, buf2), upload->rangecount, Util_timestr(upload->range)); else Event_post(s, Event_ByteOut, State_Succeeded, upload->action, "%supload check succeeded [current upload rate %s in last %d %s]", upload->range != Time_Second ? "total " : "", Fmt_bytes2str(obytes, buf1), upload->rangecount, Util_timestr(upload->range)); } for (Bandwidth_T upload = s->uploadpacketslist; upload; upload = upload->next) { long long opackets; switch (upload->range) { case Time_Minute: opackets = Link_getPacketsOutPerMinute(s->inf.net->stats, upload->rangecount); break; case Time_Hour: if (upload->rangecount == 1) // Use precise minutes range for "last hour" opackets = Link_getPacketsOutPerMinute(s->inf.net->stats, 60); else opackets = Link_getPacketsOutPerHour(s->inf.net->stats, upload->rangecount); break; default: opackets = Link_getPacketsOutPerSecond(s->inf.net->stats); break; } if (opackets >= 0 && Util_evalQExpression(upload->operator, opackets, upload->limit)) Event_post(s, Event_PacketOut, State_Failed, upload->action, "%supload packets %lld matches limit [upload packets %s %lld in last %d %s]", upload->range != Time_Second ? "total " : "", opackets, OperatorShort_Names[upload->operator], upload->limit, upload->rangecount, Util_timestr(upload->range)); else Event_post(s, Event_PacketOut, State_Succeeded, upload->action, "%supload packets check succeeded [current upload packets %lld in last %d %s]", upload->range != Time_Second ? "total " : "", opackets, upload->rangecount, Util_timestr(upload->range)); } // Download for (Bandwidth_T download = s->downloadbyteslist; download; download = download->next) { long long ibytes; switch (download->range) { case Time_Minute: ibytes = Link_getBytesInPerMinute(s->inf.net->stats, download->rangecount); break; case Time_Hour: if (download->rangecount == 1) // Use precise minutes range for "last hour" ibytes = Link_getBytesInPerMinute(s->inf.net->stats, 60); else ibytes = Link_getBytesInPerHour(s->inf.net->stats, download->rangecount); break; default: ibytes = Link_getBytesInPerSecond(s->inf.net->stats); break; } if (ibytes >= 0 && Util_evalQExpression(download->operator, ibytes, download->limit)) Event_post(s, Event_ByteIn, State_Failed, download->action, "%sdownload %s matches limit [download rate %s %s in last %d %s]", download->range != Time_Second ? "total " : "", Fmt_bytes2str(ibytes, buf1), OperatorShort_Names[download->operator], Fmt_bytes2str(download->limit, buf2), download->rangecount, Util_timestr(download->range)); else Event_post(s, Event_ByteIn, State_Succeeded, download->action, "%sdownload check succeeded [current download rate %s in last %d %s]", download->range != Time_Second ? "total " : "", Fmt_bytes2str(ibytes, buf1), download->rangecount, Util_timestr(download->range)); } for (Bandwidth_T download = s->downloadpacketslist; download; download = download->next) { long long ipackets; switch (download->range) { case Time_Minute: ipackets = Link_getPacketsInPerMinute(s->inf.net->stats, download->rangecount); break; case Time_Hour: if (download->rangecount == 1) // Use precise minutes range for "last hour" ipackets = Link_getPacketsInPerMinute(s->inf.net->stats, 60); else ipackets = Link_getPacketsInPerHour(s->inf.net->stats, download->rangecount); break; default: ipackets = Link_getPacketsInPerSecond(s->inf.net->stats); break; } if (ipackets >= 0 && Util_evalQExpression(download->operator, ipackets, download->limit)) Event_post(s, Event_PacketIn, State_Failed, download->action, "%sdownload packets %lld matches limit [download packets %s %lld in last %d %s]", download->range != Time_Second ? "total " : "", ipackets, OperatorShort_Names[download->operator], download->limit, download->rangecount, Util_timestr(download->range)); else Event_post(s, Event_PacketIn, State_Succeeded, download->action, "%sdownload packets check succeeded [current download packets %lld in last %d %s]", download->range != Time_Second ? "total " : "", ipackets, download->rangecount, Util_timestr(download->range)); } return rv; } monit-5.35.2/src/net/0000755000016400001720000000000015007061157011307 500000000000000monit-5.35.2/src/net/Link.c0000644000016400001720000003626315007061157012302 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include #include #include #include #include #include #ifdef HAVE_IFADDRS_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_NET_IF_H #include #endif #ifdef HAVE_NET_IF_MEDIA_H #include #endif #ifdef HAVE_KSTAT_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_NET_ROUTE_H #include #endif #ifdef HAVE_NET_IF_DL_H #include #endif #ifdef HAVE_LIBPERFSTAT_H #include #include #endif #include "monit.h" // libmonit #include "system/Time.h" #include "system/System.h" #include "util/Str.h" #include "exceptions/AssertException.h" /** * Implementation of the Statistics Facade for Unix Systems. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ------------------------------------------------------------- Definitions */ #define T Link_T static struct { struct ifaddrs *addrs; unsigned long long timestamp; } _stats = {}; typedef struct LinkData_T { bool available; #ifndef __LP64__ unsigned long long raw; #endif long long now; long long last; unsigned long long minute[60]; unsigned long long hour[24]; } LinkData_T; struct T { char *object; const char *(*resolve)(const char *object); // Resolve Object -> Interface, set during Link_T instantiation by constructor (currently we implement only IPAddress -> Interface lookup) struct { long long last; long long now; } timestamp; int state; // State (-1 = N/A, 0 = down, 1 = up) int duplex; // Duplex (-1 = N/A, 0 = half, 1 = full) long long speed; // Speed [bps] LinkData_T ipackets; // Packets received on interface LinkData_T ierrors; // Input errors on interface LinkData_T ibytes; // Total number of octets received LinkData_T opackets; // Packets sent on interface LinkData_T oerrors; // Output errors on interface LinkData_T obytes; // Total number of octets sent }; /* ----------------------------------------------------- Static destructor */ static void __attribute__ ((destructor)) _destructor(void) { #ifdef HAVE_IFADDRS_H if (_stats.addrs) freeifaddrs(_stats.addrs); #endif } /* --------------------------------------------------------------- Private */ static void _updateValue(LinkData_T *data, unsigned long long raw) { unsigned long long value = raw; #ifndef __LP64__ if (raw < data->raw) value = data->now + ULONG_MAX + 1ULL - data->raw + raw; // Counter wrapped else value = data->now + raw - data->raw; data->raw = raw; #endif data->last = data->now; data->now = value; data->available = true; } #if defined DARWIN #include "os/macosx/Link.inc" #elif defined FREEBSD #include "os/freebsd/Link.inc" #elif defined OPENBSD #include "os/openbsd/Link.inc" #elif defined NETBSD #include "os/netbsd/Link.inc" #elif defined DRAGONFLY #include "os/dragonfly/Link.inc" #elif defined LINUX #include "os/linux/Link.inc" #elif defined SOLARIS #include "os/solaris/Link.inc" #elif defined AIX #include "os/aix/Link.inc" #endif static void _resetData(LinkData_T *data, unsigned long long value) { #ifndef __LP64__ data->raw = value; #endif data->last = data->now = value; for (int i = 0; i < 60; i++) data->minute[i] = value; for (int i = 0; i < 24; i++) data->hour[i] = value; } static void _reset(T L) { L->timestamp.last = L->timestamp.now = 0ULL; L->speed = -1LL; L->state = L->duplex = -1; _resetData(&(L->ibytes), 0ULL); _resetData(&(L->ipackets), 0ULL); _resetData(&(L->ierrors), 0ULL); _resetData(&(L->obytes), 0ULL); _resetData(&(L->opackets), 0ULL); _resetData(&(L->oerrors), 0ULL); } static long long _deltaSecond(T L, LinkData_T *data) { if (L->timestamp.last > 0 && L->timestamp.now > L->timestamp.last) if (data->last > 0 && data->now > data->last) return (long long)((data->now - data->last) * 1000. / (L->timestamp.now - L->timestamp.last)); return 0ULL; } static long long _deltaMinute(T L, LinkData_T *data, int count) { int stop = Time_minutes(L->timestamp.now / 1000.); int delta = stop - count; int start = delta < 0 ? 60 + delta : delta; if (start == stop) // count == 60 (wrap) start = start < 59 ? start + 1 : 0; assert(start >= 0 && start < 60); assert(stop >= 0 && stop < 60); return data->minute[stop] - data->minute[start]; } static long long _deltaHour(T L, LinkData_T *data, int count) { int stop = Time_hour(L->timestamp.now / 1000.); int delta = stop - count; int start = delta < 0 ? 24 + delta : delta; if (start == stop) // count == 24 (wrap) start = start < 23 ? start + 1 : 0; assert(start >= 0 && start < 24); assert(stop >= 0 && stop < 24); return data->hour[stop] - data->hour[start]; } static const char *_findInterfaceForAddress(const char *address) { #ifdef HAVE_IFADDRS_H for (struct ifaddrs *a = _stats.addrs; a != NULL; a = a->ifa_next) { if (a->ifa_addr == NULL) continue; int s; char host[NI_MAXHOST]; if (a->ifa_addr->sa_family == AF_INET) s = getnameinfo(a->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); #ifdef HAVE_IPV6 else if (a->ifa_addr->sa_family == AF_INET6) s = getnameinfo(a->ifa_addr, sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); #endif else continue; if (s != 0) THROW(AssertException, "Cannot translate address to interface -- %s", gai_strerror(s)); if (Str_isEqual(address, host)) return a->ifa_name; } THROW(AssertException, "Address %s not found", address); #else THROW(AssertException, "Network monitoring by IP address is not supported on this platform, please use 'check network with interface ' instead"); #endif return NULL; } static const char *_returnInterface(const char *interface) { return interface; } static void _updateHistory(T L) { if (L->timestamp.last == 0ULL) { // Initialize the history on first update, so we can start accounting for total data immediately. Any delta will show difference between the very first value and then given point in time, until regular update cycle _resetData(&(L->ibytes), L->ibytes.now); _resetData(&(L->ipackets), L->ipackets.now); _resetData(&(L->ierrors), L->ierrors.now); _resetData(&(L->obytes), L->obytes.now); _resetData(&(L->opackets), L->opackets.now); _resetData(&(L->oerrors), L->oerrors.now); } else { // Update relative values only time_t now = L->timestamp.now / 1000.; int minute = Time_minutes(now); int hour = Time_hour(now); L->ibytes.minute[minute] = L->ibytes.hour[hour] = L->ibytes.now; L->ipackets.minute[minute] = L->ipackets.hour[hour] = L->ipackets.now; L->ierrors.minute[minute] = L->ierrors.hour[hour] = L->ierrors.now; L->obytes.minute[minute] = L->obytes.hour[hour] = L->obytes.now; L->opackets.minute[minute] = L->opackets.hour[hour] = L->opackets.now; L->oerrors.minute[minute] = L->oerrors.hour[hour] = L->oerrors.now; } } static void _updateCache(void) { #ifdef HAVE_IFADDRS_H unsigned long long now = Time_milli(); // Refresh only if the statistics are older then 1 second (handle also backward time jumps) if (now > _stats.timestamp + 1000 || now < _stats.timestamp - 1000) { _stats.timestamp = now; if (_stats.addrs) { freeifaddrs(_stats.addrs); _stats.addrs = NULL; } if (getifaddrs(&(_stats.addrs)) == -1) { _stats.timestamp = 0ULL; THROW(AssertException, "Cannot get network statistics -- %s", System_getError(errno)); } } #endif } /* ---------------------------------------------------------------- Public */ T Link_createForAddress(const char *address) { assert(address); T L; NEW(L); _reset(L); L->object = Str_dup(address); L->resolve = _findInterfaceForAddress; return L; } T Link_createForInterface(const char *interface) { assert(interface); T L; NEW(L); _reset(L); L->object = Str_dup(interface); L->resolve = _returnInterface; return L; } void Link_free(T *L) { FREE((*L)->object); FREE(*L); } void Link_reset(T L) { _reset(L); } bool Link_isGetByAddressSupported(void) { #ifdef HAVE_IFADDRS_H return true; #else return false; #endif } void Link_update(T L) { _updateCache(); const char *interface = L->resolve(L->object); if (_update(L, interface)) _updateHistory(L); else THROW(AssertException, "Cannot update network statistics -- interface %s not found", interface); } long long Link_getBytesInPerSecond(T L) { assert(L); return (L->state > 0 && L->ibytes.available) ? _deltaSecond(L, &(L->ibytes)) : -1LL; } long long Link_getBytesInPerMinute(T L, int count) { assert(L); return (L->state > 0 && L->ibytes.available) ? _deltaMinute(L, &(L->ibytes), count) : -1LL; } long long Link_getBytesInPerHour(T L, int count) { assert(L); return (L->state > 0 && L->ibytes.available) ? _deltaHour(L, &(L->ibytes), count) : -1LL; } long long Link_getBytesInTotal(T L) { assert(L); return (L->state > 0 && L->ibytes.available) ? L->ibytes.now : -1LL; } double Link_getSaturationInPerSecond(T L) { assert(L); return (L->state > 0 && L->speed) ? (double)Link_getBytesInPerSecond(L) * 8. * 100. / L->speed : -1.; } long long Link_getPacketsInPerSecond(T L) { assert(L); return (L->state > 0 && L->ipackets.available) ? _deltaSecond(L, &(L->ipackets)) : -1LL; } long long Link_getPacketsInPerMinute(T L, int count) { assert(L); return (L->state > 0 && L->ipackets.available) ? _deltaMinute(L, &(L->ipackets), count) : -1LL; } long long Link_getPacketsInPerHour(T L, int count) { assert(L); return (L->state > 0 && L->ipackets.available) ? _deltaHour(L, &(L->ipackets), count) : -1LL; } long long Link_getPacketsInTotal(T L) { assert(L); return (L->state > 0 && L->ipackets.available) ? L->ipackets.now : -1LL; } long long Link_getErrorsInPerSecond(T L) { assert(L); return (L->state > 0 && L->ierrors.available) ? _deltaSecond(L, &(L->ierrors)) : -1LL; } long long Link_getErrorsInPerMinute(T L, int count) { assert(L); return (L->state > 0 && L->ierrors.available) ? _deltaMinute(L, &(L->ierrors), count) : -1LL; } long long Link_getErrorsInPerHour(T L, int count) { assert(L); return (L->state > 0 && L->ierrors.available) ? _deltaHour(L, &(L->ierrors), count) : -1LL; } long long Link_getErrorsInTotal(T L) { assert(L); return (L->state > 0 && L->ierrors.available) ? L->ierrors.now : -1LL; } long long Link_getBytesOutPerSecond(T L) { assert(L); return (L->state > 0 && L->obytes.available) ? _deltaSecond(L, &(L->obytes)) : -1LL; } long long Link_getBytesOutPerMinute(T L, int count) { assert(L); return (L->state > 0 && L->obytes.available) ? _deltaMinute(L, &(L->obytes), count) : -1LL; } long long Link_getBytesOutPerHour(T L, int count) { assert(L); return (L->state > 0 && L->obytes.available) ? _deltaHour(L, &(L->obytes), count) : -1LL; } long long Link_getBytesOutTotal(T L) { assert(L); return (L->state > 0 && L->obytes.available) ? L->obytes.now : -1LL; } double Link_getSaturationOutPerSecond(T L) { assert(L); return (L->state > 0 && L->speed) ? (double)Link_getBytesOutPerSecond(L) * 8. * 100. / L->speed : -1.; } long long Link_getPacketsOutPerSecond(T L) { assert(L); return (L->state > 0 && L->opackets.available) ? _deltaSecond(L, &(L->opackets)) : -1LL; } long long Link_getPacketsOutPerMinute(T L, int count) { assert(L); return (L->state > 0 && L->opackets.available) ? _deltaMinute(L, &(L->opackets), count) : -1LL; } long long Link_getPacketsOutPerHour(T L, int count) { assert(L); return (L->state > 0 && L->opackets.available) ? _deltaHour(L, &(L->opackets), count) : -1LL; } long long Link_getPacketsOutTotal(T L) { assert(L); return (L->state > 0 && L->opackets.available) ? L->opackets.now : -1LL; } long long Link_getErrorsOutPerSecond(T L) { assert(L); return (L->state > 0 && L->oerrors.available) ? _deltaSecond(L, &(L->oerrors)) : -1LL; } long long Link_getErrorsOutPerMinute(T L, int count) { assert(L); return (L->state > 0 && L->oerrors.available) ? _deltaMinute(L, &(L->oerrors), count) : -1LL; } long long Link_getErrorsOutPerHour(T L, int count) { assert(L); return (L->state > 0 && L->oerrors.available) ? _deltaHour(L, &(L->oerrors), count) : -1LL; } long long Link_getErrorsOutTotal(T L) { assert(L); return (L->state > 0 && L->oerrors.available) ? L->oerrors.now : -1LL; } int Link_getState(T L) { assert(L); return L->state; } long long Link_getSpeed(T L) { assert(L); return L->state > 0 ? L->speed : -1LL; } int Link_getDuplex(T L) { assert(L); return L->state > 0 ? L->duplex : -1; } monit-5.35.2/src/net/socket.h0000644000016400001720000002033315007061157012671 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_SOCKET_H #define MONIT_SOCKET_H typedef enum { Socket_Tcp = SOCK_STREAM, Socket_Udp = SOCK_DGRAM } Socket_Type; typedef enum { Socket_Unix = 0, Socket_Ip, // IP, version not specified (IPv4 or IPv6) Socket_Ip4, // IPv4 only Socket_Ip6 // IPv6 only } Socket_Family; /** * This class implements a Socket. A socket is an endpoint for * communication between two machines. * * @file */ #define T Socket_T typedef struct T *T; /** * Create a new Socket opened against host:port. The returned Socket * is a connected socket. This method can be used to create either TCP * or UDP sockets and the type parameter is used to select the socket * type. If the flags parameter is Ssl_Enabled, the socket is created * using SSL. Only TCP sockets may use SSL. * @param host The remote host to open the Socket against. The host * may be a hostname found in the DNS or an IP address string. * @param port The port number to connect to * @param type The socket type to use * @param family The socket family to use * @param flags SSL flags, if set to Ssl_Enabled, the SSL handshake is performed * @param timeout The timeout value in milliseconds * @return The connected Socket or NULL if an error occurred */ T Socket_new(const char *host, int port, Socket_Type type, Socket_Family family, Ssl_Flags flags, int timeout); /** * Create a new Socket opened against host:port with an explicit * ssl value for connect and read. Otherwise, same as socket_new() * @param host The remote host to open the Socket against. The host * may be a hostname found in the DNS or an IP address string. * @param port The port number to connect to * @param type The socket type to use * @param family The socket family to use * @param options SSL options * @param timeout The timeout value in milliseconds * @return The connected Socket or NULL if an error occurred */ T Socket_create(const char *host, int port, Socket_Type type, Socket_Family family, SslOptions_T options, int timeout); /** * Create a new unix Socket for given path for connect and read. * Otherwise, same as socket_new(). * @param path The path to unix socket * @param type The socket type to use * @param timeout The timeout value in milliseconds * @return The connected Socket or NULL if an error occurred */ T Socket_createUnix(const char *path, Socket_Type type, int timeout); /** * Factory method for creating a Socket object from an accepted * socket. The given socket must be a socket created from accept(2). * If the sslserver context is non-null the socket will support * ssl. This method does only support TCP sockets. * @param socket The accepted socket * @param addr The socket address * @param sslserver A ssl server connection context, may be NULL * @return A Socket or NULL if an error occurred */ T Socket_createAccepted(int socket, struct sockaddr *addr, void *sslserver); /** * Destroy a Socket object. Close the socket and release allocated * resources. * @param S A Socket_T object reference */ void Socket_free(T *S); /** * Set a read/write timeout in milliseconds. During a read * operation the socket will wait up to timeout * milliseconds for data to become available if not already present. * @param S A Socket_T object * @param timeout The timeout value in milliseconds */ void Socket_setTimeout(T S, int timeout); /** * Returns the socket's read/write timeout in milliseconds. * @param S A Socket_T object * @return The timeout value in milliseconds */ int Socket_getTimeout(T S); /** * Return true if the connection is encrypted with SSL * @param S A Socket_T object * @return true if SSL is used otherwise false */ bool Socket_isSecure(T S); /** * Get the underlying socket descriptor * @param S A Socket_T object * @return The socket descriptor */ int Socket_getSocket(T S); /** * Get the type of this socket. * @param S A Socket_T object * @return The socket type */ Socket_Type Socket_getType(T S); /** * Get the family of this socket. * @param S A Socket_T object * @return The socket family */ Socket_Family Socket_getFamily(T S); /** * Get the Port object used to create this socket. If no Port object * was used this method returns NULL. * @param S A Socket_T object * @return The Port object or NULL */ void *Socket_getPort(T S); /** * Get the remote port number the socket is connected to * @param S A Socket_T object * @return The remote host's port number */ int Socket_getRemotePort(T S); /** * Get the remote host this socket is connected to. The host is either * a host name in DNS or an IP address string. * @param S A Socket_T object * @return The remote host */ const char *Socket_getRemoteHost(T S); /** * Get the local (ephemeral) port number this socket is using. * @param S A Socket_T object * @return The port number on success otherwise -1 */ int Socket_getLocalPort(T S); /** * Get the local interface IP address * @param S A Socket_T object * @param host A buffer for the hostname * @param hostlen A buffer length * @return The local host interface address or NULL if an error occurred */ const char *Socket_getLocalHost(T S, char *host, int hostlen); /** * Test a Port_T object * @param P A port object to test * @exception IOException if test failed */ void Socket_test(void *P); /** * Enables SSL on a connected socket. * @param S A connected Socket_T object * @param options SSL options * @param name An optional server name for SNI TLS extension * @exception IOException or AssertException if failed */ void Socket_enableSsl(T S, SslOptions_T options, const char *name); /** * Writes a character string. Use this function to send text based * messages to a client. * @param S A Socket_T object * @param m A String to send to the client * @return The bytes sent or -1 if an error occurred */ int Socket_print(T S, const char *m, ...) __attribute__((format (printf, 2, 3))); /** * Write size bytes from the buffer b. * @param S A Socket_T object * @param b The data to be written * @param size The size of the data in b * @return The bytes sent or -1 if an error occurred */ int Socket_write(T S, const void *b, size_t size); /** * Read a single byte. The byte is returned as an int in the range 0 * to 255. * @param S A Socket_T object * @return The byte read, or -1 if the end of the stream has been reached */ int Socket_readByte(T S); /** * Reads size bytes and stores them into the byte buffer pointed to by b. * @param S A Socket_T object * @param b A Byte buffer * @param size The size of the buffer b * @return The bytes read or -1 if an error occurred */ int Socket_read(T S, void *b, int size); /** * Reads in at most one less than size characters and * stores them into the buffer pointed to by s. Reading stops after * an EOF or a newline. If a newline is read, it is stored into the * buffer. A '\0' is stored after the last character in the buffer. * @param S A Socket_T object * @param s A character buffer to store the string in * @param size The size of the string buffer, s * @return s on success, and NULL on error or when end of file occurs * while no characters have been read. */ char *Socket_readLine(T S, char *s, int size); #undef T #endif monit-5.35.2/src/net/socket.c0000644000016400001720000006332415007061157012673 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_POLL_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_SYS_UN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_NETINET_TCP_H #include #endif #ifdef HAVE_NETDB_H #include #endif #include "net.h" #include "monit.h" #include "socket.h" #include "SslServer.h" // libmonit #include "exceptions/assert.h" #include "exceptions/IOException.h" #include "util/Str.h" #include "system/Net.h" #include "system/Time.h" /** * Implementation of the socket interface. * * @file */ /* ------------------------------------------------------------- Definitions */ typedef enum { Connection_Client = 0, Connection_Server } Connection_Type; // One TCP frame data size #define RBUFFER_SIZE 1460 #define T Socket_T struct T { Socket_Type type; Socket_Family family; Connection_Type connection_type; int socket; int port; int timeout; // milliseconds int length; int offset; char *host; Port_T Port; #ifdef HAVE_OPENSSL Ssl_T ssl; SslServer_T sslserver; #endif unsigned char buffer[RBUFFER_SIZE + 1]; }; /* --------------------------------------------------------------- Private */ /* * Fill the internal buffer. If an error occurs or if the read * operation timed out -1 is returned. * @param S A Socket object * @param timeout The number of milliseconds to wait for data to be read * @return the length of data read or -1 if an error occurred */ static int _fill(T S, int timeout) { S->offset = 0; S->length = 0; if (S->type == Socket_Udp) timeout = 500; int n; #ifdef HAVE_OPENSSL if (S->ssl) n = Ssl_read(S->ssl, S->buffer + S->length, RBUFFER_SIZE - S->length, timeout); else #endif n = (int)Net_read(S->socket, S->buffer + S->length, RBUFFER_SIZE - S->length, timeout); if (n > 0) S->length += n; else if (n < 0) return -1; else if (! (errno == EAGAIN || errno == EWOULDBLOCK)) // Peer closed connection return -1; return n; } static int _getPort(const struct sockaddr *addr) { if (addr->sa_family == AF_INET) return ntohs(((const struct sockaddr_in *)addr)->sin_port); #ifdef HAVE_IPV6 else if (addr->sa_family == AF_INET6) return ntohs(((const struct sockaddr_in6 *)addr)->sin6_port); #endif else return -1; } static char *_addressToString(const struct sockaddr *addr, socklen_t addrlen, char *buf, int buflen) { int oerrno = errno; if (addr->sa_family == AF_UNIX) { snprintf(buf, buflen, "%s", ((const struct sockaddr_un *)addr)->sun_path); } else { char ip[NI_MAXHOST]; char port[NI_MAXSERV]; int status = getnameinfo(addr, addrlen, ip, sizeof(ip), port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV); if (status) { Log_error("Cannot get address string -- %s\n", status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); *buf = 0; } else { snprintf(buf, buflen, "[%s]:%s", ip, port); } } errno = oerrno; return buf; } static bool _doConnect(int s, const struct sockaddr *addr, socklen_t addrlen, int timeout, char *error, int errorlen) { int rv = connect(s, addr, addrlen); if (! rv) { return true; } else if (errno != EINPROGRESS) { snprintf(error, errorlen, "%s", STRERROR); return false; } struct pollfd fds[1]; fds[0].fd = s; fds[0].events = POLLIN | POLLOUT; do { rv = poll(fds, 1, timeout); } while (rv == -1 && errno == EINTR); if (rv == 0) { snprintf(error, errorlen, "Connection timed out"); return false; } else if (rv == -1) { snprintf(error, errorlen, "Poll failed: %s", STRERROR); return false; } if (fds[0].events & POLLIN || fds[0].events & POLLOUT) { socklen_t rvlen = sizeof(rv); if (getsockopt(s, SOL_SOCKET, SO_ERROR, &rv, &rvlen) < 0) { snprintf(error, errorlen, "Read of error details failed: %s", STRERROR); return false; } else if (rv) { snprintf(error, errorlen, "%s", strerror(rv)); return false; } } else { snprintf(error, errorlen, "Not ready for I/O"); return false; } return true; } static T _createIpSocket(const char *host, const struct sockaddr *addr, socklen_t addrlen, const struct sockaddr *localaddr, socklen_t localaddrlen, int family, int type, int protocol, int timeout) { assert(host); char error[STRLEN]; int s = socket(family, type, protocol); if (s >= 0) { if (localaddr) { if (bind(s, localaddr, localaddrlen) < 0) { snprintf(error, sizeof(error), "Cannot bind to outgoing address -- %s", STRERROR); goto error; } } if (Net_setNonBlocking(s)) { if (fcntl(s, F_SETFD, FD_CLOEXEC) != -1) { if (_doConnect(s, addr, addrlen, timeout, error, sizeof(error))) { T S; NEW(S); S->socket = s; S->type = type; S->family = family == AF_INET ? Socket_Ip4 : Socket_Ip6; S->timeout = timeout; S->host = Str_dup(host); S->port = _getPort(addr); S->connection_type = Connection_Client; return S; } } else { snprintf(error, sizeof(error), "Cannot set socket close on exec -- %s", STRERROR); } } else { snprintf(error, sizeof(error), "Cannot set nonblocking socket -- %s", STRERROR); } error: Net_close(s); } else { snprintf(error, sizeof(error), "Cannot create socket to %s -- %s", _addressToString(addr, addrlen, (char[2048]){}, 2048), STRERROR); } THROW(IOException, "%s", error); return NULL; } static struct addrinfo *_resolve(const char *hostname, int port, Socket_Type type, Socket_Family family) { assert(hostname); struct addrinfo *result, hints = { .ai_socktype = type, .ai_protocol = type == Socket_Udp ? IPPROTO_UDP : IPPROTO_TCP }; switch (family) { case Socket_Ip: hints.ai_family = AF_UNSPEC; break; case Socket_Ip4: hints.ai_family = AF_INET; break; #ifdef HAVE_IPV6 case Socket_Ip6: hints.ai_family = AF_INET6; #ifdef AI_ADDRCONFIG hints.ai_flags = AI_ADDRCONFIG; #endif break; #endif default: Log_error("Invalid socket family %d\n", family); return NULL; } char _port[6]; snprintf(_port, sizeof(_port), "%d", port); int status = getaddrinfo(hostname, _port, &hints, &result); if (status != 0) { Log_error("Cannot translate '%s' to IP address -- %s\n", hostname, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); return NULL; } return result; } /* ------------------------------------------------------------------ Public */ T Socket_new(const char *host, int port, Socket_Type type, Socket_Family family, Ssl_Flags flags, int timeout) { struct SslOptions_T options = {.flags = flags}; return Socket_create(host, port, type, family, &options, timeout); } T Socket_create(const char *host, int port, Socket_Type type, Socket_Family family, SslOptions_T options, int timeout) { assert(host); assert(timeout > 0); volatile T S = NULL; struct addrinfo *result = _resolve(host, port, type, family); if (result) { char error[512] = {}; // The host may resolve to multiple IPs and if at least one succeeded, we have no problem and don't have to flood the log with partial errors => log only the last error for (struct addrinfo *r = result; r && S == NULL; r = r->ai_next) { TRY { S = _createIpSocket(host, r->ai_addr, r->ai_addrlen, NULL, 0, r->ai_family, r->ai_socktype, r->ai_protocol, timeout); if (options->flags == SSL_Enabled) Socket_enableSsl(S, options, host); } ELSE { if (S) Socket_free((T *)&S); DEBUG("Info: Cannot connect to [%s]:%d -- %s\nTrying next address record\n", host, port, Exception_frame.message); snprintf(error, sizeof(error), "%s", Exception_frame.message); } END_TRY; } freeaddrinfo(result); if (! S) Log_error("Cannot connect to [%s]:%d -- %s\n", host, port, error); } return S; } T Socket_createUnix(const char *path, Socket_Type type, int timeout) { assert(path); assert(timeout > 0); int s = socket(PF_UNIX, type, 0); if (s >= 0) { struct sockaddr_un unixsocket_client = {}; if (type == Socket_Udp) { unixsocket_client.sun_family = AF_UNIX; snprintf(unixsocket_client.sun_path, sizeof(unixsocket_client.sun_path), "/tmp/monit_%p.sock", &unixsocket_client); if (bind(s, (struct sockaddr *) &unixsocket_client, sizeof(unixsocket_client)) != 0) { Log_error("Unix socket %s bind error -- %s\n", unixsocket_client.sun_path, STRERROR); goto error; } } struct sockaddr_un unixsocket_server = {}; unixsocket_server.sun_family = AF_UNIX; strncpy(unixsocket_server.sun_path, path, sizeof(unixsocket_server.sun_path) - 1); if (Net_setNonBlocking(s)) { char error[STRLEN]; if (_doConnect(s, (struct sockaddr *)&unixsocket_server, sizeof(unixsocket_server), timeout, error, sizeof(error))) { T S; NEW(S); S->connection_type = Connection_Client; S->family = Socket_Unix; S->type = type; S->socket = s; S->timeout = timeout; S->host = Str_dup(LOCALHOST); return S; } Log_error("Unix socket %s connection error -- %s\n", path, error); } else { Log_error("Cannot set nonblocking unix socket %s -- %s\n", path, STRERROR); } error: Net_close(s); if (type == Socket_Udp) unlink(unixsocket_client.sun_path); } else { Log_error("Cannot create unix socket %s -- %s\n", path, STRERROR); } return NULL; } T Socket_createAccepted(int socket, struct sockaddr *addr, void *sslserver) { assert(socket >= 0); assert(addr); T S; NEW(S); S->socket = socket; S->timeout = Run.limits.networkTimeout; S->connection_type = Connection_Server; S->type = Socket_Tcp; if (addr->sa_family != AF_UNIX) { if (addr->sa_family == AF_INET) { struct sockaddr_in *a = (struct sockaddr_in *)addr; S->family = Socket_Ip4; S->host = Str_dup(inet_ntop(addr->sa_family, &a->sin_addr, (char[INET_ADDRSTRLEN]){}, INET_ADDRSTRLEN)); } #ifdef HAVE_IPV6 else { struct sockaddr_in6 *a = (struct sockaddr_in6 *)addr; S->family = Socket_Ip6; S->host = Str_dup(inet_ntop(addr->sa_family, &a->sin6_addr, (char[INET6_ADDRSTRLEN]){}, INET6_ADDRSTRLEN)); } #endif S->port = _getPort(addr); #ifdef HAVE_OPENSSL if (sslserver) { S->sslserver = sslserver; if (! (S->ssl = SslServer_newConnection(S->sslserver)) || ! SslServer_accept(S->ssl, S->socket, S->timeout)) { Socket_free(&S); return NULL; } } #endif } else { S->family = Socket_Unix; } return S; } void Socket_free(T *S) { assert(S && *S); #ifdef HAVE_OPENSSL if ((*S)->ssl) { if ((*S)->connection_type == Connection_Client) { Ssl_close((*S)->ssl); Ssl_free(&((*S)->ssl)); } else if ((*S)->connection_type == Connection_Server && (*S)->sslserver) { SslServer_freeConnection(&((*S)->ssl)); } } else #endif { int type; socklen_t length = sizeof(type); int rv = getsockopt((*S)->socket, SOL_SOCKET, SO_TYPE, &type, &length); if (rv) { Log_error("Freeing socket -- getsockopt failed: %s\n", STRERROR); } else if (type == SOCK_DGRAM) { struct sockaddr_storage addr; socklen_t addrlen = sizeof(addr); if (getsockname((*S)->socket, (struct sockaddr *)&addr, &addrlen) == 0) { if (addr.ss_family == AF_UNIX) { struct sockaddr_un *_addr = (struct sockaddr_un *)&addr; unlink(_addr->sun_path); } } } Net_shutdown((*S)->socket, SHUT_RDWR); Net_close((*S)->socket); } FREE((*S)->host); FREE(*S); } /* ------------------------------------------------------------ Properties */ void Socket_setTimeout(T S, int timeout) { assert(S); S->timeout = timeout; } int Socket_getTimeout(T S) { assert(S); return S->timeout; } bool Socket_isSecure(T S) { assert(S); #ifdef HAVE_OPENSSL return (S->ssl != NULL); #else return false; #endif } int Socket_getSocket(T S) { assert(S); return S->socket; } Socket_Type Socket_getType(T S) { assert(S); return S->type; } Socket_Family Socket_getFamily(T S) { assert(S); return S->family; } void *Socket_getPort(T S) { assert(S); return S->Port; } int Socket_getRemotePort(T S) { assert(S); return S->port; } const char *Socket_getRemoteHost(T S) { assert(S); return S->host; } int Socket_getLocalPort(T S) { assert(S); struct sockaddr_storage addr; socklen_t addrlen = sizeof(addr); if (getsockname(S->socket, (struct sockaddr *)&addr, &addrlen) == 0) return _getPort((struct sockaddr *)&addr); return -1; } const char *Socket_getLocalHost(T S, char *host, int hostlen) { assert(S); assert(host); assert(hostlen); struct sockaddr_storage addr; socklen_t addrlen = sizeof(addr); if (! getsockname(S->socket, (struct sockaddr *)&addr, &addrlen)) { int status = getnameinfo((struct sockaddr *)&addr, addrlen, host, hostlen, NULL, 0, NI_NUMERICHOST); if (! status) return host; Log_error("Cannot translate address to hostname -- %s\n", status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); } else { Log_error("Cannot translate address to hostname -- getsockname failed: %s\n", STRERROR); } return NULL; } static void _testUnix(Port_T p) { T S = Socket_createUnix(p->target.unix.pathname, p->type, p->timeout); if (S) { S->Port = p; TRY { p->protocol->check(S); } FINALLY { Socket_free(&S); } END_TRY; } else { THROW(IOException, "Cannot create unix socket for %s", p->target.unix.pathname); } } static void _testIp(Port_T p) { char error[512]; volatile Connection_State is_available = Connection_Failed; struct addrinfo *result = _resolve(p->hostname, p->target.net.port, p->type, p->family); if (result) { // The host may resolve to multiple IPs and if at least one succeeded, we have no problem and don't have to flood the log with partial errors => log only the last error for (struct addrinfo *r = result; r && is_available != Connection_Ok; r = r->ai_next) { if (p->outgoing.addrlen == 0 || p->outgoing.addrlen == r->ai_addrlen) { volatile T S = NULL; TRY { S = _createIpSocket(p->hostname, r->ai_addr, r->ai_addrlen, p->outgoing.addrlen ? (struct sockaddr *)&(p->outgoing.addr) : NULL, p->outgoing.addrlen, r->ai_family, r->ai_socktype, r->ai_protocol, p->timeout); S->Port = p; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" TRY { if (p->target.net.ssl.options.flags == SSL_Enabled) { Socket_enableSsl(S, &(p->target.net.ssl.options), p->hostname); } p->protocol->check(S); } FINALLY { // Set the minimum valid days past the protocol check as if the connection uses STARTTLS to switch plain->SSL, we have no SSL certificate information until the STARTTTLS is performed. // Try to collect the certificate validDays even on protocol exception - the protocol test may fail on higher level (e.g. when HTTP returns 400), but we can still get certificate info #ifdef HAVE_OPENSSL if (S->ssl) p->target.net.ssl.certificate.validDays = Ssl_getCertificateValidDays(S->ssl); #endif } END_TRY; #pragma GCC diagnostic pop is_available = Connection_Ok; } ELSE { snprintf(error, sizeof(error), "%s", Exception_frame.message); DEBUG("Socket test failed for %s -- %s\n", _addressToString(r->ai_addr, r->ai_addrlen, (char[STRLEN]){}, STRLEN), error); } FINALLY { if (S) { Socket_free((Socket_T *)&S); } } END_TRY; } else { snprintf(error, sizeof(error), "No IP address matching '%s' was found", p->outgoing.ip); } } freeaddrinfo(result); if (is_available != Connection_Ok) THROW(IOException, "%s", error); } else { THROW(IOException, "Cannot resolve [%s]:%d", p->hostname, p->target.net.port); } } /* ---------------------------------------------------------------- Public */ void Socket_test(void *P) { assert(P); Port_T p = P; TRY { long long start = Time_micro(); switch (p->family) { case Socket_Unix: _testUnix(p); break; case Socket_Ip: case Socket_Ip4: case Socket_Ip6: _testIp(p); break; default: THROW(IOException, "Invalid socket family %d\n", p->family); break; } p->responsetime.current = (double)(Time_micro() - start) / 1000.; // Convert microseconds to milliseconds p->is_available = Connection_Ok; } ELSE { p->is_available = Connection_Failed; p->responsetime.current = -1.; RETHROW; } END_TRY; } void Socket_enableSsl(T S, SslOptions_T options, const char *name) { assert(S); #ifdef HAVE_OPENSSL if ((S->ssl = Ssl_new(options))) Ssl_connect(S->ssl, S->socket, S->timeout, name); #endif } int Socket_print(T S, const char *m, ...) { int n; va_list ap; char *buf = NULL; assert(S); assert(m); va_start(ap, m); buf = Str_vcat(m, ap); va_end(ap); n = Socket_write(S, buf, strlen(buf)); FREE(buf); return n; } int Socket_write(T S, const void *b, size_t size) { ssize_t n = 0; const void *p = b; assert(S); while (size > 0) { #ifdef HAVE_OPENSSL if (S->ssl) { n = Ssl_write(S->ssl, p, (int)size, S->timeout); } else { #endif n = Net_write(S->socket, p, size, S->timeout); #ifdef HAVE_OPENSSL } #endif if (n <= 0) break; p = (const unsigned char *)p + n; size -= n; } if (n < 0) { /* No write or a partial write is an error */ return -1; } return (int)((const unsigned char *)p - (const unsigned char *)b); } int Socket_readByte(T S) { assert(S); if (S->offset >= S->length) if (_fill(S, S->timeout) <= 0) return -1; return S->buffer[S->offset++]; } int Socket_read(T S, void *b, int size) { int c; unsigned char *p = b; assert(S); while ((size-- > 0) && ((c = Socket_readByte(S)) >= 0)) *p++ = c; return (int)((long)p - (long)b); } char *Socket_readLine(T S, char *s, int size) { int c; unsigned char *p = (unsigned char *)s; assert(S); while (--size && ((c = Socket_readByte(S)) > 0)) { // Stop when \0 is read *p++ = c; if (c == '\n') break; } *p = 0; if (*s) return s; return NULL; } monit-5.35.2/src/net/os/0000755000016400001720000000000015007061157011730 500000000000000monit-5.35.2/src/net/os/freebsd/0000755000016400001720000000000015007061157013342 500000000000000monit-5.35.2/src/net/os/freebsd/Link.inc0000644000016400001720000000703415007061157014656 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for FreeBSD. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ static bool _update(T L, const char *interface) { for (struct ifaddrs *a = _stats.addrs; a != NULL; a = a->ifa_next) { if (a->ifa_addr == NULL) continue; if (Str_isEqual(interface, a->ifa_name) && a->ifa_addr->sa_family == AF_LINK) { int s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { struct ifmediareq ifmr; memset(&ifmr, 0, sizeof(ifmr)); strncpy(ifmr.ifm_name, interface, sizeof(ifmr.ifm_name) - 1); // try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface) if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) { L->state = 1LL; L->duplex = ifmr.ifm_active & 0x00100000 ? 1LL : 0LL; } else { L->state = 0LL; L->duplex = -1LL; } } else { L->state = 1LL; } close(s); } else { L->state = -1LL; L->duplex = -1LL; } struct if_data *data = (struct if_data *)a->ifa_data; L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); L->speed = data->ifi_baudrate; _updateValue(&(L->ibytes), data->ifi_ibytes); _updateValue(&(L->ipackets), data->ifi_ipackets); _updateValue(&(L->ierrors), data->ifi_ierrors); _updateValue(&(L->obytes), data->ifi_obytes); _updateValue(&(L->opackets), data->ifi_opackets); _updateValue(&(L->oerrors), data->ifi_oerrors); return true; } } return false; } monit-5.35.2/src/net/os/aix/0000755000016400001720000000000015007061157012511 500000000000000monit-5.35.2/src/net/os/aix/Link.inc0000644000016400001720000000403115007061157014017 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for AIX. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ static bool _update(T L, const char *interface) { perfstat_id_t id; perfstat_netinterface_t buf; snprintf(id.name, sizeof(id.name), interface); if (perfstat_netinterface(&id, &buf, sizeof(buf), 1) != 1) THROW(AssertException, "Cannot get perfstat data for %s -- %s", interface, System_getError(errno)); _updateValue(&(L->ibytes), buf.ibytes); _updateValue(&(L->ipackets), buf.ipackets); _updateValue(&(L->ierrors), buf.ierrors); _updateValue(&(L->obytes), buf.obytes); _updateValue(&(L->opackets), buf.opackets); _updateValue(&(L->oerrors), buf.oerrors); L->speed = buf.bitrate; L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); //FIXME: L->state and L->duplex are not implemented L->state = 1; L->duplex = 1; return true; } monit-5.35.2/src/net/os/macosx/0000755000016400001720000000000015007061157013222 500000000000000monit-5.35.2/src/net/os/macosx/Link.inc0000644000016400001720000001121715007061157014534 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for MacOSX. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ static bool _update(T L, const char *interface) { size_t len; int mib[6] = {CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST2, 0}; if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) THROW(AssertException, "Cannot get link statistics -- %s", System_getError(errno)); if (len == 0) THROW(AssertException, "Cannot get link statistics -- no interfaces found"); struct if_msghdr2 *buf = CALLOC(1, len); if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) { FREE(buf); THROW(AssertException, "Cannot get link statistics -- %s", System_getError(errno)); } for (struct if_msghdr2 *ifm = buf; (void *)ifm < (void *)buf + len; ifm = (void *)ifm + ifm->ifm_msglen) { if (ifm->ifm_type == RTM_IFINFO2) { char name[STRLEN]; struct sockaddr_dl *sdl = (struct sockaddr_dl *)(ifm + 1); strncpy(name, sdl->sdl_data, sdl->sdl_nlen); name[sdl->sdl_nlen] = 0; if (Str_isEqual(interface, name)) { int s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { struct ifmediareq ifmr; memset(&ifmr, 0, sizeof(ifmr)); strncpy(ifmr.ifm_name, interface, sizeof(ifmr.ifm_name) - 1); // try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface) if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) { L->state = 1LL; L->duplex = ifmr.ifm_active & 0x00100000 ? 1LL : 0LL; } else { L->state = 0LL; L->duplex = -1LL; } } else { L->state = 1LL; } close(s); } else { L->state = -1LL; L->duplex = -1LL; } L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); L->speed = ifm->ifm_data.ifi_baudrate; _updateValue(&(L->ibytes), ifm->ifm_data.ifi_ibytes); _updateValue(&(L->ipackets), ifm->ifm_data.ifi_ipackets); _updateValue(&(L->ierrors), ifm->ifm_data.ifi_ierrors); _updateValue(&(L->obytes), ifm->ifm_data.ifi_obytes); _updateValue(&(L->opackets), ifm->ifm_data.ifi_opackets); _updateValue(&(L->oerrors), ifm->ifm_data.ifi_oerrors); FREE(buf); return true; } } } FREE(buf); return false; } monit-5.35.2/src/net/os/netbsd/0000755000016400001720000000000015007061157013207 500000000000000monit-5.35.2/src/net/os/netbsd/Link.inc0000644000016400001720000000703315007061157014522 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for NetBSD. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ static bool _update(T L, const char *interface) { for (struct ifaddrs *a = _stats.addrs; a != NULL; a = a->ifa_next) { if (a->ifa_addr == NULL) continue; if (Str_isEqual(interface, a->ifa_name) && a->ifa_addr->sa_family == AF_LINK) { int s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { struct ifmediareq ifmr; memset(&ifmr, 0, sizeof(ifmr)); strncpy(ifmr.ifm_name, interface, sizeof(ifmr.ifm_name) - 1); // try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface) if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) { L->state = 1LL; L->duplex = ifmr.ifm_active & 0x00100000 ? 1LL : 0LL; } else { L->state = 0LL; L->duplex = -1LL; } } else { L->state = 1LL; } close(s); } else { L->state = -1LL; L->duplex = -1LL; } struct if_data *data = (struct if_data *)a->ifa_data; L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); L->speed = data->ifi_baudrate; _updateValue(&(L->ibytes), data->ifi_ibytes); _updateValue(&(L->ipackets), data->ifi_ipackets); _updateValue(&(L->ierrors), data->ifi_ierrors); _updateValue(&(L->obytes), data->ifi_obytes); _updateValue(&(L->opackets), data->ifi_opackets); _updateValue(&(L->oerrors), data->ifi_oerrors); return true; } } return false; } monit-5.35.2/src/net/os/dragonfly/0000755000016400001720000000000015007061157013715 500000000000000monit-5.35.2/src/net/os/dragonfly/Link.inc0000644000016400001720000000704315007061157015231 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for DragonFly. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ static boolean_t _update(T L, const char *interface) { for (struct ifaddrs *a = _stats.addrs; a != NULL; a = a->ifa_next) { if (a->ifa_addr == NULL) continue; if (Str_isEqual(interface, a->ifa_name) && a->ifa_addr->sa_family == AF_LINK) { int s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { struct ifmediareq ifmr; memset(&ifmr, 0, sizeof(ifmr)); strncpy(ifmr.ifm_name, interface, sizeof(ifmr.ifm_name) - 1); // try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface) if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) { L->state = 1LL; L->duplex = ifmr.ifm_active & 0x00100000 ? 1LL : 0LL; } else { L->state = 0LL; L->duplex = -1LL; } } else { L->state = 1LL; } close(s); } else { L->state = -1LL; L->duplex = -1LL; } struct if_data *data = (struct if_data *)a->ifa_data; L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); L->speed = data->ifi_baudrate; _updateValue(&(L->ibytes), data->ifi_ibytes); _updateValue(&(L->ipackets), data->ifi_ipackets); _updateValue(&(L->ierrors), data->ifi_ierrors); _updateValue(&(L->obytes), data->ifi_obytes); _updateValue(&(L->opackets), data->ifi_opackets); _updateValue(&(L->oerrors), data->ifi_oerrors); return true; } } return false; } monit-5.35.2/src/net/os/openbsd/0000755000016400001720000000000015007061157013362 500000000000000monit-5.35.2/src/net/os/openbsd/Link.inc0000644000016400001720000000703415007061157014676 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for OpenBSD. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ static bool _update(T L, const char *interface) { for (struct ifaddrs *a = _stats.addrs; a != NULL; a = a->ifa_next) { if (a->ifa_addr == NULL) continue; if (Str_isEqual(interface, a->ifa_name) && a->ifa_addr->sa_family == AF_LINK) { int s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { struct ifmediareq ifmr; memset(&ifmr, 0, sizeof(ifmr)); strncpy(ifmr.ifm_name, interface, sizeof(ifmr.ifm_name) - 1); // try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface) if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) { L->state = 1LL; L->duplex = ifmr.ifm_active & 0x00100000 ? 1LL : 0LL; } else { L->state = 0LL; L->duplex = -1LL; } } else { L->state = 1LL; } close(s); } else { L->state = -1LL; L->duplex = -1LL; } struct if_data *data = (struct if_data *)a->ifa_data; L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); L->speed = data->ifi_baudrate; _updateValue(&(L->ibytes), data->ifi_ibytes); _updateValue(&(L->ipackets), data->ifi_ipackets); _updateValue(&(L->ierrors), data->ifi_ierrors); _updateValue(&(L->obytes), data->ifi_obytes); _updateValue(&(L->opackets), data->ifi_opackets); _updateValue(&(L->oerrors), data->ifi_oerrors); return true; } } return false; } monit-5.35.2/src/net/os/solaris/0000755000016400001720000000000015007061157013404 500000000000000monit-5.35.2/src/net/os/solaris/Link.inc0000644000016400001720000002051715007061157014721 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for Solaris. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #include /* ------------------------------------------------------------- Definitions */ static bool _isSolarisX = false; typedef struct Interface_T { int instance; char module[64]; } *Interface_T; /* ----------------------------------------------------------------- Private */ // Parse the interface name like e1000g1 into module:instance -> e1000g:1 static bool _parseInterface(const char *name, Interface_T interface) { for (int len = strlen(name), i = len - 1; i >= 0; i--) { if (! isdigit(*(name + i))) { strncpy(interface->module, name, i + 1 < (int)sizeof(interface->module) ? i + 1 : (int)sizeof(interface->module) - 1); interface->instance = Str_parseInt(name + i + 1); return true; } } return false; } static kstat_t *_getKstat(kstat_ctl_t *kc, char *name) { kstat_t *ksp; struct Interface_T interface = {}; if (! _isSolarisX) { if ((ksp = kstat_lookup(kc, "link", -1, name))) { /* * Solaris11: * * $ kstat -p -m link -n net0 * link:0:net0:ifspeed 1000000000 * link:0:net0:link_duplex 2 * link:0:net0:link_state 1 * ... * link:0:net0:ierrors 0 * link:0:net0:ipackets 8748 * link:0:net0:ipackets64 8748 * link:0:net0:rbytes 1331127 * link:0:net0:rbytes64 1331127 * ... * link:0:net0:oerrors 0 * link:0:net0:opackets 7560 * link:0:net0:opackets64 7560 * link:0:net0:obytes 3227785 * link:0:net0:obytes64 3227785 */ return ksp; } else if (errno == ENOENT) { /* * Fallback to Solaris 10: * * $ kstat -p -m e1000g -n mac * e1000g:0:mac:ifspeed 1000000000 * e1000g:0:mac:link_duplex 2 * e1000g:0:mac:link_state 1 * e1000g:0:mac:link_up 1 * ... * e1000g:0:mac:ierrors 0 * e1000g:0:mac:ipackets 134096 * e1000g:0:mac:ipackets64 134096 * e1000g:0:mac:rbytes 150727335 * e1000g:0:mac:rbytes64 150727335 * ... * e1000g:0:mac:oerrors 0 * e1000g:0:mac:opackets 81322 * e1000g:0:mac:opackets64 81322 * e1000g:0:mac:obytes 9214172 * e1000g:0:mac:obytes64 9214172 */ if (_parseInterface(name, &interface) && (ksp = kstat_lookup(kc, interface.module, interface.instance, "mac"))) { _isSolarisX = true; return ksp; } } } else { if (_parseInterface(name, &interface) && (ksp = kstat_lookup(kc, interface.module, interface.instance, "mac"))) return ksp; } return NULL; } static long long _getKstatValue(kstat_t *ksp, char *value) { const kstat_named_t *kdata = kstat_data_lookup(ksp, value); if (kdata) { switch (kdata->data_type) { case KSTAT_DATA_INT32: return (long long)kdata->value.i32; case KSTAT_DATA_UINT32: return (long long)kdata->value.ui32; case KSTAT_DATA_INT64: return (long long)kdata->value.i64; case KSTAT_DATA_UINT64: return (long long)kdata->value.ui64; } THROW(AssertException, "Unsupported kstat data type 0x%x", kdata->data_type); } THROW(AssertException, "Cannot read %s statistics -- %s", value, System_getError(errno)); return -1LL; } static void _setStatistics(T L, kstat_t *ksp) { L->state = _getKstatValue(ksp, "link_state") ? 1LL : 0LL; L->speed = _getKstatValue(ksp, "ifspeed"); L->duplex = _getKstatValue(ksp, "link_duplex") == 2 ? 1LL : 0LL; _updateValue(&(L->ibytes), _getKstatValue(ksp, "rbytes64")); _updateValue(&(L->ipackets), _getKstatValue(ksp, "ipackets64")); _updateValue(&(L->ierrors), _getKstatValue(ksp, "ierrors")); _updateValue(&(L->obytes), _getKstatValue(ksp, "obytes64")); _updateValue(&(L->opackets), _getKstatValue(ksp, "opackets64")); _updateValue(&(L->oerrors), _getKstatValue(ksp, "oerrors")); L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); } static bool _update(T L, const char *interface) { /* * Handle IP alias */ char name[STRLEN]; snprintf(name, sizeof(name), "%s", interface); Str_replaceChar(name, ':', 0); kstat_ctl_t *kc = kstat_open(); if (kc) { kstat_t *ksp; if (Str_isEqual(name, "lo0")) { /* * Loopback interface has special module on Solaris and provides packets statistics only. * * $ kstat -p -m lo * lo:0:lo0:ipackets 878 * lo:0:lo0:opackets 878 */ if ((ksp = kstat_lookup(kc, "lo", -1, (char *)name)) && kstat_read(kc, ksp, NULL) != -1) { _updateValue(&(L->ipackets), _getKstatValue(ksp, "ipackets")); _updateValue(&(L->opackets), _getKstatValue(ksp, "opackets")); L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); kstat_close(kc); return true; } else { kstat_close(kc); THROW(AssertException, "Cannot get kstat data -- %s", System_getError(errno)); } } else { if ((ksp = _getKstat(kc, name)) && kstat_read(kc, ksp, NULL) != -1) { _setStatistics(L, ksp); kstat_close(kc); return true; } else { kstat_close(kc); THROW(AssertException, "Cannot get kstat data -- %s", System_getError(errno)); } } } return false; } monit-5.35.2/src/net/os/linux/0000755000016400001720000000000015007061157013067 500000000000000monit-5.35.2/src/net/os/linux/Link.inc0000644000016400001720000002061115007061157014377 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * Implementation of the Network Statistics for Linux. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * * Reference: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net * * @file */ static bool _update(T L, const char *interface) { int flags; char buf[STRLEN]; char path[PATH_MAX]; char name[STRLEN]; /* * Handle IP alias */ snprintf(name, sizeof(name), "%s", interface); Str_replaceChar(name, ':', 0); /* * Get interface operation state * $ cat /sys/class/net/eth0/flags * */ snprintf(path, sizeof(path), "/sys/class/net/%s/flags", name); FILE *f = fopen(path, "r"); if (f) { if (fscanf(f, "%x\n", &flags) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } L->state = (flags & 0x1) ? 1LL : 0LL; // IFF_UP fclose(f); } else { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } /* * Get interface speed (Optional: may not be present on older kernels and readable for pseudo interface types). * $ cat /sys/class/net/eth0/speed * 1000 * If the link is down the file either doesn't exist or contains UINT_MAX (depends on kernel version): * $ cat /sys/class/net/eth0/speed * 4294967295 */ snprintf(path, sizeof(path), "/sys/class/net/%s/speed", name); f = fopen(path, "r"); if (f) { if (fscanf(f, "%lld\n", &(L->speed)) == 1 && L->speed != UINT_MAX) L->speed *= 1000000; // mbps -> bps else L->speed = -1LL; fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->speed = -1LL; } /* * Get interface full/half duplex status (Optional: may not be present on older kernels and readable for pseudo interface types). * $ cat /sys/class/net/eth0/duplex * full * If the link is down the file either doesn't exist or contains "unknown" value (depends on kernel version): * $ cat /sys/class/net/eth0/duplex * unknown */ snprintf(path, sizeof(path), "/sys/class/net/%s/duplex", name); f = fopen(path, "r"); if (f) { if (fscanf(f, "%255s\n", buf) == 1 && ! Str_isEqual(buf, "unknown")) L->duplex = Str_isEqual(buf, "full") ? 1LL : 0LL; else L->duplex = -1; fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->duplex = -1; } /* * $ cat /sys/class/net/eth0/statistics/rx_bytes (Optional: doesn't exist on WSL2) * 239426 */ snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/rx_bytes", name); f = fopen(path, "r"); if (f) { long long ibytes; if (fscanf(f, "%lld\n", &ibytes) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } _updateValue(&(L->ibytes), ibytes); fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->ibytes.available = false; } /* * $ cat /sys/class/net/eth0/statistics/rx_packets (Optional: doesn't exist on WSL2) * 2706 */ snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/rx_packets", name); f = fopen(path, "r"); if (f) { long long ipackets; if (fscanf(f, "%lld\n", &ipackets) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } _updateValue(&(L->ipackets), ipackets); fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->ipackets.available = false; } /* * $ cat /sys/class/net/eth0/statistics/rx_errors (Optional: doesn't exist on WSL2) * 0 */ snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/rx_errors", name); f = fopen(path, "r"); if (f) { long long ierrors; if (fscanf(f, "%lld\n", &ierrors) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } _updateValue(&(L->ierrors), ierrors); fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->ierrors.available = false; } /* * $ cat /sys/class/net/eth0/statistics/tx_bytes (Optional: doesn't exist on WSL2) * 410775 */ snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/tx_bytes", name); f = fopen(path, "r"); if (f) { long long obytes; if (fscanf(f, "%lld\n", &obytes) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } _updateValue(&(L->obytes), obytes); fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->obytes.available = false; } /* * $ cat /sys/class/net/eth0/statistics/tx_packets (Optional: doesn't exist on WSL2) * 1649 */ snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/tx_packets", name); f = fopen(path, "r"); if (f) { long long opackets; if (fscanf(f, "%lld\n", &opackets) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } _updateValue(&(L->opackets), opackets); fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->opackets.available = false; } /* * $ cat /sys/class/net/eth0/statistics/tx_errors (Optional: doesn't exist on WSL2) * 0 */ snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/tx_errors", name); f = fopen(path, "r"); if (f) { long long oerrors; if (fscanf(f, "%lld\n", &oerrors) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } _updateValue(&(L->oerrors), oerrors); fclose(f); } else { DEBUG("Cannot read %s -- %s\n", path, System_getError(errno)); L->oerrors.available = false; } L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); return true; } monit-5.35.2/src/net/net.h0000644000016400001720000000563415007061157012176 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef NET_H #define NET_H #include "config.h" #include "monit.h" /** * General purpose Network and Socket methods. * * @file */ /** * Create a non-blocking server socket and bind it to the specified local * port number, with the specified backlog. Set a socket option to * make the port reusable again. If a bind address is given the socket * will only accept connect requests to this addresses. If the bind * address is NULL it will accept connections on any/all local * addresses * @param address the local address the server will bind to * @param port The localhost port number to open * @param family The socket family to use * @param backlog The maximum queue length for incoming connections * @param error Error buffer * @return The socket ready for accept or -1 if failed */ int create_server_socket_tcp(const char *address, int port, Socket_Family family, int backlog, char error[STRLEN]); /** * Create a non-blocking server socket and bind it to the specified unix * socket path, with the specified backlog. * @param address the path to the unix socket * @param backlog The maximum queue length for incoming connections * @param error Error buffer * @return The socket ready for accept or -1 if failed */ int create_server_socket_unix(const char *path, int backlog, char error[STRLEN]); /** * Create a ICMP socket against hostname, send echo and wait for response. * The 'count' echo requests is send and we expect at least one reply. * @param hostname The host to open a socket at * @param family The socket family to use * @param outgoing Outgoing IP address (optional) * @param size The ping size * @param timeout If response will not come within timeout milliseconds abort * @param count How many pings to send * @return response time on success, -1 on error */ double icmp_echo(const char *hostname, Socket_Family family, Outgoing_T *outgoing, int size, int timeout, int count); #endif monit-5.35.2/src/net/Link.h0000644000016400001720000002131715007061157012301 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef LINK_INCLUDED #define LINK_INCLUDED /** * Facade for system specific network link data * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define T Link_T typedef struct T *T; /** * Test if Link by IP address is supported. * @return true if supported, false if not */ bool Link_isGetByAddressSupported(void); /** * Get a Link object for the given IP address. * @param address IP address (e.g. "127.0.0.1" or "::1") * @return Link object. Use Link_update() to populate with data. */ T Link_createForAddress(const char *address); /** * Get a Link object for the given interface name. * @param interface Network interface name (e.g. "eth0") * @return Link object. Use Link_update() to populate with data. */ T Link_createForInterface(const char *interface); /** * Destroy a Link object and release allocated resources. * @param L A Link object reference */ void Link_free(T *L); /** * Reset Link object data. * @param L A Link object */ void Link_reset(T L); /** * Update network statistics for object. * @param L A Link object * @exception AssertException If statistics cannot be gathered or * the address/interface is invalid. */ void Link_update(T L); /** * Get incoming bytes per second. * @param L A Link object * @return Incoming bytes per second or -1 if not available. */ long long Link_getBytesInPerSecond(T L); /** * Get incoming bytes per minute. * @param L A Link object * @param count Number of minutes, the returned number will be for the * range given by 'now - count' (count max = 60m) * @return Incoming bytes per minute or -1 if not available. */ long long Link_getBytesInPerMinute(T L, int count); /** * Get total incoming bytes. * @param L A Link object * @return Incoming bytes total or -1 if not available. */ long long Link_getBytesInTotal(T L); /** * Get incoming link saturation. * @param L A Link object * @return Incoming link saturation percent or -1 the link has unknown speed. */ double Link_getSaturationInPerSecond(T L); /** * Get incoming bytes per hour. * @param L A Link object * @param count Number of hours, the returned number will be for * range given by 'now - count' (count max = 24h) * @return Incoming bytes per hour or -1 if not available. */ long long Link_getBytesInPerHour(T L, int count); /** * Get incoming packets per second. * @param L A Link object * @return Incoming packets per second or -1 if not available. */ long long Link_getPacketsInPerSecond(T L); /** * Get incoming packets per minute. * @param L A object * @param count Number of minutes, the returned statistics will be for * the range given by 'now - count' (count max = 60m) * @return Incoming packets per minute statistics or -1 if not available. */ long long Link_getPacketsInPerMinute(T L, int count); /** * Get incoming packets per hour statistics. * @param L A Link object * @param count Number of hours, the returned statistics will be for * the range given by 'now - count' (count max = 24h) * @return Incoming packets per hour statistics or -1 if not available. */ long long Link_getPacketsInPerHour(T L, int count); /** * Get total incoming packets statistics. * @param L A Link object * @return Incoming packets total or -1 if not available. */ long long Link_getPacketsInTotal(T L); /** * Get incoming errors per second. * @param L A Link object * @return Incoming errors per second or -1 if not available. */ long long Link_getErrorsInPerSecond(T L); /** * Get incoming errors per minute. * @param L A Link object * @param count Number of minutes, the returned statistics will be for * the range given by 'now - count' (count max = 60m) * @return Incoming errors per minute or -1 if not available. */ long long Link_getErrorsInPerMinute(T L, int count); /** * Get incoming errors per hour. * @param L A Link object * @param count Number of hours, the returned statistics will be for * the range given by 'now - count' (count max = 24h) * @return Incoming errors per hour or -1 if not available. */ long long Link_getErrorsInPerHour(T L, int count); /** * Get total incoming errors. * @param L A Link object * @return Incoming errors total or -1 if not available. */ long long Link_getErrorsInTotal(T L); /** * Get outgoing bytes per second. * @param L A Link object * @return Outgoing bytes per second or -1 if not available. */ long long Link_getBytesOutPerSecond(T L); /** * Get outgoing bytes per minute. * @param L A Link object * @param count Number of minutes, the returned statistics will be for * the range given by 'now - count' (count max = 60m) * @return Outgoing bytes per minute or -1 if not available. */ long long Link_getBytesOutPerMinute(T L, int count); /** * Get outgoing bytes per hour. * @param L A Link object * @param count Number of hours, the returned statistics will be for * the range given by 'now - count' (count max = 24h) * @return Outgoing bytes per hour or -1 if not available. */ long long Link_getBytesOutPerHour(T L, int count); /** * Get total outgoing bytes. * @param L A Link object * @return Outgoing bytes total or -1 if not available. */ long long Link_getBytesOutTotal(T L); /** * Get outgoing link saturation. * @param L A Link object * @return Outgoing link saturation percent or -1 the link has unknown speed. */ double Link_getSaturationOutPerSecond(T L); /** * Get outgoing packets per second. * @param L A Link object * @return Outgoing packets per second or -1 if not available. */ long long Link_getPacketsOutPerSecond(T L); /** * Get outgoing packets per minute. * @param L A Link object * @param count Number of minutes, the returned statistics will be for * the range given by 'now - count' (count max = 60m) * @return Outgoing packets per minute or -1 if not available. */ long long Link_getPacketsOutPerMinute(T L, int count); /** * Get outgoing packets per hour. * @param L A Link object * @param count Number of hours, the returned statistics will be for * the range given by 'now - count' (count max = 24h) * @return Outgoing packets per hour or -1 if not available. */ long long Link_getPacketsOutPerHour(T L, int count); /** * Get total outgoing packets. * @param L A Link object * @return Outgoing packets total or -1 if not available. */ long long Link_getPacketsOutTotal(T L); /** * Get outgoing errors per second. * @param L A Link object * @return Outgoing errors per second or -1 if not available. */ long long Link_getErrorsOutPerSecond(T L); /** * Get outgoing errors per minute. * @param L A Link object * @param count Number of minutes, the returned statistics will be for * the range given by 'now - count' (count max = 60m) * @return Outgoing errors per minute or -1 if not available. */ long long Link_getErrorsOutPerMinute(T L, int count); /** * Get outgoing errors per hour. * @param L A Link object * @param count Number of hours, the returned statistics will be for * the range given by 'now - count' (count max = 24h) * @return Outgoing errors per hour or -1 if not available. */ long long Link_getErrorsOutPerHour(T L, int count); /** * Get total outgoing errors. * @param L A Link object * @return Outgoing errors total or -1 if not available */ long long Link_getErrorsOutTotal(T L); /** * Get interface state. * @param L A Link object * @return Interface state (-1 = N/A, 0 = down, 1 = up) */ int Link_getState(T L); /** * Get interface speed (note: not all interface types support speed) * @param L A Link object * @return Interface speed [bps] (-1 = N/A) */ long long Link_getSpeed(T L); /** * Get interface duplex state (note: not all interface types support duplex) * @param L A Link object * @return Duplex state (-1 = N/A, 0 = half, 1 = full) */ int Link_getDuplex(T L); #undef T #endif monit-5.35.2/src/net/net.c0000644000016400001720000005374015007061157012172 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef NEED_SOCKLEN_T_DEFINED #define _BSD_SOCKLEN_T_ #endif #ifdef HAVE_NETINET_IN_SYSTM_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_SYS_UN_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_NET_IF_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_FILIO_H #include #endif #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_SYS_FILIO_H #include #endif #ifdef HAVE_NETINET_IP_H #include #endif #ifdef HAVE_NETINET_IP_ICMP_H #include #endif #ifdef HAVE_NETINET_ICMP6_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDDEF_H #include #else #define offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 )) #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifndef __dietlibc__ #ifdef HAVE_STROPTS_H #include #endif #endif #ifdef HAVE_ARPA_INET_H #include #endif #include "monit.h" #include "net.h" // libmonit #include "util/Fmt.h" #include "system/Net.h" #include "system/Time.h" #include "exceptions/AssertException.h" #include "exceptions/IOException.h" /** * General purpose Network and Socket methods. * * @file */ /* ----------------------------------------------------------------- Private */ /* * Compute Internet Checksum for "count" bytes beginning at location "addr". * Based on RFC1071. */ static unsigned short _checksum(unsigned char *_addr, int count) { register long sum = 0; unsigned short *addr = (unsigned short *)_addr; while (count > 1) { sum += *addr++; count -= 2; } /* Add left-over byte, if any */ if (count > 0) sum += *(unsigned char *)addr; /* Fold 32-bit sum to 16 bits */ while (sum >> 16) sum = (sum & 0xffff) + (sum >> 16); return ~sum; } __attribute__((format (printf, 3, 4))) static void _log_warningOrError(int attempt, int maxAttempts, const char *s, ...) { assert(s); va_list ap; va_start(ap, s); if (attempt < maxAttempts) { Log_vwarning(s, ap); } else { Log_verror(s, ap); } va_end(ap); } /* ------------------------------------------------------------------ Public */ int create_server_socket_tcp(const char *address, int port, Socket_Family family, int backlog, char error[STRLEN]) { struct addrinfo *result, hints = { .ai_flags = AI_PASSIVE, .ai_socktype = SOCK_STREAM, .ai_protocol = IPPROTO_TCP }; switch (family) { case Socket_Ip: hints.ai_family = AF_UNSPEC; break; case Socket_Ip4: hints.ai_family = AF_INET; break; #ifdef HAVE_IPV6 case Socket_Ip6: hints.ai_family = AF_INET6; break; #endif default: snprintf(error, STRLEN, "Invalid socket family %d", family); return -1; } char _port[6]; snprintf(_port, sizeof(_port), "%d", port); int status = getaddrinfo(address, _port, &hints, &result); if (status) { snprintf(error, STRLEN, "Cannot translate %s socket [%s]:%d -- %s", Socket_Names[family], NVLSTR(address), port, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); return -1; } int flag = 1; for (struct addrinfo *_result = result; _result; _result = _result->ai_next) { int s = socket(_result->ai_family, _result->ai_socktype, _result->ai_protocol); if (s != -1) { if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag)) == 0) { if (Net_setNonBlocking(s)) { if (fcntl(s, F_SETFD, FD_CLOEXEC) != -1) { if (family != Socket_Ip6 || setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)) == 0) { if (bind(s, _result->ai_addr, _result->ai_addrlen) == 0) { if (listen(s, backlog) == 0) { freeaddrinfo(result); return s; } else { snprintf(error, STRLEN, "Cannot listen: %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot bind: %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot set IPV6_V6ONLY option: %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot set close on exec option: %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot set nonblocking socket: %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot set reuseaddr option: %s", STRERROR); } if (close(s) < 0) Log_error("Server socket %d close failed: %s\n", s, STRERROR); } else { snprintf(error, STRLEN, "Cannot create socket: %s", STRERROR); } } freeaddrinfo(result); return -1; } int create_server_socket_unix(const char *path, int backlog, char error[STRLEN]) { int s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { snprintf(error, STRLEN, "Cannot create socket -- %s", STRERROR); return -1; } struct sockaddr_un addr = { .sun_family = AF_UNIX }; snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path); if (Net_setNonBlocking(s)) { if (fcntl(s, F_SETFD, FD_CLOEXEC) != -1) { if (bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) == 0) { if (listen(s, backlog) == 0) { return s; } else { snprintf(error, STRLEN, "Cannot listen -- %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot bind -- %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot set close on exec option -- %s", STRERROR); } } else { snprintf(error, STRLEN, "Cannot set nonblocking socket: %s", STRERROR); } if (close(s) < 0) Log_error("Socket %d close failed -- %s\n", s, STRERROR); return -1; } static void _setPingOptions(int socket, struct addrinfo *addr) { #ifdef HAVE_IPV6 struct icmp6_filter filter; ICMP6_FILTER_SETBLOCKALL(&filter); ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filter); #endif int ttl = 255; switch (addr->ai_family) { case AF_INET: if (setsockopt(socket, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)) < 0) Log_error("Ping: setsockopt for TTL failed -- %s\n", System_lastError()); break; #ifdef HAVE_IPV6 case AF_INET6: if (setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)) < 0) Log_error("Ping: setsockopt for multicast hops failed -- %s\n", System_lastError()); if (setsockopt(socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)) < 0) Log_error("Ping: setsockopt for unicast hops failed -- %s\n", System_lastError()); if (setsockopt(socket, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof(struct icmp6_filter)) < 0) Log_error("Ping: setsockopt for filter failed -- %s\n", System_lastError()); break; #endif default: break; } } static bool _sendPing(const char *hostname, int socket, struct addrinfo *addr, int size, int retry, int maxretries, int id, long long started) { char buf[ICMP_MAXSIZE] = {}; int header_len = 0; unsigned long out_len = 0; void *out_icmp = NULL; struct icmp *out_icmp4; #ifdef HAVE_IPV6 struct icmp6_hdr *out_icmp6; #endif switch (addr->ai_family) { case AF_INET: out_icmp4 = (struct icmp *)buf; out_icmp4->icmp_type = ICMP_ECHO; out_icmp4->icmp_code = 0; out_icmp4->icmp_cksum = 0; out_icmp4->icmp_id = htons(id); out_icmp4->icmp_seq = htons(retry); memcpy((long long *)(out_icmp4->icmp_data), &started, sizeof(long long)); // set data to timestamp header_len = offsetof(struct icmp, icmp_data); out_len = header_len + size; out_icmp4->icmp_cksum = _checksum((unsigned char *)out_icmp4, (int)out_len); // IPv4 requires checksum computation out_icmp = out_icmp4; break; #ifdef HAVE_IPV6 case AF_INET6: out_icmp6 = (struct icmp6_hdr *)buf; out_icmp6->icmp6_type = ICMP6_ECHO_REQUEST; out_icmp6->icmp6_code = 0; out_icmp6->icmp6_cksum = 0; out_icmp6->icmp6_id = htons(id); out_icmp6->icmp6_seq = htons(retry); memcpy((long long *)(out_icmp6 + 1), &started, sizeof(long long)); // set data to timestamp header_len = sizeof(struct icmp6_hdr); out_len = header_len + size; out_icmp = out_icmp6; break; #endif default: break; } if (out_len > sizeof(buf)) { _log_warningOrError(retry, maxretries, "Ping request for %s %d/%d failed -- too large (%d vs. maximum %lu bytes)\n", hostname, retry, maxretries, size, (unsigned long)(sizeof(buf) - header_len)); return false; } ssize_t n; do { n = sendto(socket, out_icmp, out_len, 0, addr->ai_addr, addr->ai_addrlen); } while (n == -1 && errno == EINTR); if (n < 0) { _log_warningOrError(retry, maxretries, "Ping request for %s %d/%d failed -- %s\n", hostname, retry, maxretries, STRERROR); return false; } return true; } static double _receivePing(const char *hostname, int socket, struct addrinfo *addr, int retry, int maxretries, int out_id, long long started, int timeout) { int in_len = 0, read_timeout = timeout; uint16_t in_id = 0, in_seq = 0; unsigned char *data = NULL; struct icmp *in_icmp4; struct ip *in_iphdr4; #ifdef HAVE_IPV6 struct icmp6_hdr *in_icmp6; #endif ssize_t n; char buf[ICMP_MAXSIZE] = {}; switch (addr->ai_family) { case AF_INET: in_len = 36; // 20 bytes for IP header + 8 bytes for minimum ICMP fields (type, code, checksum, id, seq) + 8 bytes for data payload break; #ifdef HAVE_IPV6 case AF_INET6: in_len = sizeof(struct icmp6_hdr); break; #endif default: break; } while (read_timeout > 0 && Net_canRead(socket, read_timeout)) { if (Run.flags & Run_Stopped) { return -1.; } long long stopped = Time_micro(); struct sockaddr_storage in_addr; socklen_t addrlen = sizeof(in_addr); bool in_addrmatch = false, in_typematch = false; do { n = recvfrom(socket, buf, sizeof(buf), 0, (struct sockaddr *)&in_addr, &addrlen); } while (n == -1 && errno == EINTR); if (n < 0) { _log_warningOrError(retry, maxretries, "Ping response from %s %d/%d failed -- %s\n", hostname, retry, maxretries, STRERROR); return -1.; } else if (n >= in_len) { /* read from raw socket via recvfrom() provides messages regardless of origin, we have to check the IP and skip responses belonging to other conversations or different ICMP types (n < in_len) */ switch (in_addr.ss_family) { case AF_INET: in_addrmatch = memcmp(&((struct sockaddr_in *)&in_addr)->sin_addr, &((struct sockaddr_in *)(addr->ai_addr))->sin_addr, sizeof(struct in_addr)) ? false : true; in_iphdr4 = (struct ip *)buf; in_icmp4 = (struct icmp *)(buf + in_iphdr4->ip_hl * 4); in_typematch = in_icmp4->icmp_type == ICMP_ECHOREPLY ? true : false; in_id = ntohs(in_icmp4->icmp_id); in_seq = ntohs(in_icmp4->icmp_seq); data = (unsigned char *)in_icmp4->icmp_data; break; #ifdef HAVE_IPV6 case AF_INET6: in_addrmatch = memcmp(&((struct sockaddr_in6 *)&in_addr)->sin6_addr, &((struct sockaddr_in6 *)(addr->ai_addr))->sin6_addr, sizeof(struct in6_addr)) ? false : true; in_icmp6 = (struct icmp6_hdr *)buf; in_typematch = in_icmp6->icmp6_type == ICMP6_ECHO_REPLY ? true : false; in_id = ntohs(in_icmp6->icmp6_id); in_seq = ntohs(in_icmp6->icmp6_seq); data = (unsigned char *)(in_icmp6 + 1); break; #endif default: Log_error("Invalid address family: %d\n", in_addr.ss_family); return -1.; } } if (n < in_len || in_addr.ss_family != addr->ai_family || ! in_addrmatch || ! in_typematch || in_id != out_id || in_seq > (uint16_t)maxretries) { // Try to read next packet, but don't exceed the timeout while waiting for our response so we won't loop forever if the socket is flooded with other ICMP packets if (stopped < started) { // Time jumped break; } else { read_timeout = timeout - (stopped - started) / 1000.; } } else { memcpy(&started, data, sizeof(long long)); double response = (double)(stopped - started) / 1000.; // Convert microseconds to milliseconds DEBUG("Ping response for %s %d/%d succeeded -- received id=%d sequence=%d response_time=%s\n", hostname, retry, maxretries, in_id, in_seq, Fmt_time2str(response, (char[11]){})); return response; // Wait for one response only } } _log_warningOrError(retry, maxretries, "Ping response for %s %d/%d timed out -- no response within %s\n", hostname, retry, maxretries, Fmt_time2str(timeout, (char[11]){})); return -1.; } double icmp_echo(const char *hostname, Socket_Family family, Outgoing_T *outgoing, int size, int timeout, int maxretries) { assert(hostname); assert(size > 0); double response = -1.; struct addrinfo *result, hints = { /* filter for only one sockettype to not get back one address multiple times for each protocol and sockettype */ .ai_socktype = SOCK_RAW, }; switch (family) { case Socket_Ip: hints.ai_family = AF_UNSPEC; break; case Socket_Ip4: hints.ai_family = AF_INET; break; #ifdef HAVE_IPV6 case Socket_Ip6: hints.ai_family = AF_INET6; break; #endif default: Log_error("Invalid socket family %d\n", family); return -1.; } int status = getaddrinfo(hostname, NULL, &hints, &result); if (status) { Log_error("Ping for %s -- getaddrinfo failed: %s\n", hostname, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); return -1.; } int s = -1; for (struct addrinfo *addr = result; addr && response < 0.; addr = addr->ai_next) { if (outgoing->addrlen == 0 || outgoing->addrlen == addr->ai_addrlen) { switch (addr->ai_family) { case AF_INET: s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); break; #ifdef HAVE_IPV6 case AF_INET6: s = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); break; #endif default: Log_error("Ping for %s -- unknown address family: %d\n", hostname, addr->ai_family); continue; } if (s >= 0) { if (outgoing->ip && bind(s, (struct sockaddr *)&(outgoing->addr), outgoing->addrlen) < 0) { Log_error("Cannot bind to outgoing address -- %s\n", STRERROR); } else { _setPingOptions(s, addr); uint16_t id = getpid() & 0xFFFF; for (int retry = 1; retry <= maxretries && ! (Run.flags & Run_Stopped); retry++) { long long started = Time_micro(); if (_sendPing(hostname, s, addr, size, retry, maxretries, id, started) && (response = _receivePing(hostname, s, addr, retry, maxretries, id, started, timeout)) >= 0.) { // Success break; } } } Net_close(s); } else { // Cannot create a socket -> return error if (errno == EACCES || errno == EPERM) { DEBUG("Ping for %s -- cannot create socket: %s\n", hostname, STRERROR); response = -2.; } else { Log_error("Ping for %s -- cannot create socket: %s\n", hostname, STRERROR); } goto error; } } } error: freeaddrinfo(result); return response; } monit-5.35.2/src/y.tab.h0000644000016400001720000005674715007061176011653 00000000000000/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ #ifndef YY_YY_SRC_Y_TAB_H_INCLUDED # define YY_YY_SRC_Y_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; #endif /* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { YYEMPTY = -2, YYEOF = 0, /* "end of file" */ YYerror = 256, /* error */ YYUNDEF = 257, /* "invalid token" */ IF = 258, /* IF */ ELSE = 259, /* ELSE */ THEN = 260, /* THEN */ FAILED = 261, /* FAILED */ SET = 262, /* SET */ LOGFILE = 263, /* LOGFILE */ FACILITY = 264, /* FACILITY */ DAEMON = 265, /* DAEMON */ SYSLOG = 266, /* SYSLOG */ MAILSERVER = 267, /* MAILSERVER */ HTTPD = 268, /* HTTPD */ ALLOW = 269, /* ALLOW */ REJECTOPT = 270, /* REJECTOPT */ ADDRESS = 271, /* ADDRESS */ INIT = 272, /* INIT */ TERMINAL = 273, /* TERMINAL */ BATCH = 274, /* BATCH */ READONLY = 275, /* READONLY */ CLEARTEXT = 276, /* CLEARTEXT */ MD5HASH = 277, /* MD5HASH */ SHA1HASH = 278, /* SHA1HASH */ CRYPT = 279, /* CRYPT */ DELAY = 280, /* DELAY */ PEMFILE = 281, /* PEMFILE */ PEMKEY = 282, /* PEMKEY */ PEMCHAIN = 283, /* PEMCHAIN */ ENABLE = 284, /* ENABLE */ DISABLE = 285, /* DISABLE */ SSLTOKEN = 286, /* SSLTOKEN */ CIPHER = 287, /* CIPHER */ CLIENTPEMFILE = 288, /* CLIENTPEMFILE */ ALLOWSELFCERTIFICATION = 289, /* ALLOWSELFCERTIFICATION */ SELFSIGNED = 290, /* SELFSIGNED */ VERIFY = 291, /* VERIFY */ CERTIFICATE = 292, /* CERTIFICATE */ CACERTIFICATEFILE = 293, /* CACERTIFICATEFILE */ CACERTIFICATEPATH = 294, /* CACERTIFICATEPATH */ VALID = 295, /* VALID */ INTERFACE = 296, /* INTERFACE */ LINK = 297, /* LINK */ PACKET = 298, /* PACKET */ BYTEIN = 299, /* BYTEIN */ BYTEOUT = 300, /* BYTEOUT */ PACKETIN = 301, /* PACKETIN */ PACKETOUT = 302, /* PACKETOUT */ SPEED = 303, /* SPEED */ SATURATION = 304, /* SATURATION */ UPLOAD = 305, /* UPLOAD */ DOWNLOAD = 306, /* DOWNLOAD */ TOTAL = 307, /* TOTAL */ UP = 308, /* UP */ DOWN = 309, /* DOWN */ IDFILE = 310, /* IDFILE */ STATEFILE = 311, /* STATEFILE */ SEND = 312, /* SEND */ EXPECT = 313, /* EXPECT */ CYCLE = 314, /* CYCLE */ COUNT = 315, /* COUNT */ REMINDER = 316, /* REMINDER */ REPEAT = 317, /* REPEAT */ LIMITS = 318, /* LIMITS */ SENDEXPECTBUFFER = 319, /* SENDEXPECTBUFFER */ EXPECTBUFFER = 320, /* EXPECTBUFFER */ FILECONTENTBUFFER = 321, /* FILECONTENTBUFFER */ HTTPCONTENTBUFFER = 322, /* HTTPCONTENTBUFFER */ PROGRAMOUTPUT = 323, /* PROGRAMOUTPUT */ NETWORKTIMEOUT = 324, /* NETWORKTIMEOUT */ PROGRAMTIMEOUT = 325, /* PROGRAMTIMEOUT */ STARTTIMEOUT = 326, /* STARTTIMEOUT */ STOPTIMEOUT = 327, /* STOPTIMEOUT */ RESTARTTIMEOUT = 328, /* RESTARTTIMEOUT */ EXECTIMEOUT = 329, /* EXECTIMEOUT */ PIDFILE = 330, /* PIDFILE */ START = 331, /* START */ STOP = 332, /* STOP */ PATHTOK = 333, /* PATHTOK */ RSAKEY = 334, /* RSAKEY */ HOST = 335, /* HOST */ HOSTNAME = 336, /* HOSTNAME */ PORT = 337, /* PORT */ IPV4 = 338, /* IPV4 */ IPV6 = 339, /* IPV6 */ TYPE = 340, /* TYPE */ UDP = 341, /* UDP */ TCP = 342, /* TCP */ TCPSSL = 343, /* TCPSSL */ PROTOCOL = 344, /* PROTOCOL */ CONNECTION = 345, /* CONNECTION */ ALERT = 346, /* ALERT */ NOALERT = 347, /* NOALERT */ MAILFORMAT = 348, /* MAILFORMAT */ UNIXSOCKET = 349, /* UNIXSOCKET */ SIGNATURE = 350, /* SIGNATURE */ TIMEOUT = 351, /* TIMEOUT */ RETRY = 352, /* RETRY */ RESTART = 353, /* RESTART */ CHECKSUM = 354, /* CHECKSUM */ EVERY = 355, /* EVERY */ NOTEVERY = 356, /* NOTEVERY */ DEFAULT = 357, /* DEFAULT */ HTTP = 358, /* HTTP */ HTTPS = 359, /* HTTPS */ APACHESTATUS = 360, /* APACHESTATUS */ FTP = 361, /* FTP */ SMTP = 362, /* SMTP */ SMTPS = 363, /* SMTPS */ POP = 364, /* POP */ POPS = 365, /* POPS */ IMAP = 366, /* IMAP */ IMAPS = 367, /* IMAPS */ CLAMAV = 368, /* CLAMAV */ NNTP = 369, /* NNTP */ NTP3 = 370, /* NTP3 */ MYSQL = 371, /* MYSQL */ MYSQLS = 372, /* MYSQLS */ DNS = 373, /* DNS */ WEBSOCKET = 374, /* WEBSOCKET */ MQTT = 375, /* MQTT */ SSH = 376, /* SSH */ DWP = 377, /* DWP */ LDAP2 = 378, /* LDAP2 */ LDAP3 = 379, /* LDAP3 */ RDATE = 380, /* RDATE */ RSYNC = 381, /* RSYNC */ TNS = 382, /* TNS */ PGSQL = 383, /* PGSQL */ POSTFIXPOLICY = 384, /* POSTFIXPOLICY */ SIP = 385, /* SIP */ LMTP = 386, /* LMTP */ GPS = 387, /* GPS */ RADIUS = 388, /* RADIUS */ MEMCACHE = 389, /* MEMCACHE */ REDIS = 390, /* REDIS */ MONGODB = 391, /* MONGODB */ SIEVE = 392, /* SIEVE */ SPAMASSASSIN = 393, /* SPAMASSASSIN */ FAIL2BAN = 394, /* FAIL2BAN */ STRING = 395, /* STRING */ PATH = 396, /* PATH */ MAILADDR = 397, /* MAILADDR */ MAILFROM = 398, /* MAILFROM */ MAILREPLYTO = 399, /* MAILREPLYTO */ MAILSUBJECT = 400, /* MAILSUBJECT */ MAILBODY = 401, /* MAILBODY */ SERVICENAME = 402, /* SERVICENAME */ STRINGNAME = 403, /* STRINGNAME */ HOSTGROUPNAME = 404, /* HOSTGROUPNAME */ NUMBER = 405, /* NUMBER */ PERCENT = 406, /* PERCENT */ LOGLIMIT = 407, /* LOGLIMIT */ CLOSELIMIT = 408, /* CLOSELIMIT */ DNSLIMIT = 409, /* DNSLIMIT */ KEEPALIVELIMIT = 410, /* KEEPALIVELIMIT */ REPLYLIMIT = 411, /* REPLYLIMIT */ REQUESTLIMIT = 412, /* REQUESTLIMIT */ STARTLIMIT = 413, /* STARTLIMIT */ WAITLIMIT = 414, /* WAITLIMIT */ GRACEFULLIMIT = 415, /* GRACEFULLIMIT */ CLEANUPLIMIT = 416, /* CLEANUPLIMIT */ REAL = 417, /* REAL */ CHECKPROC = 418, /* CHECKPROC */ CHECKFILESYS = 419, /* CHECKFILESYS */ CHECKFILE = 420, /* CHECKFILE */ CHECKDIR = 421, /* CHECKDIR */ CHECKHOST = 422, /* CHECKHOST */ CHECKSYSTEM = 423, /* CHECKSYSTEM */ CHECKFIFO = 424, /* CHECKFIFO */ CHECKPROGRAM = 425, /* CHECKPROGRAM */ CHECKNET = 426, /* CHECKNET */ THREADS = 427, /* THREADS */ CHILDREN = 428, /* CHILDREN */ METHOD = 429, /* METHOD */ GET = 430, /* GET */ HEAD = 431, /* HEAD */ STATUS = 432, /* STATUS */ ORIGIN = 433, /* ORIGIN */ VERSIONOPT = 434, /* VERSIONOPT */ READ = 435, /* READ */ WRITE = 436, /* WRITE */ OPERATION = 437, /* OPERATION */ SERVICETIME = 438, /* SERVICETIME */ DISK = 439, /* DISK */ RESOURCE = 440, /* RESOURCE */ MEMORY = 441, /* MEMORY */ TOTALMEMORY = 442, /* TOTALMEMORY */ LOADAVG1 = 443, /* LOADAVG1 */ LOADAVG5 = 444, /* LOADAVG5 */ LOADAVG15 = 445, /* LOADAVG15 */ SWAP = 446, /* SWAP */ MODE = 447, /* MODE */ ACTIVE = 448, /* ACTIVE */ PASSIVE = 449, /* PASSIVE */ MANUAL = 450, /* MANUAL */ ONREBOOT = 451, /* ONREBOOT */ NOSTART = 452, /* NOSTART */ LASTSTATE = 453, /* LASTSTATE */ CORE = 454, /* CORE */ CPU = 455, /* CPU */ TOTALCPU = 456, /* TOTALCPU */ CPUUSER = 457, /* CPUUSER */ CPUSYSTEM = 458, /* CPUSYSTEM */ CPUWAIT = 459, /* CPUWAIT */ CPUNICE = 460, /* CPUNICE */ CPUHARDIRQ = 461, /* CPUHARDIRQ */ CPUSOFTIRQ = 462, /* CPUSOFTIRQ */ CPUSTEAL = 463, /* CPUSTEAL */ CPUGUEST = 464, /* CPUGUEST */ CPUGUESTNICE = 465, /* CPUGUESTNICE */ GROUP = 466, /* GROUP */ REQUEST = 467, /* REQUEST */ DEPENDS = 468, /* DEPENDS */ BASEDIR = 469, /* BASEDIR */ SLOT = 470, /* SLOT */ EVENTQUEUE = 471, /* EVENTQUEUE */ SECRET = 472, /* SECRET */ HOSTHEADER = 473, /* HOSTHEADER */ UID = 474, /* UID */ EUID = 475, /* EUID */ GID = 476, /* GID */ MMONIT = 477, /* MMONIT */ INSTANCE = 478, /* INSTANCE */ USERNAME = 479, /* USERNAME */ PASSWORD = 480, /* PASSWORD */ DATABASE = 481, /* DATABASE */ TIME = 482, /* TIME */ ATIME = 483, /* ATIME */ CTIME = 484, /* CTIME */ MTIME = 485, /* MTIME */ CHANGED = 486, /* CHANGED */ MILLISECOND = 487, /* MILLISECOND */ SECOND = 488, /* SECOND */ MINUTE = 489, /* MINUTE */ HOUR = 490, /* HOUR */ DAY = 491, /* DAY */ MONTH = 492, /* MONTH */ SSLV2 = 493, /* SSLV2 */ SSLV3 = 494, /* SSLV3 */ TLSV1 = 495, /* TLSV1 */ TLSV11 = 496, /* TLSV11 */ TLSV12 = 497, /* TLSV12 */ TLSV13 = 498, /* TLSV13 */ CERTMD5 = 499, /* CERTMD5 */ AUTO = 500, /* AUTO */ NOSSLV2 = 501, /* NOSSLV2 */ NOSSLV3 = 502, /* NOSSLV3 */ NOTLSV1 = 503, /* NOTLSV1 */ NOTLSV11 = 504, /* NOTLSV11 */ NOTLSV12 = 505, /* NOTLSV12 */ NOTLSV13 = 506, /* NOTLSV13 */ BYTE = 507, /* BYTE */ KILOBYTE = 508, /* KILOBYTE */ MEGABYTE = 509, /* MEGABYTE */ GIGABYTE = 510, /* GIGABYTE */ INODE = 511, /* INODE */ SPACE = 512, /* SPACE */ TFREE = 513, /* TFREE */ PERMISSION = 514, /* PERMISSION */ SIZE = 515, /* SIZE */ MATCH = 516, /* MATCH */ NOT = 517, /* NOT */ IGNORE = 518, /* IGNORE */ ACTION = 519, /* ACTION */ UPTIME = 520, /* UPTIME */ RESPONSETIME = 521, /* RESPONSETIME */ EXEC = 522, /* EXEC */ UNMONITOR = 523, /* UNMONITOR */ PING = 524, /* PING */ PING4 = 525, /* PING4 */ PING6 = 526, /* PING6 */ ICMP = 527, /* ICMP */ ICMPECHO = 528, /* ICMPECHO */ NONEXIST = 529, /* NONEXIST */ EXIST = 530, /* EXIST */ INVALID = 531, /* INVALID */ DATA = 532, /* DATA */ RECOVERED = 533, /* RECOVERED */ PASSED = 534, /* PASSED */ SUCCEEDED = 535, /* SUCCEEDED */ URL = 536, /* URL */ CONTENT = 537, /* CONTENT */ PID = 538, /* PID */ PPID = 539, /* PPID */ FSFLAG = 540, /* FSFLAG */ REGISTER = 541, /* REGISTER */ CREDENTIALS = 542, /* CREDENTIALS */ URLOBJECT = 543, /* URLOBJECT */ ADDRESSOBJECT = 544, /* ADDRESSOBJECT */ TARGET = 545, /* TARGET */ TIMESPEC = 546, /* TIMESPEC */ HTTPHEADER = 547, /* HTTPHEADER */ MAXFORWARD = 548, /* MAXFORWARD */ FIPS = 549, /* FIPS */ SECURITY = 550, /* SECURITY */ ATTRIBUTE = 551, /* ATTRIBUTE */ FILEDESCRIPTORS = 552, /* FILEDESCRIPTORS */ HARDLINK = 553, /* HARDLINK */ GREATER = 554, /* GREATER */ GREATEROREQUAL = 555, /* GREATEROREQUAL */ LESS = 556, /* LESS */ LESSOREQUAL = 557, /* LESSOREQUAL */ EQUAL = 558, /* EQUAL */ NOTEQUAL = 559 /* NOTEQUAL */ }; typedef enum yytokentype yytoken_kind_t; #endif /* Token kinds. */ #define YYEMPTY -2 #define YYEOF 0 #define YYerror 256 #define YYUNDEF 257 #define IF 258 #define ELSE 259 #define THEN 260 #define FAILED 261 #define SET 262 #define LOGFILE 263 #define FACILITY 264 #define DAEMON 265 #define SYSLOG 266 #define MAILSERVER 267 #define HTTPD 268 #define ALLOW 269 #define REJECTOPT 270 #define ADDRESS 271 #define INIT 272 #define TERMINAL 273 #define BATCH 274 #define READONLY 275 #define CLEARTEXT 276 #define MD5HASH 277 #define SHA1HASH 278 #define CRYPT 279 #define DELAY 280 #define PEMFILE 281 #define PEMKEY 282 #define PEMCHAIN 283 #define ENABLE 284 #define DISABLE 285 #define SSLTOKEN 286 #define CIPHER 287 #define CLIENTPEMFILE 288 #define ALLOWSELFCERTIFICATION 289 #define SELFSIGNED 290 #define VERIFY 291 #define CERTIFICATE 292 #define CACERTIFICATEFILE 293 #define CACERTIFICATEPATH 294 #define VALID 295 #define INTERFACE 296 #define LINK 297 #define PACKET 298 #define BYTEIN 299 #define BYTEOUT 300 #define PACKETIN 301 #define PACKETOUT 302 #define SPEED 303 #define SATURATION 304 #define UPLOAD 305 #define DOWNLOAD 306 #define TOTAL 307 #define UP 308 #define DOWN 309 #define IDFILE 310 #define STATEFILE 311 #define SEND 312 #define EXPECT 313 #define CYCLE 314 #define COUNT 315 #define REMINDER 316 #define REPEAT 317 #define LIMITS 318 #define SENDEXPECTBUFFER 319 #define EXPECTBUFFER 320 #define FILECONTENTBUFFER 321 #define HTTPCONTENTBUFFER 322 #define PROGRAMOUTPUT 323 #define NETWORKTIMEOUT 324 #define PROGRAMTIMEOUT 325 #define STARTTIMEOUT 326 #define STOPTIMEOUT 327 #define RESTARTTIMEOUT 328 #define EXECTIMEOUT 329 #define PIDFILE 330 #define START 331 #define STOP 332 #define PATHTOK 333 #define RSAKEY 334 #define HOST 335 #define HOSTNAME 336 #define PORT 337 #define IPV4 338 #define IPV6 339 #define TYPE 340 #define UDP 341 #define TCP 342 #define TCPSSL 343 #define PROTOCOL 344 #define CONNECTION 345 #define ALERT 346 #define NOALERT 347 #define MAILFORMAT 348 #define UNIXSOCKET 349 #define SIGNATURE 350 #define TIMEOUT 351 #define RETRY 352 #define RESTART 353 #define CHECKSUM 354 #define EVERY 355 #define NOTEVERY 356 #define DEFAULT 357 #define HTTP 358 #define HTTPS 359 #define APACHESTATUS 360 #define FTP 361 #define SMTP 362 #define SMTPS 363 #define POP 364 #define POPS 365 #define IMAP 366 #define IMAPS 367 #define CLAMAV 368 #define NNTP 369 #define NTP3 370 #define MYSQL 371 #define MYSQLS 372 #define DNS 373 #define WEBSOCKET 374 #define MQTT 375 #define SSH 376 #define DWP 377 #define LDAP2 378 #define LDAP3 379 #define RDATE 380 #define RSYNC 381 #define TNS 382 #define PGSQL 383 #define POSTFIXPOLICY 384 #define SIP 385 #define LMTP 386 #define GPS 387 #define RADIUS 388 #define MEMCACHE 389 #define REDIS 390 #define MONGODB 391 #define SIEVE 392 #define SPAMASSASSIN 393 #define FAIL2BAN 394 #define STRING 395 #define PATH 396 #define MAILADDR 397 #define MAILFROM 398 #define MAILREPLYTO 399 #define MAILSUBJECT 400 #define MAILBODY 401 #define SERVICENAME 402 #define STRINGNAME 403 #define HOSTGROUPNAME 404 #define NUMBER 405 #define PERCENT 406 #define LOGLIMIT 407 #define CLOSELIMIT 408 #define DNSLIMIT 409 #define KEEPALIVELIMIT 410 #define REPLYLIMIT 411 #define REQUESTLIMIT 412 #define STARTLIMIT 413 #define WAITLIMIT 414 #define GRACEFULLIMIT 415 #define CLEANUPLIMIT 416 #define REAL 417 #define CHECKPROC 418 #define CHECKFILESYS 419 #define CHECKFILE 420 #define CHECKDIR 421 #define CHECKHOST 422 #define CHECKSYSTEM 423 #define CHECKFIFO 424 #define CHECKPROGRAM 425 #define CHECKNET 426 #define THREADS 427 #define CHILDREN 428 #define METHOD 429 #define GET 430 #define HEAD 431 #define STATUS 432 #define ORIGIN 433 #define VERSIONOPT 434 #define READ 435 #define WRITE 436 #define OPERATION 437 #define SERVICETIME 438 #define DISK 439 #define RESOURCE 440 #define MEMORY 441 #define TOTALMEMORY 442 #define LOADAVG1 443 #define LOADAVG5 444 #define LOADAVG15 445 #define SWAP 446 #define MODE 447 #define ACTIVE 448 #define PASSIVE 449 #define MANUAL 450 #define ONREBOOT 451 #define NOSTART 452 #define LASTSTATE 453 #define CORE 454 #define CPU 455 #define TOTALCPU 456 #define CPUUSER 457 #define CPUSYSTEM 458 #define CPUWAIT 459 #define CPUNICE 460 #define CPUHARDIRQ 461 #define CPUSOFTIRQ 462 #define CPUSTEAL 463 #define CPUGUEST 464 #define CPUGUESTNICE 465 #define GROUP 466 #define REQUEST 467 #define DEPENDS 468 #define BASEDIR 469 #define SLOT 470 #define EVENTQUEUE 471 #define SECRET 472 #define HOSTHEADER 473 #define UID 474 #define EUID 475 #define GID 476 #define MMONIT 477 #define INSTANCE 478 #define USERNAME 479 #define PASSWORD 480 #define DATABASE 481 #define TIME 482 #define ATIME 483 #define CTIME 484 #define MTIME 485 #define CHANGED 486 #define MILLISECOND 487 #define SECOND 488 #define MINUTE 489 #define HOUR 490 #define DAY 491 #define MONTH 492 #define SSLV2 493 #define SSLV3 494 #define TLSV1 495 #define TLSV11 496 #define TLSV12 497 #define TLSV13 498 #define CERTMD5 499 #define AUTO 500 #define NOSSLV2 501 #define NOSSLV3 502 #define NOTLSV1 503 #define NOTLSV11 504 #define NOTLSV12 505 #define NOTLSV13 506 #define BYTE 507 #define KILOBYTE 508 #define MEGABYTE 509 #define GIGABYTE 510 #define INODE 511 #define SPACE 512 #define TFREE 513 #define PERMISSION 514 #define SIZE 515 #define MATCH 516 #define NOT 517 #define IGNORE 518 #define ACTION 519 #define UPTIME 520 #define RESPONSETIME 521 #define EXEC 522 #define UNMONITOR 523 #define PING 524 #define PING4 525 #define PING6 526 #define ICMP 527 #define ICMPECHO 528 #define NONEXIST 529 #define EXIST 530 #define INVALID 531 #define DATA 532 #define RECOVERED 533 #define PASSED 534 #define SUCCEEDED 535 #define URL 536 #define CONTENT 537 #define PID 538 #define PPID 539 #define FSFLAG 540 #define REGISTER 541 #define CREDENTIALS 542 #define URLOBJECT 543 #define ADDRESSOBJECT 544 #define TARGET 545 #define TIMESPEC 546 #define HTTPHEADER 547 #define MAXFORWARD 548 #define FIPS 549 #define SECURITY 550 #define ATTRIBUTE 551 #define FILEDESCRIPTORS 552 #define HARDLINK 553 #define GREATER 554 #define GREATEROREQUAL 555 #define LESS 556 #define LESSOREQUAL 557 #define EQUAL 558 #define NOTEQUAL 559 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 341 "src/p.y" URL_T url; Address_T address; float real; int number; int64_t number64; char *string; #line 684 "src/y.tab.h" }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_SRC_Y_TAB_H_INCLUDED */ monit-5.35.2/src/state.c0000644000016400001720000006526615007061157011744 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #include "monit.h" #include "state.h" // libmonit #include "exceptions/IOException.h" /** * The list of persistent properties: * * 1.) service name + service type * Monit configuration may change, so the state restore needs to ignore * the removed services or services which type doesn't match (the * service name was reused for different check). The current service * runtime is thus paired with the saved service state by name and type. * * 2.) monitoring state * Keep the monitoring enabled or disabled on Monit restart. Useful for * example when Monit is running in active/passive cluster, so the * service monitoring mode doesn't reset when Monit needs to be reloaded * and the service won't enter unwanted passive/passive or active/active * state on multiple hosts. Another example is service which timed out * due to excessive errors or the monitoring was intentionally disabled * by admin for maintenance - do not re-enable monitoring on Monit reload. * * 3.) service restart counters * * 4.) inode number and read position for the file check * Allows to skip the content match test for the content which was checked * already to suppress duplicate events. * * 5.) size, checksum, timestamp, permissions, link speed for the change observation test * * Data is stored in binary form in the statefile using the following format: * {}+ * * When the persistent field needs to be added, update the State_Version along * with State_restore() and State_save(). The version allows to recognize the * service state structure and file format. * * The backward compatibility of monitoring state restore is very important if * Monit runs in cluster => keep previous formats compatibility. * * @file */ /* ------------------------------------------------------------- Definitions */ /* Extended format version */ typedef enum { StateVersion0 = 0, StateVersion1, StateVersion2, StateVersion3, StateVersion4, StateVersionLatest = StateVersion4 } State_Version; /* Extended format version 4 */ typedef struct mystate4 { char name[STRLEN]; uint32_t type; int32_t monitor; int32_t nstart; int32_t ncycle; union { struct { unsigned long long atime; unsigned long long ctime; unsigned long long mtime; int32_t mode; } directory; struct { unsigned long long inode; unsigned long long readpos; unsigned long long size; unsigned long long atime; unsigned long long ctime; unsigned long long mtime; int32_t mode; MD_T hash; } file; struct { unsigned long long atime; unsigned long long ctime; unsigned long long mtime; int32_t mode; } fifo; struct { int32_t mode; } filesystem; struct { int32_t duplex; long long speed; //FIXME: when Link API is moved from libmonit to monit, save also link bytes in/out and packets in/out history, so the network statistics is not reset on each monit reload } net; } priv; } State4_T; /* Extended format version 3 */ typedef struct mystate3 { char name[STRLEN]; uint32_t type; int32_t monitor; int32_t nstart; int32_t ncycle; union { struct { unsigned long long timestamp; int32_t mode; } directory; struct { unsigned long long inode; unsigned long long readpos; unsigned long long size; unsigned long long timestamp; int32_t mode; MD_T hash; } file; struct { unsigned long long timestamp; int32_t mode; } fifo; struct { int32_t mode; int32_t flags; // Obsolete since Monit 5.21.0 } filesystem; struct { int32_t duplex; long long speed; } net; } priv; } State3_T; /* Extended format version 2 (in V3 only a system boot time was added to state header, otherwise the V2 service state is identical to V3) */ typedef struct mystate3 State2_T; /* Extended format version 1 */ typedef struct mystate1 { char name[STRLEN]; uint32_t type; int32_t monitor; int32_t nstart; int32_t ncycle; union { struct { unsigned long long inode; unsigned long long readpos; } file; } priv; } State1_T; /* Format version 0 (Monit <= 5.3) */ typedef struct mystate0 { char name[STRLEN]; int32_t mode; // obsolete since Monit 5.1 int32_t nstart; int32_t ncycle; int32_t monitor; unsigned long long error; // obsolete since Monit 5.0 } State0_T; static int file = -1; static unsigned long long booted = 0ULL; static bool _stateDirty = false; /* ----------------------------------------------------------------- Private */ static void _updateStart(Service_T S, int nstart, int ncycle) { S->nstart = nstart; S->ncycle = ncycle; } static void _updateMonitor(Service_T S, Monitor_State monitor) { if (! State_reboot() || S->onreboot == Onreboot_Laststate) { // Monit reload or restart within the same boot session OR persistent state => restore the monitoring state if (monitor == Monitor_Not) S->monitor = Monitor_Not; else if (S->monitor == Monitor_Not) S->monitor = Monitor_Init; } else { // System rebooted if (S->onreboot == Onreboot_Nostart) S->monitor = Monitor_Not; else S->monitor = Monitor_Init; } S->onrebootRestored = true; } static void _updateFilePosition(Service_T S, unsigned long long inode, unsigned long long readpos) { S->inf.file->inode = (ino_t)inode; S->inf.file->readpos = (off_t)readpos; } static void _updateTimestamp(Service_T S, unsigned long long atime, unsigned long long ctime, unsigned long long mtime) { for (Timestamp_T t = S->timestamplist; t; t = t->next) { if (t->test_changes) { switch (t->type) { case Timestamp_Access: t->lastTimestamp = (time_t)atime; break; case Timestamp_Change: t->lastTimestamp = (time_t)ctime; break; case Timestamp_Modification: t->lastTimestamp = (time_t)mtime; break; default: t->lastTimestamp = (time_t)MAX(ctime, mtime); break; } t->initialized = true; } } } static void _updatePermission(Service_T S, int mode) { if (S->perm && S->perm->test_changes) S->perm->perm = mode & 07777; } static void _updateSize(Service_T S, long long size) { for (Size_T s = S->sizelist; s; s = s->next) { if (s->test_changes) { s->size = size; s->initialized = true; } } } static void _updateChecksum(Service_T S, char *hash) { if (S->checksum && S->checksum->test_changes) { S->checksum->initialized = false; strncpy(S->checksum->hash, hash, sizeof(S->checksum->hash) - 1); } } static void _updateLinkSpeed(Service_T S, int32_t duplex, long long speed) { for (LinkSpeed_T l = S->linkspeedlist; l; l = l->next) { l->duplex = duplex; l->speed = speed; } } static void _restoreV4(void) { // System header if (read(file, &booted, sizeof(booted)) != sizeof(booted)) { THROW(IOException, "Unable to read system boot time"); } // Services state State4_T state; while (read(file, &state, sizeof(state)) == sizeof(state)) { Service_T service = Util_getService(state.name); if (service && service->type == state.type) { _updateStart(service, state.nstart, state.ncycle); _updateMonitor(service, state.monitor); switch (service->type) { case Service_Directory: _updatePermission(service, state.priv.directory.mode); _updateTimestamp(service, state.priv.directory.atime, state.priv.directory.ctime, state.priv.directory.mtime); break; case Service_Fifo: _updatePermission(service, state.priv.fifo.mode); _updateTimestamp(service, state.priv.fifo.atime, state.priv.fifo.ctime, state.priv.fifo.mtime); break; case Service_File: _updatePermission(service, state.priv.file.mode); _updateTimestamp(service, state.priv.file.atime, state.priv.file.ctime, state.priv.file.mtime); _updateFilePosition(service, state.priv.file.inode, state.priv.file.readpos); _updateSize(service, state.priv.file.size); _updateChecksum(service, state.priv.file.hash); break; case Service_Filesystem: _updatePermission(service, state.priv.filesystem.mode); break; case Service_Net: _updateLinkSpeed(service, state.priv.net.duplex, state.priv.net.speed); break; default: break; } } } } static void _restoreV3(void) { // System header if (read(file, &booted, sizeof(booted)) != sizeof(booted)) { THROW(IOException, "Unable to read system boot time"); } // Services state State3_T state; while (read(file, &state, sizeof(state)) == sizeof(state)) { Service_T service = Util_getService(state.name); if (service && service->type == state.type) { _updateStart(service, state.nstart, state.ncycle); _updateMonitor(service, state.monitor); switch (service->type) { case Service_Directory: _updatePermission(service, state.priv.directory.mode); break; case Service_Fifo: _updatePermission(service, state.priv.fifo.mode); break; case Service_File: _updatePermission(service, state.priv.file.mode); _updateFilePosition(service, state.priv.file.inode, state.priv.file.readpos); _updateSize(service, state.priv.file.size); _updateChecksum(service, state.priv.file.hash); break; case Service_Filesystem: _updatePermission(service, state.priv.filesystem.mode); break; case Service_Net: _updateLinkSpeed(service, state.priv.net.duplex, state.priv.net.speed); break; default: break; } } } } static void _restoreV2(void) { // System header booted = System_Info.booted; // No boot time available => for backward compatibility, act as if the system was not rebooted, as we don't know if monit was only restarted or machine rebooted // Services state State2_T state; while (read(file, &state, sizeof(state)) == sizeof(state)) { Service_T service = Util_getService(state.name); if (service && service->type == state.type) { _updateStart(service, state.nstart, state.ncycle); _updateMonitor(service, state.monitor); switch (service->type) { case Service_Directory: _updatePermission(service, state.priv.directory.mode); break; case Service_Fifo: _updatePermission(service, state.priv.fifo.mode); break; case Service_File: _updatePermission(service, state.priv.file.mode); _updateFilePosition(service, state.priv.file.inode, state.priv.file.readpos); _updateSize(service, state.priv.file.size); _updateChecksum(service, state.priv.file.hash); break; case Service_Filesystem: _updatePermission(service, state.priv.filesystem.mode); break; case Service_Net: _updateLinkSpeed(service, state.priv.net.duplex, state.priv.net.speed); break; default: break; } } } } static void _restoreV1(void) { // System header booted = System_Info.booted; // No boot time available => for backward compatibility, act as if the system was not rebooted, as we don't know if monit was only restarted or machine rebooted // Services state State1_T state; while (read(file, &state, sizeof(state)) == sizeof(state)) { Service_T service = Util_getService(state.name); if (service && service->type == state.type) { _updateStart(service, state.nstart, state.ncycle); _updateMonitor(service, state.monitor); if (service->type == Service_File) _updateFilePosition(service, state.priv.file.inode, state.priv.file.readpos); } } } static void _restoreV0(int services) { // System header booted = System_Info.booted; // No boot time available => for backward compatibility, act as if the system was not rebooted, as we don't know if monit was only restarted or machine rebooted // Services state for (int i = 0; i < services; i++) { State0_T state; if (read(file, &state, sizeof(state)) != sizeof(state)) THROW(IOException, "Unable to read service state"); Service_T service = Util_getService(state.name); if (service) { _updateStart(service, state.nstart, state.ncycle); _updateMonitor(service, state.monitor); } } } /* ------------------------------------------------------------------ Public */ bool State_open(void) { State_close(); if ((file = open(Run.files.state, O_RDWR | O_CREAT, 0600)) == -1) { Log_error("State file '%s': cannot open for write -- %s\n", Run.files.state, STRERROR); return false; } atexit(State_close); return true; } void State_close(void) { if (file != -1) { if (close(file) == -1) Log_error("State file '%s': close error -- %s\n", Run.files.state, STRERROR); else file = -1; } } void State_save(void) { TRY { if (ftruncate(file, 0L) == -1) { THROW(IOException, "Unable to truncate"); } if (lseek(file, 0L, SEEK_SET) == -1) { THROW(IOException, "Unable to seek"); } int32_t magic = 0; if (write(file, &magic, sizeof(magic)) != sizeof(magic)) { THROW(IOException, "Unable to write magic"); } // Save always using the latest format version int32_t version = StateVersion4; if (write(file, &version, sizeof(version)) != sizeof(version)) { THROW(IOException, "Unable to write format version"); } if (write(file, &System_Info.booted, sizeof(System_Info.booted)) != sizeof(System_Info.booted)) { THROW(IOException, "Unable to write system boot time"); } for (Service_T service = Service_List; service; service = service->next) { State4_T state; memset(&state, 0, sizeof(state)); snprintf(state.name, sizeof(state.name), "%s", service->name); state.type = service->type; state.monitor = service->monitor & ~Monitor_Waiting; state.nstart = service->nstart; state.ncycle = service->ncycle; switch (service->type) { case Service_Directory: state.priv.directory.atime = (unsigned long long)service->inf.directory->timestamp.access; state.priv.directory.ctime = (unsigned long long)service->inf.directory->timestamp.change; state.priv.directory.mtime = (unsigned long long)service->inf.directory->timestamp.modify; state.priv.directory.mode = service->inf.directory->mode; break; case Service_Fifo: state.priv.fifo.atime = (unsigned long long)service->inf.fifo->timestamp.access; state.priv.fifo.ctime = (unsigned long long)service->inf.fifo->timestamp.change; state.priv.fifo.mtime = (unsigned long long)service->inf.fifo->timestamp.modify; state.priv.fifo.mode = service->inf.fifo->mode; break; case Service_File: state.priv.file.inode = service->inf.file->inode; state.priv.file.readpos = service->inf.file->readpos; state.priv.file.size = (long long)service->inf.file->size; state.priv.file.atime = (unsigned long long)service->inf.file->timestamp.access; state.priv.file.ctime = (unsigned long long)service->inf.file->timestamp.change; state.priv.file.mtime = (unsigned long long)service->inf.file->timestamp.modify; state.priv.file.mode = service->inf.file->mode; snprintf(state.priv.file.hash, sizeof(state.priv.file.hash), "%s", service->inf.file->cs_sum); break; case Service_Filesystem: state.priv.filesystem.mode = service->inf.filesystem->mode; break; case Service_Net: if (service->linkspeedlist) { state.priv.net.duplex = service->linkspeedlist->duplex; state.priv.net.speed = service->linkspeedlist->speed; } break; default: break; } if (write(file, &state, sizeof(state)) != sizeof(state)) { THROW(IOException, "Unable to write service state"); } } if (fsync(file)) { THROW(IOException, "Unable to sync -- %s", STRERROR); } _stateDirty = false; } ELSE { Log_error("State file '%s': %s\n", Run.files.state, Exception_frame.message); } END_TRY; } void State_dirty(void) { _stateDirty = true; } void State_saveIfDirty(void) { if (_stateDirty) { State_save(); } } void State_restore(void) { /* Ignore empty state file */ if ((lseek(file, 0L, SEEK_END) == 0)) { return; } TRY { if (lseek(file, 0L, SEEK_SET) == -1) { THROW(IOException, "Unable to seek"); } int32_t magic; if (read(file, &magic, sizeof(magic)) != sizeof(magic)) { THROW(IOException, "Unable to read magic"); } if (magic > 0) { // The statefile format of Monit <= 5.3, the magic is number of services, followed by State0_T structures _restoreV0(magic); } else { // The extended statefile format (Monit >= 5.4) int32_t version; if (read(file, &version, sizeof(version)) != sizeof(version)) { THROW(IOException, "Unable to read version"); } switch (version) { case StateVersion1: _restoreV1(); break; case StateVersion2: _restoreV2(); break; case StateVersion3: _restoreV3(); break; case StateVersion4: _restoreV4(); break; default: Log_warning("State file '%s': incompatible version %d\n", Run.files.state, version); break; } if (version != StateVersionLatest || State_reboot()) { _stateDirty = true; } } } ELSE { Log_error("State file '%s': %s\n", Run.files.state, Exception_frame.message); } END_TRY; // If the service state was not restored (e.g. new service or state file is missing), handle the onreboot flag for (Service_T s = Service_List; s; s = s->next) { if (! s->onrebootRestored) { if (s->onreboot == Onreboot_Nostart) s->monitor = Monitor_Not; s->onrebootRestored = true; } } } bool State_reboot(void) { return System_Info.booted == booted ? false : true; } monit-5.35.2/src/gc.c0000644000016400001720000005302715007061157011205 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif // libmonit #include "util/List.h" #include "monit.h" #include "protocol.h" #include "ProcessTree.h" #include "engine.h" /* Private prototypes */ static void _gc_service_list(Service_T *); static void _gc_service(Service_T *); static void _gc_servicegroup(ServiceGroup_T *); static void _gc_mail_server(MailServer_T *); static void _gcportlist(Port_T *); static void _gcfilesystem(FileSystem_T *); static void _gcicmp(Icmp_T *); static void _gcpql(Resource_T *); static void _gcptl(Timestamp_T *); static void _gcuptimelist(Uptime_T *); static void _gcparl(ActionRate_T *); static void _gc_action(Action_T *); static void _gc_eventaction(EventAction_T *); static void _gcpdl(Dependant_T *); static void _gcso(Size_T *); static void _gcnlink(NLink_T *); static void _gclinkstatus(LinkStatus_T *); static void _gclinkspeed(LinkSpeed_T *); static void _gclinksaturation(LinkSaturation_T *); static void _gcbandwidth(Bandwidth_T *); static void _gcmatch(Match_T *); static void _gcoutputchange(OutputChange_T *); static void _gcchecksum(Checksum_T *); static void _gcperm(Perm_T *); static void _gcstatus(Status_T *); static void _gcuid(Uid_T *); static void _gcgid(Gid_T *); static void _gcpid(Pid_T *); static void _gcppid(Pid_T *); static void _gcfsflag(FsFlag_T *); static void _gcnonexist(NonExist_T *); static void _gcexist(Exist_T *); static void _gcgeneric(Generic_T *); static void _gcath(Auth_T *); static void _gc_mmonit(Mmonit_T *); static void _gc_url(URL_T *); static void _gc_request(Request_T *); static void _gcssloptions(SslOptions_T o); static void _gcsecattr(SecurityAttribute_T *); static void _gcfiledescriptors(Filedescriptors_T *); /** * Release allocated memory. * * @file */ /* ------------------------------------------------------------------ Public */ void gc(void) { Engine_destroyAllow(); if (Run.flags & Run_ProcessEngineEnabled) ProcessTree_delete(); if (Service_List) _gc_service_list(&Service_List); if (Service_Group_List) _gc_servicegroup(&Service_Group_List); if (Run.httpd.credentials) _gcath(&Run.httpd.credentials); if (Run.maillist) gc_mail_list(&Run.maillist); if (Run.mailservers) _gc_mail_server(&Run.mailservers); if (Run.mmonits) _gc_mmonit(&Run.mmonits); FREE(Run.eventlist_dir); FREE(Run.mygroup); if (Run.httpd.flags & Httpd_Net) { FREE(Run.httpd.socket.net.address); _gcssloptions(&(Run.httpd.socket.net.ssl)); } if (Run.httpd.flags & Httpd_Unix) FREE(Run.httpd.socket.unix.path); if (Run.MailFormat.from) Address_free(&(Run.MailFormat.from)); if (Run.MailFormat.replyto) Address_free(&(Run.MailFormat.replyto)); FREE(Run.MailFormat.subject); FREE(Run.MailFormat.message); FREE(Run.mail_hostname); } void gc_mail_list(Mail_T *m) { assert(m); if ((*m)->next) gc_mail_list(&(*m)->next); if ((*m)->from) Address_free(&((*m)->from)); if ((*m)->replyto) Address_free(&((*m)->replyto)); FREE((*m)->to); FREE((*m)->subject); FREE((*m)->message); FREE(*m); } void gccmd(command_t *c) { assert(c && *c); for (int i = 0; (*c)->arg[i]; i++) FREE((*c)->arg[i]); FREE(*c); } void gc_event(Event_T *e) { assert(e && *e); if ((*e)->next) gc_event(&(*e)->next); (*e)->action = NULL; FREE((*e)->message); FREE(*e); } static void _gc_hostgroups(List_T *hostgroups) { if (*hostgroups) { char *hostgroup = NULL; while ((hostgroup = List_pop(*hostgroups))) { FREE(hostgroup); } List_free(hostgroups); } } /* ----------------------------------------------------------------- Private */ static void _gcssloptions(SslOptions_T o) { FREE(o->checksum); FREE(o->pemfile); FREE(o->pemchain); FREE(o->pemkey); FREE(o->clientpemfile); FREE(o->ciphers); FREE(o->CACertificateFile); FREE(o->CACertificatePath); } static void _gc_service_list(Service_T *s) { assert(s&&*s); if ((*s)->next) _gc_service_list(&(*s)->next); _gc_service(&(*s)); } static void _gc_service(Service_T *s) { assert(s&&*s); if ((*s)->program) { if ((*s)->program->P) Process_free(&(*s)->program->P); if ((*s)->program->C) Command_free(&(*s)->program->C); if ((*s)->program->args) gccmd(&(*s)->program->args); StringBuffer_free(&((*s)->program->lastOutput)); StringBuffer_free(&((*s)->program->inprogressOutput)); FREE((*s)->program); } if ((*s)->portlist) _gcportlist(&(*s)->portlist); if ((*s)->socketlist) _gcportlist(&(*s)->socketlist); if ((*s)->filesystemlist) _gcfilesystem(&(*s)->filesystemlist); if ((*s)->icmplist) _gcicmp(&(*s)->icmplist); if ((*s)->maillist) gc_mail_list(&(*s)->maillist); if ((*s)->resourcelist) _gcpql(&(*s)->resourcelist); if ((*s)->timestamplist) _gcptl(&(*s)->timestamplist); if ((*s)->uptimelist) _gcuptimelist(&(*s)->uptimelist); if ((*s)->actionratelist) _gcparl(&(*s)->actionratelist); if ((*s)->sizelist) _gcso(&(*s)->sizelist); if ((*s)->nlinklist) _gcnlink(&(*s)->nlinklist); if ((*s)->linkstatuslist) _gclinkstatus(&(*s)->linkstatuslist); if ((*s)->linkspeedlist) _gclinkspeed(&(*s)->linkspeedlist); if ((*s)->linksaturationlist) _gclinksaturation(&(*s)->linksaturationlist); if ((*s)->uploadbyteslist) _gcbandwidth(&(*s)->uploadbyteslist); if ((*s)->uploadpacketslist) _gcbandwidth(&(*s)->uploadpacketslist); if ((*s)->downloadbyteslist) _gcbandwidth(&(*s)->downloadbyteslist); if ((*s)->downloadpacketslist) _gcbandwidth(&(*s)->downloadpacketslist); if ((*s)->matchlist) _gcmatch(&(*s)->matchlist); if ((*s)->matchignorelist) _gcmatch(&(*s)->matchignorelist); if ((*s)->outputchangelist) _gcoutputchange(&(*s)->outputchangelist); if ((*s)->checksum) _gcchecksum(&(*s)->checksum); if ((*s)->perm) _gcperm(&(*s)->perm); if ((*s)->statuslist) _gcstatus(&(*s)->statuslist); if ((*s)->every.type == Every_Cron || (*s)->every.type == Every_NotInCron) FREE((*s)->every.spec.cron); if ((*s)->uid) _gcuid(&(*s)->uid); if ((*s)->euid) _gcuid(&(*s)->euid); if ((*s)->gid) _gcgid(&(*s)->gid); if ((*s)->pidlist) _gcpid(&(*s)->pidlist); if ((*s)->ppidlist) _gcppid(&(*s)->ppidlist); if ((*s)->fsflaglist) _gcfsflag(&(*s)->fsflaglist); if ((*s)->nonexistlist) _gcnonexist(&(*s)->nonexistlist); if ((*s)->existlist) _gcexist(&(*s)->existlist); if ((*s)->dependantlist) _gcpdl(&(*s)->dependantlist); if ((*s)->start) gccmd(&(*s)->start); if ((*s)->stop) gccmd(&(*s)->stop); if ((*s)->restart) gccmd(&(*s)->restart); if ((*s)->action_DATA) _gc_eventaction(&(*s)->action_DATA); if ((*s)->action_EXEC) _gc_eventaction(&(*s)->action_EXEC); if ((*s)->action_INVALID) _gc_eventaction(&(*s)->action_INVALID); if ((*s)->action_MONIT_START) _gc_eventaction(&(*s)->action_MONIT_START); if ((*s)->action_MONIT_STOP) _gc_eventaction(&(*s)->action_MONIT_STOP); if ((*s)->action_ACTION) _gc_eventaction(&(*s)->action_ACTION); if ((*s)->eventlist) gc_event(&(*s)->eventlist); if ((*s)->secattrlist) _gcsecattr(&(*s)->secattrlist); if ((*s)->filedescriptorslist) _gcfiledescriptors(&(*s)->filedescriptorslist); switch ((*s)->type) { case Service_Directory: FREE((*s)->inf.directory); break; case Service_Fifo: FREE((*s)->inf.fifo); break; case Service_File: FREE((*s)->inf.file); break; case Service_Filesystem: FREE((*s)->inf.filesystem); break; case Service_Net: Link_free(&((*s)->inf.net->stats)); FREE((*s)->inf.net); break; case Service_Process: FREE((*s)->inf.process); break; default: break; } StringBuffer_free(&((*s)->name_htmlescaped)); FREE((*s)->name_urlescaped); FREE((*s)->name); FREE((*s)->path); (*s)->next = NULL; FREE(*s); } static void _gc_servicegroup(ServiceGroup_T *sg) { assert(sg && *sg); if ((*sg)->next) _gc_servicegroup(&(*sg)->next); List_free(&(*sg)->members); FREE((*sg)->name); FREE(*sg); } static void _gc_request(Request_T *r) { assert(r); if ((*r)->url) _gc_url(&(*r)->url); if ((*r)->regex) regfree((*r)->regex); FREE((*r)->regex); FREE(*r); } static void _gc_url(URL_T *url) { assert(url); FREE((*url)->url); FREE((*url)->protocol); FREE((*url)->user); FREE((*url)->password); FREE((*url)->hostname); FREE((*url)->path); FREE((*url)->query); FREE(*url); } static void _gc_mail_server(MailServer_T *s) { if (! s || ! *s) return; if ((*s)->next) _gc_mail_server(&(*s)->next); _gcssloptions(&((*s)->ssl)); FREE((*s)->host); FREE((*s)->username); FREE((*s)->password); FREE(*s); } static void _gc_action(Action_T *a) { assert(a&&*a); if ((*a)->exec) gccmd(&(*a)->exec); FREE(*a); } static void _gc_eventaction(EventAction_T *e) { assert(e&&*e); _gc_action(&(*e)->failed); _gc_action(&(*e)->succeeded); FREE(*e); } static void _gcportlist(Port_T *p) { assert(p&&*p); if ((*p)->next) _gcportlist(&(*p)->next); if ((*p)->action) _gc_eventaction(&(*p)->action); if ((*p)->url_request) _gc_request(&(*p)->url_request); if ((*p)->family == Socket_Unix) FREE((*p)->target.unix.pathname); else _gcssloptions(&((*p)->target.net.ssl.options)); FREE((*p)->hostname); FREE((*p)->outgoing.ip); if ((*p)->protocol->check == check_http) { FREE((*p)->parameters.http.username); FREE((*p)->parameters.http.password); FREE((*p)->parameters.http.request); FREE((*p)->parameters.http.checksum); if ((*p)->parameters.http.headers) { List_T l = (*p)->parameters.http.headers; while (List_length(l) > 0) { char *s = List_pop(l); FREE(s); } List_free(&(*p)->parameters.http.headers); } } else if ((*p)->protocol->check == check_generic) { if ((*p)->parameters.generic.sendexpect) _gcgeneric(&(*p)->parameters.generic.sendexpect); } else if ((*p)->protocol->check == check_mqtt) { FREE((*p)->parameters.mqtt.username); FREE((*p)->parameters.mqtt.password); } else if ((*p)->protocol->check == check_mysql) { FREE((*p)->parameters.mysql.username); FREE((*p)->parameters.mysql.password); FREE((*p)->parameters.mysql.rsaChecksum); } else if ((*p)->protocol->check == check_pgsql) { FREE((*p)->parameters.postgresql.username); FREE((*p)->parameters.postgresql.password); FREE((*p)->parameters.postgresql.database); } else if ((*p)->protocol->check == check_sip) { FREE((*p)->parameters.sip.target); } else if ((*p)->protocol->check == check_smtp) { FREE((*p)->parameters.smtp.username); FREE((*p)->parameters.smtp.password); } else if ((*p)->protocol->check == check_radius) { FREE((*p)->parameters.radius.secret); } else if ((*p)->protocol->check == check_websocket) { FREE((*p)->parameters.websocket.host); FREE((*p)->parameters.websocket.origin); FREE((*p)->parameters.websocket.request); } else if ((*p)->protocol->check == check_apache_status) { FREE((*p)->parameters.apachestatus.path); FREE((*p)->parameters.apachestatus.username); FREE((*p)->parameters.apachestatus.password); } FREE(*p); } static void _gcfilesystem(FileSystem_T *d) { assert(d&&*d); if ((*d)->next) _gcfilesystem(&(*d)->next); if ((*d)->action) _gc_eventaction(&(*d)->action); FREE(*d); } static void _gcicmp(Icmp_T *i) { assert(i&&*i); if ((*i)->next) _gcicmp(&(*i)->next); FREE((*i)->outgoing.ip); if ((*i)->action) _gc_eventaction(&(*i)->action); FREE(*i); } static void _gcpql(Resource_T *q) { assert(q); if ((*q)->next) _gcpql(&(*q)->next); if ((*q)->action) _gc_eventaction(&(*q)->action); FREE(*q); } static void _gcptl(Timestamp_T *p) { assert(p); if ((*p)->next) _gcptl(&(*p)->next); if ((*p)->action) _gc_eventaction(&(*p)->action); FREE(*p); } static void _gcuptimelist(Uptime_T *u) { assert(u); if ((*u)->next) _gcuptimelist(&(*u)->next); if ((*u)->action) _gc_eventaction(&(*u)->action); FREE(*u); } static void _gcparl(ActionRate_T *ar) { assert(ar); if ((*ar)->next) _gcparl(&(*ar)->next); if ((*ar)->action) _gc_eventaction(&(*ar)->action); FREE(*ar); } static void _gcso(Size_T *s) { assert(s); if ((*s)->next) _gcso(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcnlink(NLink_T *s) { assert(s); if ((*s)->next) _gcnlink(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gclinkstatus(LinkStatus_T *l) { assert(l); if ((*l)->next) _gclinkstatus(&(*l)->next); if ((*l)->action) _gc_eventaction(&(*l)->action); FREE(*l); } static void _gclinkspeed(LinkSpeed_T *l) { assert(l); if ((*l)->next) _gclinkspeed(&(*l)->next); if ((*l)->action) _gc_eventaction(&(*l)->action); FREE(*l); } static void _gclinksaturation(LinkSaturation_T *l) { assert(l); if ((*l)->next) _gclinksaturation(&(*l)->next); if ((*l)->action) _gc_eventaction(&(*l)->action); FREE(*l); } static void _gcbandwidth(Bandwidth_T *b) { assert(b); if ((*b)->next) _gcbandwidth(&(*b)->next); if ((*b)->action) _gc_eventaction(&(*b)->action); FREE(*b); } static void _gcmatch(Match_T *s) { assert(s); if ((*s)->next) _gcmatch(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE((*s)->match_path); FREE((*s)->match_string); if ((*s)->regex_comp) { regfree((*s)->regex_comp); FREE((*s)->regex_comp); } FREE(*s); } static void _gcoutputchange(OutputChange_T *s) { assert(s); if ((*s)->next) _gcoutputchange(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE((*s)->previous); FREE(*s); } static void _gcchecksum(Checksum_T *s) { assert(s); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcperm(Perm_T *s) { assert(s); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcstatus(Status_T *s) { assert(s); if ((*s)->next) _gcstatus(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcuid(Uid_T *s) { assert(s); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcgid(Gid_T *s) { assert(s); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcpid(Pid_T *s) { assert(s); if ((*s)->next) _gcpid(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcppid(Pid_T *s) { assert(s); if ((*s)->next) _gcppid(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcfsflag(FsFlag_T *s) { assert(s); if ((*s)->next) _gcfsflag(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcnonexist(NonExist_T *s) { assert(s); if ((*s)->next) _gcnonexist(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcexist(Exist_T *s) { assert(s); if ((*s)->next) _gcexist(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE(*s); } static void _gcpdl(Dependant_T *d) { assert(d); if ((*d)->next) _gcpdl(&(*d)->next); StringBuffer_free(&((*d)->dependant_htmlescaped)); FREE((*d)->dependant_urlescaped); FREE((*d)->dependant); FREE(*d); } static void _gcgeneric(Generic_T *g) { assert(g); if ((*g)->next) _gcgeneric(&(*g)->next); FREE((*g)->send); if ((*g)->expect != NULL) regfree((*g)->expect); FREE((*g)->expect); FREE(*g); } static void _gcath(Auth_T *c) { assert(c); if ((*c)->next) _gcath(&(*c)->next); FREE((*c)->uname); FREE((*c)->passwd); FREE((*c)->groupname); FREE(*c); } static void _gc_mmonit(Mmonit_T *mmonit) { assert(mmonit); if ((*mmonit)->next) _gc_mmonit(&(*mmonit)->next); _gc_url(&(*mmonit)->url); _gcssloptions(&((*mmonit)->ssl)); _gc_hostgroups(&((*mmonit)->hostgroups)); FREE(*mmonit); } static void _gcsecattr(SecurityAttribute_T *s) { assert(s && *s); if ((*s)->next) _gcsecattr(&(*s)->next); if ((*s)->action) _gc_eventaction(&(*s)->action); FREE((*s)->attribute); FREE(*s); } static void _gcfiledescriptors(Filedescriptors_T *o) { assert(o && *o); if ((*o)->next) _gcfiledescriptors(&(*o)->next); if ((*o)->action) _gc_eventaction(&(*o)->action); FREE(*o); } monit-5.35.2/src/checksum.c0000644000016400001720000002553615007061157012422 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_SYS_TYPES_H #include #endif #include "monit.h" #include "md5.h" #include "sha1.h" #include "checksum.h" // libmonit #include "exceptions/AssertException.h" #include "io/File.h" #define T ChecksumContext_T /* ------------------------------------------------------------------ Public */ void Checksum_init(T context, Hash_Type type) { assert(context); switch (type) { case Hash_Md5: md5_init(&(context->data.md5)); break; case Hash_Sha1: sha1_init(&(context->data.sha1)); break; default: THROW(AssertException, "Checksum error: Unknown hash type"); break; } context->type = type; context->finished = false; } unsigned char *Checksum_finish(T context) { assert(context); if (! context->finished) { switch (context->type) { case Hash_Md5: md5_finish(&(context->data.md5), (md5_byte_t *)context->hash); break; case Hash_Sha1: sha1_finish(&(context->data.sha1), (unsigned char *)context->hash); break; default: THROW(AssertException, "Checksum error: Unknown hash type"); break; } context->finished = true; } return (unsigned char *)(context->hash); } void Checksum_append(T context, const char *input, int inputLength) { assert(context); assert(input); assert(inputLength >= 0); assert(context->finished == false); switch (context->type) { case Hash_Md5: md5_append(&(context->data.md5), (const md5_byte_t *)input, inputLength); break; case Hash_Sha1: sha1_append(&(context->data.sha1), (const unsigned char *)input, inputLength); break; default: THROW(AssertException, "Checksum error: Unknown hash type"); break; } } void Checksum_verify(T context, const char *checksum) { assert(context); assert(checksum); // Compare with string int keyLength = 0; // Raw key bytes, not string chars switch (context->type) { case Hash_Md5: keyLength = 16; break; case Hash_Sha1: keyLength = 20; break; default: THROW(AssertException, "Checksum error: Unknown hash type"); break; } MD_T hashString = {}; if (strncasecmp(Checksum_digest2Bytes(Checksum_finish(context), keyLength, hashString), checksum, keyLength * 2) != 0) THROW(AssertException, "Checksum error: %s mismatch (expected %s got %s)", Checksum_Names[context->type], checksum, hashString); } char *Checksum_digest2Bytes(unsigned char *digest, int mdlen, MD_T result) { int i; unsigned char *tmp = (unsigned char*)result; static unsigned char hex[] = "0123456789abcdef"; assert(mdlen * 2 < MD_SIZE); // Overflow guard for (i = 0; i < mdlen; i++) { *tmp++ = hex[digest[i] >> 4]; *tmp++ = hex[digest[i] & 0xf]; } *tmp = '\0'; return result; } bool Checksum_getStreamDigests(FILE *stream, void *sha1_resblock, void *md5_resblock) { #define HASHBLOCKSIZE 4096 md5_context_t ctx_md5; sha1_context_t ctx_sha1; unsigned char buffer[HASHBLOCKSIZE + 72]; size_t sum; /* Initialize the computation contexts */ if (md5_resblock) md5_init(&ctx_md5); if (sha1_resblock) sha1_init(&ctx_sha1); /* Iterate over full file contents */ while (1) { /* We read the file in blocks of HASHBLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read */ size_t n; sum = 0; /* Read block. Take care for partial reads */ while (1) { n = fread(buffer + sum, 1, HASHBLOCKSIZE - sum, stream); sum += n; if (sum == HASHBLOCKSIZE) break; if (n == 0) { /* Check for the error flag IFF N == 0, so that we don't exit the loop after a partial read due to e.g., EAGAIN or EWOULDBLOCK */ if (ferror(stream)) return false; goto process_partial_block; } /* We've read at least one byte, so ignore errors. But always check for EOF, since feof may be true even though N > 0. Otherwise, we could end up calling fread after EOF */ if (feof(stream)) goto process_partial_block; } /* Process buffer with HASHBLOCKSIZE bytes. Note that HASHBLOCKSIZE % 64 == 0 */ if (md5_resblock) md5_append(&ctx_md5, (const md5_byte_t *)buffer, HASHBLOCKSIZE); if (sha1_resblock) sha1_append(&ctx_sha1, buffer, HASHBLOCKSIZE); } process_partial_block: /* Process any remaining bytes */ if (sum > 0) { if (md5_resblock) md5_append(&ctx_md5, (const md5_byte_t *)buffer, (int)sum); if (sha1_resblock) sha1_append(&ctx_sha1, buffer, sum); } /* Construct result in desired memory */ if (md5_resblock) md5_finish(&ctx_md5, md5_resblock); if (sha1_resblock) sha1_finish(&ctx_sha1, sha1_resblock); return true; } void Checksum_printHash(char *file) { MD_T hash; unsigned char sha1[STRLEN], md5[STRLEN]; FILE *fhandle = NULL; if (! (fhandle = file ? fopen(file, "r") : stdin) || ! Checksum_getStreamDigests(fhandle, sha1, md5) || (file && fclose(fhandle))) { printf("%s: %s\n", file, STRERROR); exit(1); } printf("SHA1(%s) = %s\n", file ? file : "stdin", Checksum_digest2Bytes(sha1, 20, hash)); printf("MD5(%s) = %s\n", file ? file : "stdin", Checksum_digest2Bytes(md5, 16, hash)); } bool Checksum_getChecksum(char *file, Hash_Type hashtype, char *buf, unsigned long bufsize) { int hashlength = 16; assert(file); assert(buf); assert(bufsize >= sizeof(MD_T)); switch (hashtype) { case Hash_Md5: hashlength = 16; break; case Hash_Sha1: hashlength = 20; break; default: Log_error("checksum: invalid hash type: 0x%x\n", hashtype); return false; } if (File_isFile(file)) { FILE *f = fopen(file, "r"); if (f) { bool fresult = false; MD_T sum; switch (hashtype) { case Hash_Md5: fresult = Checksum_getStreamDigests(f, NULL, sum); break; case Hash_Sha1: fresult = Checksum_getStreamDigests(f, sum, NULL); break; default: break; } if (fclose(f)) Log_error("checksum: error closing file '%s' -- %s\n", file, STRERROR); if (! fresult) { Log_error("checksum: file %s stream error (0x%x)\n", file, fresult); return false; } Checksum_digest2Bytes((unsigned char *)sum, hashlength, buf); return true; } else Log_error("checksum: failed to open file %s -- %s\n", file, STRERROR); } else Log_error("checksum: file %s is not regular file\n", file); return false; } void Checksum_hmacMD5(const unsigned char *data, int datalen, const unsigned char *key, int keylen, unsigned char *digest) { md5_context_t ctx; md5_init(&ctx); unsigned char k_ipad[65] = {}; unsigned char k_opad[65] = {}; unsigned char tk[16]; int i; if (keylen > 64) { md5_context_t tctx; md5_init(&tctx); md5_append(&tctx, (const md5_byte_t *)key, keylen); md5_finish(&tctx, tk); key = tk; keylen = 16; } memcpy(k_ipad, key, keylen); memcpy(k_opad, key, keylen); for (i = 0; i < 64; i++) { k_ipad[i] ^= 0x36; k_opad[i] ^= 0x5c; } md5_init(&ctx); md5_append(&ctx, (const md5_byte_t *)k_ipad, 64); md5_append(&ctx, (const md5_byte_t *)data, datalen); md5_finish(&ctx, digest); md5_init(&ctx); md5_append(&ctx, (const md5_byte_t *)k_opad, 64); md5_append(&ctx, (const md5_byte_t *)digest, 16); md5_finish(&ctx, digest); } monit-5.35.2/src/alert.h0000644000016400001720000000423515007061157011725 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_ALERT_H #define MONIT_ALERT_H #include "event.h" /** Default mail from string */ #define ALERT_FROM "monit@$HOST" /** Default mail subject */ #define ALERT_SUBJECT "monit alert -- $EVENT $SERVICE" /** Default mail message */ #define ALERT_MESSAGE "$EVENT Service $SERVICE \r\n"\ "\r\n"\ "\tDate: $DATE\r\n"\ "\tAction: $ACTION\r\n"\ "\tHost: $HOST\r\n"\ "\tDescription: $DESCRIPTION\r\n"\ "\r\n"\ "Your faithful employee,\r\n"\ "Monit\r\n" /** * This module is used for event notifications. Users may register * interest for certain events in the monit control file. When an * event occurs this module is called from the event processing * machinery to notify users who have asked to be alerted for * particular events. * * @file */ /** * Notify registered users about the event * @param E An Event object * @return If failed, return Handler_Alert flag or Handler_Succeeded flag if succeeded */ Handler_Type handle_alert(Event_T E); #endif monit-5.35.2/src/config.h.in0000644000016400001720000004170515007061161012466 00000000000000/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you have the header file. */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have address sanitizer. */ #undef HAVE_ASAN /* Define to 1 if you have the header file. */ #undef HAVE_ASM_PAGE_H /* Define to 1 if you have the header file. */ #undef HAVE_ASM_PARAM_H /* Define to 1 if you have openssl with ASN1_TIME_diff */ #undef HAVE_ASN1_TIME_DIFF /* Define if backtrace is available */ #undef HAVE_BACKTRACE /* Define to 1 if you have the header file. */ #undef HAVE_CF_H /* Define to 1 if you have the header file. */ #undef HAVE_COREFOUNDATION_COREFOUNDATION_H /* Define to 1 if you have the header file. */ #undef HAVE_CRT_EXTERNS_H /* Define to 1 if you have the header file. */ #undef HAVE_CRYPT_H /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define to 1 if you have the header file. */ #undef HAVE_DEVSTAT_H /* Define to 1 if you have the header file. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DISKARBITRATION_DISKARBITRATION_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have openssl with EC_KEY */ #undef HAVE_EC_KEY /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `getloadavg' function. */ #undef HAVE_GETLOADAVG /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the header file. */ #undef HAVE_GLOB_H /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H /* Define to 1 if you have the header file. */ #undef HAVE_IFADDRS_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDRIVER_H /* Define to 1 if the system supports IPv6 */ #undef HAVE_IPV6 /* Define to 1 if you have the header file. */ #undef HAVE_KINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_KSTAT_H /* Define to 1 if you have the header file. */ #undef HAVE_KVM_H /* Define to 1 if you have large files support */ #undef HAVE_LARGEFILES /* Define to 1 if you have the `crypt' library (-lcrypt). */ #undef HAVE_LIBCRYPT /* Define to 1 if you have the `crypto' library (-lcrypto). */ #undef HAVE_LIBCRYPTO /* Define to 1 if you have the `devstat' library (-ldevstat). */ #undef HAVE_LIBDEVSTAT /* Define to 1 if you have the `inet' library (-linet). */ #undef HAVE_LIBINET /* Define to 1 if you have the `kstat' library (-lkstat). */ #undef HAVE_LIBKSTAT /* Define to 1 if you have the `kvm' library (-lkvm). */ #undef HAVE_LIBKVM /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `nvpair' library (-lnvpair). */ #undef HAVE_LIBNVPAIR /* Define to 1 if you have the `pam' library (-lpam). */ #undef HAVE_LIBPAM /* Define to 1 if you have the header file. */ #undef HAVE_LIBPERFSTAT_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBPROC_H /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the `resolv' library (-lresolv). */ #undef HAVE_LIBRESOLV /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the `ssl' library (-lssl). */ #undef HAVE_LIBSSL /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ /* Define to 1 if you have the `zfs' library (-lzfs). */ #undef HAVE_LIBZFS /* Define to 1 if you have the header file. */ #undef HAVE_LIBZFS_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOADAVG_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if you have the header file. */ #undef HAVE_LVM_H /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_PMAP_H /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_VMPARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_MACH_HOST_INFO_H /* Define to 1 if you have the header file. */ #undef HAVE_MACH_MACH_H /* Define to 1 if you have the header file. */ #undef HAVE_MACH_MACH_HOST_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_MNTENT_H /* Define to 1 if you have /etc/mnttab */ #undef HAVE_MNTTAB /* Define to 1 if you have /etc/mtab */ #undef HAVE_MTAB /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_ICMP6_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_SYSTM_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IP_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IP_ICMP_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_TCP_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_DL_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_MEDIA_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_ROUTE_H /* Define to 1 if you have openssl. */ #undef HAVE_OPENSSL /* Define to 1 if you have the header file. */ #undef HAVE_PAM_PAM_APPL_H /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H /* Define to 1 if you have the header file. */ #undef HAVE_PROCFS_H /* Define to 1 if you have the header file. */ #undef HAVE_PROCINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H /* Define to 1 if you have the header file. */ #undef HAVE_REGEX_H /* Define to 1 if you have the header file. */ #undef HAVE_SECURITY_PAM_APPL_H /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the header file. */ #undef HAVE_SIGSETJMP_H /* Define to 1 if you have openssl with SSLv2 */ #undef HAVE_SSLV2 /* Define to 1 if you have ssl library with SSL_CTX_set_keylog_callback */ #undef HAVE_SSL_CTX_SET_KEYLOG_CALLBACK /* Define to 1 if you have the `statfs' function. */ #undef HAVE_STATFS /* Define to 1 if you have the `statvfs' function. */ #undef HAVE_STATVFS /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ #undef HAVE_STRUCT_TM_TM_GMTOFF /* Define to 1 if you have the `syslog' function. */ #undef HAVE_SYSLOG /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CFGDB_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CFGODM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DISK_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DKSTAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DK_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FS_ZFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_INSTANCE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOSTAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LOADAVG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LOCK_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MNTENT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MNTTAB_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MUTEX_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_NLIST_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_NVPAIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PROCFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PROC_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PROTOSW_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PSTAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_QUEUE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCEVAR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SCHED_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATVFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SWAP_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSMACROS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSTEMCFG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TREE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UCRED_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UN_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_USER_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UTSNAME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VAR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VMMETER_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VM_USAGE_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have openssl with TLSv1.1 */ #undef HAVE_TLSV1_1 /* Define to 1 if you have openssl with TLSv1.2 */ #undef HAVE_TLSV1_2 /* Define to 1 if you have openssl with TLSv1.3 */ #undef HAVE_TLSV1_3 /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_UTMPX_H /* Define to 1 if you have the header file. */ #undef HAVE_UVM_UVM_EXTERN_H /* Define to 1 if you have the header file. */ #undef HAVE_UVM_UVM_H /* Define to 1 if you have the header file. */ #undef HAVE_UVM_UVM_MAP_H /* Define to 1 if you have the header file. */ #undef HAVE_UVM_UVM_OBJECT_H /* Define to 1 if you have the header file. */ #undef HAVE_UVM_UVM_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_UVM_UVM_PMAP_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the header file. */ #undef HAVE_VM_PMAP_H /* Define to 1 if you have the header file. */ #undef HAVE_VM_VM_H /* Define to 1 if you have the header file. */ #undef HAVE_VM_VM_MAP_H /* Define to 1 if you have the header file. */ #undef HAVE_VM_VM_OBJECT_H /* Define to 1 if you have the `vsyslog' function. */ #undef HAVE_VSYSLOG /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_ZONE_H /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* 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 /* Define to the pid storage directory. */ #undef PIDDIR /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if does not define. */ #undef mode_t /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define as `fork' if `vfork' does not work. */ #undef vfork /* Mask out GCC __attribute__ extension for non-gcc compilers. */ #ifndef __GNUC__ #define __attribute__(x) #endif monit-5.35.2/src/log.c0000644000016400001720000002737215007061157011401 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_SYSLOG_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_EXECINFO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include "monit.h" // libmonit #include "system/Time.h" /** * Implementation of a logger that appends log messages to a file * with a preceding timestamp. Methods support both syslog or own * logfile. * * @file */ /* ------------------------------------------------------------- Definitions */ static FILE *_LOG = NULL; static Mutex_T _mutex = PTHREAD_MUTEX_INITIALIZER; static struct mylogpriority { int priority; const char *description; } logPriority[] = { {LOG_EMERG, "emergency"}, {LOG_ALERT, "alert"}, {LOG_CRIT, "critical"}, {LOG_ERR, "error"}, {LOG_WARNING, "warning"}, {LOG_NOTICE, "notice"}, {LOG_INFO, "info"}, {LOG_DEBUG, "debug"}, {-1, NULL} }; /* ----------------------------------------------------------------- Private */ /** * Open a log file or syslog */ static bool _open(void) { if (Run.flags & Run_UseSyslog) { openlog(Prog, LOG_PID, Run.facility); } else { _LOG = fopen(Run.files.log, "a"); if (! _LOG) { Log_error("Error opening the log file '%s' for writing -- %s\n", Run.files.log, STRERROR); return false; } /* Set logger in unbuffered mode */ setvbuf(_LOG, NULL, _IONBF, 0); } return true; } /** * Get a textual description of the actual log priority. * @param p The log priority * @return A string describing the log priority in clear text. If the * priority is not found NULL is returned. */ static const char *_priorityDescription(int p) { struct mylogpriority *lp = logPriority; while ((*lp).description) { if (p == (*lp).priority) { return (*lp).description; } lp++; } return "unknown"; } /** * Log a message to monits logfile or syslog. * @param priority A message priority * @param s A formatted (printf-style) string to log */ __attribute__((format (printf, 2, 0))) static void _log(int priority, const char *s, va_list ap) { assert(s); va_list ap_copy; LOCK(_mutex) { FILE *output = priority < LOG_INFO ? stderr : stdout; va_copy(ap_copy, ap); vfprintf(output, s, ap_copy); va_end(ap_copy); fflush(output); if (Run.flags & Run_Log) { if (Run.flags & Run_UseSyslog) { va_copy(ap_copy, ap); vsyslog(priority, s, ap_copy); va_end(ap_copy); } else if (_LOG) { fprintf(_LOG, "[%s] %-8s : ", Time_localFmt((char[STRLEN]){}, STRLEN, TIMEFORMAT, Time_now()), _priorityDescription(priority)); va_copy(ap_copy, ap); vfprintf(_LOG, s, ap_copy); va_end(ap_copy); } } } END_LOCK; } static void _backtrace(bool force) { #ifdef HAVE_BACKTRACE int i, frames; void *callstack[128]; char **strs; if (force || Run.debug >= 2) { frames = backtrace(callstack, 128); strs = backtrace_symbols(callstack, frames); Log_debug("-------------------------------------------------------------------------------\n"); for (i = 0; i < frames; ++i) Log_debug(" %s\n", strs[i]); Log_debug("-------------------------------------------------------------------------------\n"); FREE(strs); } #endif } /* ------------------------------------------------------------------------- */ #ifndef HAVE_VSYSLOG #ifdef HAVE_SYSLOG void vsyslog(int facility_priority, const char *format, va_list arglist) { char msg[STRLEN+1]; vsnprintf(msg, STRLEN, format, arglist); syslog(facility_priority, "%s", msg); } #endif /* HAVE_SYSLOG */ #endif /* HAVE_VSYSLOG */ /* ------------------------------------------------------------------ Public */ /** * Initialize the log system and 'log' function * @return true if the log system was successfully initialized */ bool Log_init(void) { if (! (Run.flags & Run_Log)) return true; if (! _open()) return false; /* Register Log_close to be called at program termination */ atexit(Log_close); return true; } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_emergency(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_EMERG, s, ap); va_end(ap); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_vemergency(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_EMERG, s, ap); va_end(ap_copy); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_alert(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_ALERT, s, ap); va_end(ap); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_valert(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_ALERT, s, ap); va_end(ap_copy); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_critical(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_CRIT, s, ap); va_end(ap); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_vcritical(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_CRIT, s, ap); va_end(ap_copy); _backtrace(false); } /* * Called by libmonit on Exception. Log * error and abort the application */ void Log_abort_handler(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_CRIT, s, ap); va_end(ap_copy); _backtrace(true); // Always log backtrace on abort (asserts, etc.) if (Run.debug) { abort(); } exit(1); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_error(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_ERR, s, ap); va_end(ap); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_verror(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_ERR, s, ap); va_end(ap_copy); _backtrace(false); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_warning(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_WARNING, s, ap); va_end(ap); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_vwarning(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_WARNING, s, ap); va_end(ap_copy); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_notice(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_NOTICE, s, ap); va_end(ap); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_vnotice(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_NOTICE, s, ap); va_end(ap_copy); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_info(const char *s, ...) { assert(s); va_list ap; va_start(ap, s); _log(LOG_INFO, s, ap); va_end(ap); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_vinfo(const char *s, va_list ap) { assert(s); va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_INFO, s, ap); va_end(ap_copy); } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log */ void Log_debug(const char *s, ...) { assert(s); if (Run.debug) { va_list ap; va_start(ap, s); _log(LOG_DEBUG, s, ap); va_end(ap); } } /** * Logging interface with priority support * @param s A formatted (printf-style) string to log * @param ap A variable argument list */ void Log_vdebug(const char *s, va_list ap) { assert(s); if (Run.debug) { va_list ap_copy; va_copy(ap_copy, ap); _log(LOG_NOTICE, s, ap); va_end(ap_copy); } } /** * Close the log file or syslog */ void Log_close(void) { if (Run.flags & Run_UseSyslog) { closelog(); } if (_LOG && (0 != fclose(_LOG))) { Log_error("Error closing the log file -- %s\n", STRERROR); } _LOG = NULL; } monit-5.35.2/src/md5_crypt.h0000644000016400001720000000316715007061157012527 00000000000000/* * From crypt implementation 1.7 by Poul-Henning Kamp * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * * Sub-licensed with modifications under AGPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MD5_CRYPT_H #define MD5_CRYPT_H char *md5_crypt(const char *pw, const char *id, const char *salt, char *buf, int buflen); #endif monit-5.35.2/src/md5_crypt.c0000644000016400001720000001267015007061157012521 00000000000000/* * From crypt implementation 1.7 by Poul-Henning Kamp * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * * Sub-licensed with modifications under AGPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "md5.h" #include "md5_crypt.h" /* 0 ... 63 => ascii - 64 */ static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static void to64(char *s, unsigned long v, int n) { while (--n >= 0) { *s++ = itoa64[v & 0x3f]; v >>= 6; } } /* * UNIX password MD5 */ char *md5_crypt(const char *pw, const char *id, const char *salt, char *buf, int buflen) { char *p; const md5_byte_t *sp, *ep; unsigned char final[16]; int sl, pl, pwl = (int)strlen(pw); unsigned long l; md5_context_t ctx, ctx1; /* Refine the Salt first */ sp = (const md5_byte_t *)salt; /* If it starts with the id string, then skip that */ if (! strncmp(salt, id, strlen(id))) sp += strlen(id); /* It stops at the first '$', max 8 chars */ for (ep = sp; *ep && *ep != '$' && ep < (sp + 8); ep++) continue; /* get the length of the true salt */ sl = (int)(ep - sp); md5_init(&ctx); /* The password first, since that is what is most unknown */ md5_append(&ctx, (const md5_byte_t *)pw, pwl); /* Then our id string */ md5_append(&ctx, (const md5_byte_t *)id, (int)strlen(id)); /* Then the raw salt */ md5_append(&ctx, sp, sl); /* Then just as many characters of the MD5(pw, salt, pw) */ md5_init(&ctx1); md5_append(&ctx1, (const md5_byte_t *)pw, pwl); md5_append(&ctx1, sp, sl); md5_append(&ctx1, (const md5_byte_t *)pw, pwl); md5_finish(&ctx1, final); for (pl = pwl; pl > 0; pl -= 16) md5_append(&ctx, final, pl > 16 ? 16 : pl); /* Don't leave anything around in vm they could use. */ memset(final, 0, sizeof(final)); /* Then something really weird... */ for (int i = pwl; i; i >>= 1) { if (i & 1) md5_append(&ctx, final, 1); else md5_append(&ctx, (const md5_byte_t *)pw, 1); } /* Now make the output string */ strncpy(buf, id, buflen); strncat(buf, (const char *)sp, sl); strcat(buf, "$"); md5_finish(&ctx, final); /* * and now, just to make sure things don't run too fast * On a 60 Mhz Pentium this takes 34 msec, so you would * need 30 seconds to build a 1000 entry dictionary... */ for (int i = 0; i < 1000; i++) { md5_init(&ctx1); if (i & 1) md5_append(&ctx1, (const md5_byte_t *)pw, pwl); else md5_append(&ctx1, final, 16); if (i % 3) md5_append(&ctx1, sp, sl); if (i % 7) md5_append(&ctx1, (const md5_byte_t *)pw, pwl); if (i & 1) md5_append(&ctx1, final, 16); else md5_append(&ctx1, (const md5_byte_t *)pw, pwl); md5_finish(&ctx1, final); } p = buf + strlen(buf); l = (final[ 0] << 16) | (final[ 6] << 8) | final[12]; to64(p, l, 4); p += 4; l = (final[ 1] << 16) | (final[ 7] << 8) | final[13]; to64(p, l, 4); p += 4; l = (final[ 2] << 16) | (final[ 8] << 8) | final[14]; to64(p, l, 4); p += 4; l = (final[ 3] << 16) | (final[ 9] << 8) | final[15]; to64(p, l, 4); p += 4; l = (final[ 4] << 16) | (final[10] << 8) | final[ 5]; to64(p, l, 4); p += 4; l = final[11] ; to64(p, l, 2); p += 2; *p = '\0'; /* Don't leave anything around in vm they could use. */ memset(final, 0, sizeof(final)); return buf; } monit-5.35.2/src/signal.c0000644000016400001720000000473315007061157012071 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #include "monit.h" /** * Signal handling routines. * * @file */ /* ------------------------------------------------------------------ Public */ #if ! defined HAVE_ASAN && ! defined FREEBSD /** * Replace the standard signal() function, with a more reliable * using sigaction. From W. Richard Stevens' "Advanced Programming * in the UNIX Environment" */ Sigfunc *signal(int signo, Sigfunc *func) { struct sigaction act, oact; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; if (signo == SIGALRM) { #ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT; /* SunOS */ #endif } else { #ifdef SA_RESTART act.sa_flags |= SA_RESTART; /* SVR4, 44BSD */ #endif } if (sigaction(signo, &act, &oact) < 0) return(SIG_ERR); return(oact.sa_handler); } #endif /** * Set a collective thread signal block for signals honored or not by monit */ void set_signal_block(bool isMainThread) { sigset_t mask; sigemptyset(&mask); sigaddset(&mask, SIGHUP); sigaddset(&mask, SIGPIPE); sigaddset(&mask, SIGINT); sigaddset(&mask, SIGUSR1); sigaddset(&mask, SIGTERM); if (! isMainThread) sigaddset(&mask, SIGCHLD); pthread_sigmask(SIG_BLOCK, &mask, NULL); } monit-5.35.2/src/protocols/0000755000016400001720000000000015007061157012545 500000000000000monit-5.35.2/src/protocols/memcache.c0000644000016400001720000001112415007061157014372 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" #define MEMCACHELEN 24 /* Magic Byte */ #define MAGIC_REQUEST 0x80 #define MAGIC_RESPONSE 0x81 /* Response Status */ #define NO_ERROR 0x0000 #define KEY_NOT_FOUND 0x0001 #define KEY_EXISTS 0x0002 #define VALUE_TOO_BIG 0x0003 #define INVALID_ARGUMENTS 0x0004 #define ITEM_NOT_STORED 0x0005 #define UNKNOWN_COMMAND 0x0081 #define OUT_OF_MEMORY 0x0082 /** * Memcache binary protocol * * Send No-op request * * @file */ void check_memcache(Socket_T socket) { unsigned int length; unsigned char response[MEMCACHELEN]; unsigned int status; unsigned char request[MEMCACHELEN] = { MAGIC_REQUEST, /** Magic */ 0x0a, /** Opcode */ 0x00, 0x00, /** Key length */ 0x00, /** Extra length */ 0x00, /** Data type */ 0x00, 0x00, /** request Reserved / response Status */ 0x00, 0x00, 0x00, 0x00, /** Total body */ 0x00, 0x00, 0x00, 0x00, /** Opaque */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /** CAS */ }; assert(socket); if (Socket_write(socket, (unsigned char *)request, sizeof(request)) <= 0) THROW(IOException, "MEMCACHE: error sending data -- %s", STRERROR); /* Response should have at least MEMCACHELEN bytes */ length = Socket_read(socket, (unsigned char *)response, sizeof(response)); if (length != MEMCACHELEN) THROW(IOException, "MEMCACHE: Received %d bytes from server, expected %d bytes", length, MEMCACHELEN); if (response[0] != MAGIC_RESPONSE) THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- error occurred"); status = (response[6] << 8) | response[7]; switch (status) { case NO_ERROR: break; case OUT_OF_MEMORY: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Out of memory"); break; case UNKNOWN_COMMAND: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Unknown command"); break; case INVALID_ARGUMENTS: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Invalid arguments"); break; case VALUE_TOO_BIG: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Value too big"); break; case ITEM_NOT_STORED: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Item not stored"); break; case KEY_NOT_FOUND: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Key not found"); break; case KEY_EXISTS: THROW(ProtocolException, "MEMCACHELEN: Invalid response code -- Key exists"); break; default: THROW(ProtocolException, "MEMCACHELEN: Unknown response code %u -- error occurred", status); break; } } monit-5.35.2/src/protocols/rsync.c0000644000016400001720000000600015007061157013763 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check the server for greeting "@RSYNCD: XX, then send this greeting back to server, send command '#list' to get a listing of modules. * * @file */ void check_rsync(Socket_T socket) { char buf[64]; char header[11]; int rc, version_major, version_minor; const char *rsyncd = "@RSYNCD:"; const char *rsyncd_exit = "@RSYNCD: EXIT"; assert(socket); /* Read and check the greeting */ if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "RSYNC: did not see server greeting -- %s", STRERROR); Str_chomp(buf); rc = sscanf(buf, "%10s %d.%d", header, &version_major, &version_minor); if ((rc == EOF) || (rc != 3)) THROW(ProtocolException, "RSYNC: server greeting parse error %s", buf); if (strncasecmp(header, rsyncd, strlen(rsyncd)) != 0) THROW(ProtocolException, "RSYNC: server sent unexpected greeting -- %s", buf); /* Send back the greeting */ if (Socket_print(socket, "%s\n", buf) <= 0) THROW(IOException, "RSYNC: identification string send failed -- %s", STRERROR); /* Send #list command */ if (Socket_print(socket, "#list\n") < 0) THROW(IOException, "RSYNC: #list command failed -- %s", STRERROR); /* Read response: discard list output and check that we've received successful exit */ do { if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "RSYNC: error receiving data -- %s", STRERROR); Str_chomp(buf); } while (strncasecmp(buf, rsyncd, strlen(rsyncd))); if (strncasecmp(buf, rsyncd_exit, strlen(rsyncd_exit)) != 0) THROW(ProtocolException, "RSYNC: server sent unexpected response -- %s", buf); } monit-5.35.2/src/protocols/fail2ban.c0000644000016400001720000000416415007061157014314 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Send PING and check for PONG. * * @file */ /** * Send PING and check for PONG. * * @file */ void check_fail2ban(Socket_T socket) { assert(socket); const unsigned char ping[] = "(lp0\nS'ping'\np1\na."; // pickle protocol version 0 // Send PING if (Socket_write(socket, ping, sizeof(ping)) < 0) { THROW(IOException, "FAIL2BAN: PING command error -- %s", STRERROR); } // Read and check response - just the pickle protocol header beginning to see if the server reacts to commands, so we can keep the response test pickle-protocol-version agnostic unsigned char response[1] = {}; if (Socket_read(socket, response, sizeof(response)) != 1) { THROW(IOException, "FAIL2BAN: PONG read error -- %s", STRERROR); } if (response[0] != 0x80) { THROW(ProtocolException, "FAIL2BAN: PONG error"); } } monit-5.35.2/src/protocols/sip.c0000644000016400001720000001357115007061157013433 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * 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 3 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #include "protocol.h" // libmonit #include "system/Random.h" #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * * A SIP test. * * This test has been created in order to construct valid SIP message, * even with a low poll cycle. (In case of low poll cycle, chance are * high for a misinterpretation of the generic test by the SIP AS. It * will considered it for a retransmission, not for a new message) * * The test sends an OPTIONS request and check the server's status code. * * The status code must be between 200 and 300. * * In this current version, redirection is not supported. This code is * a rewrite of a patch we received from Pierrick Grasland and Bret McDanel * to check the SIP protocol. * * @file */ /* -------------------------------------------------------------- Public*/ void check_sip(Socket_T socket) { assert(socket); Port_T P = Socket_getPort(socket); assert(P); const char *target = P->parameters.sip.target ? P->parameters.sip.target : "monit@foo.bar"; int port = Socket_getLocalPort(socket); const char *proto = Socket_isSecure(socket) ? "sips" : "sip"; const char *transport = NULL; const char *rport = ""; switch (Socket_getType(socket)) { case Socket_Udp: transport = "UDP"; rport = ";rport"; break; case Socket_Tcp: transport = "TCP"; break; default: THROW(IOException, "Unsupported socket type, only TCP and UDP are supported"); return; } char buf[STRLEN]; const char *myip = Socket_getLocalHost(socket, buf, sizeof(buf)); if (Socket_print(socket, "OPTIONS %s:%s SIP/2.0\r\n" "Via: SIP/2.0/%s %s:%d;branch=z9hG4bKh%llx%s\r\n" "Max-Forwards: %d\r\n" "To: <%s:%s>\r\n" "From: monit <%s:monit@%s>;tag=%llx\r\n" "Call-ID: %llx\r\n" "CSeq: 63104 OPTIONS\r\n" "Contact: <%s:%s:%d>\r\n" "Accept: application/sdp\r\n" "Content-Length: 0\r\n" "User-Agent: Monit/%s\r\n\r\n", proto, // protocol target, // to transport, // via transport udp|tcp myip, // who its from port, // our port Random_number(), // branch rport, // rport option P->parameters.sip.maxforward ? (P->parameters.sip.maxforward == INT_MAX ? 0 : P->parameters.sip.maxforward) : 70, // maximum forwards proto, // protocol target, // to proto, // protocol myip, // from host Random_number(), // tag Random_number(), // call id proto, // protocol myip, // contact host port, // contact port VERSION // user agent ) < 0) { THROW(IOException, "SIP: error sending data -- %s", STRERROR); } if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "SIP: error receiving data -- %s", STRERROR); Str_chomp(buf); DEBUG("Response from SIP server: %s\n", buf); int status; if (! sscanf(buf, "%*s %d", &status)) THROW(ProtocolException, "SIP error: cannot parse SIP status in response: %s", buf); if (status >= 400) THROW(ProtocolException, "SIP error: Server returned status %d", status); if (status >= 300 && status < 400) THROW(ProtocolException, "SIP info: Server redirection. Returned status %d", status); if (status > 100 && status < 200) THROW(ProtocolException, "SIP error: Provisional response . Returned status %d", status); } monit-5.35.2/src/protocols/lmtp.c0000644000016400001720000000461315007061157013611 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* --------------------------------------------------------------- Private */ static void say(Socket_T socket, const char *msg) { if (Socket_write(socket, msg, strlen(msg)) < 0) THROW(IOException, "LMTP: error sending data -- %s", STRERROR); } static void expect(Socket_T socket, int expect) { int status; char buf[STRLEN]; do { if (! Socket_readLine(socket, buf, STRLEN)) THROW(IOException, "LMTP: error receiving data -- %s", STRERROR); Str_chomp(buf); } while (buf[3] == '-'); // Discard multi-line response if (sscanf(buf, "%d", &status) != 1 || status != expect) THROW(ProtocolException, "LMTP error: %s", buf); } /* ---------------------------------------------------------------- Public */ /** * Check the server for greeting code 220, send LHLO, test for return code 250 and finally send QUIT and check for return code 221 * * @see RFC2033 * * @file */ void check_lmtp(Socket_T socket) { assert(socket); expect(socket, 220); say(socket, "LHLO localhost\r\n"); expect(socket, 250); say(socket, "QUIT\r\n"); expect(socket, 221); } monit-5.35.2/src/protocols/mysql.c0000644000016400001720000010515615007061157014006 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_OPENSSL // We don't silence deprecation warnings as this will remind us to update for version >= 3 #include #include #endif #include "protocol.h" #include "md5.h" #include "sha1.h" #include "checksum.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* ----------------------------------------------------------- Definitions */ #define MYSQL_OK 0x00 #define MYSQL_AUTHMOREDATA 0x01 #define MYSQL_AUTHSWITCH 0xfe #define MYSQL_ERROR 0xff #define COM_QUIT 0x1 #define COM_QUERY 0x3 #define COM_PING 0xe // Capability flags (see https//dev.mysql.com/doc/internals/en/capability-flags.html#packet-Protocol::CapabilityFlags) #define CLIENT_LONG_PASSWORD 0x00000001 #define CLIENT_FOUND_ROWS 0x00000002 #define CLIENT_LONG_FLAG 0x00000004 #define CLIENT_CONNECT_WITH_DB 0x00000008 #define CLIENT_NO_SCHEMA 0x00000010 #define CLIENT_COMPRESS 0x00000020 #define CLIENT_ODBC 0x00000040 #define CLIENT_LOCAL_FILES 0x00000080 #define CLIENT_IGNORE_SPACE 0x00000100 #define CLIENT_PROTOCOL_41 0x00000200 #define CLIENT_INTERACTIVE 0x00000400 #define CLIENT_SSL 0x00000800 #define CLIENT_IGNORE_SIGPIPE 0x00001000 #define CLIENT_TRANSACTIONS 0x00002000 #define CLIENT_RESERVED 0x00004000 #define CLIENT_SECURE_CONNECTION 0x00008000 #define CLIENT_MULTI_STATEMENTS 0x00010000 #define CLIENT_MULTI_RESULTS 0x00020000 #define CLIENT_PS_MULTI_RESULTS 0x00040000 #define CLIENT_PLUGIN_AUTH 0x00080000 #define CLIENT_CONNECT_ATTRS 0x00100000 #define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA 0x00200000 #define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS 0x00400000 #define CLIENT_SESSION_TRACK 0x00800000 #define CLIENT_DEPRECATE_EOF 0x01000000 #define CLIENT_SSL_VERIFY_SERVER_CERT 0x40000000 #define CLIENT_REMEMBER_OPTIONS 0x80000000 // Status flags (see https//dev.mysql.com/doc/internals/en/status-flags.html#packet-Protocol::StatusFlags) #define SERVER_STATUS_IN_TRANS 0x0001 #define SERVER_STATUS_AUTOCOMMIT 0x0002 #define SERVER_MORE_RESULTS_EXISTS 0x0008 #define SERVER_STATUS_NO_GOOD_INDEX_USED 0x0010 #define SERVER_STATUS_NO_INDEX_USED 0x0020 #define SERVER_STATUS_CURSOR_EXISTS 0x0040 #define SERVER_STATUS_LAST_ROW_SENT 0x0080 #define SERVER_STATUS_DB_DROPPED 0x0100 #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 0x0200 #define SERVER_STATUS_METADATA_CHANGED 0x0400 #define SERVER_QUERY_WAS_SLOW 0x0800 #define SERVER_PS_OUT_PARAMS 0x1000 #define SERVER_STATUS_IN_TRANS_READONLY 0x2000 #define SERVER_SESSION_STATE_CHANGED 0x4000 #define MYSQL_REQUEST_BUFFER 4096 #define MYSQL_RESPONSE_BUFFER 4096 #ifndef HAVE_OPENSSL #define SHA256_DIGEST_LENGTH 32 #endif typedef struct { uint32_t len : 24; uint32_t seq : 8; // Data buffer char buf[MYSQL_REQUEST_BUFFER]; // State char *cursor; char *limit; } mysql_request_t; typedef struct { // Data buffer char buf[MYSQL_RESPONSE_BUFFER + 4 + 1]; // reserve 4 bytes for header // Parser state char *cursor; char *limit; // Header int32_t len; uint8_t seq; uint8_t header; // Packet specific data union { struct { // https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_protocol_connection_phase_packets_protocol_handshake_v10.html char *version; uint32_t connectionid; uint8_t characterset; uint16_t status; uint32_t capabilities; uint8_t authdatalen; char authdata[21]; char authplugin[64]; } handshake; struct { // https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_protocol_connection_phase_packets_protocol_auth_more_data.html } authmoredata; struct { // https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_protocol_basic_err_packet.html uint16_t code; char sql_state_marker; char sql_state[5]; char *message; } error; } data; } mysql_response_t; typedef enum { MySQL_Init = 0, MySQL_Greeting, MySQL_Ssl, MySQL_Handshake, MySQL_FastAuthSuccess, MySQL_FullAuthenticationNeeded, MySQL_FetchRSAKey, MySQL_PasswordSent, MySQL_AuthSwitch, MySQL_Ok, MySQL_Error } __attribute__((__packed__)) mysql_state_t; typedef enum { Auth_Native = 0, Auth_CachingSha2 } __attribute__((__packed__)) mysql_authentication_t; typedef struct mysql_t { uint8_t sequence; mysql_state_t state; struct { mysql_authentication_t type; int hashLength; unsigned char *(*getPassword)(unsigned char *result, const char *password, const char *salt); } authentication; mysql_response_t response; mysql_request_t request; Socket_T socket; Port_T port; uint32_t capabilities; char salt[21]; char publicKey[4096]; } mysql_t; /* ----------------------------------------------------------- Data parser */ static uint8_t _getUInt1(mysql_response_t *response) { if (response->cursor + 1 > response->limit) THROW(ProtocolException, "Data not available -- EOF"); uint8_t value = response->cursor[0]; response->cursor += 1; return value; } static uint16_t _getUInt2(mysql_response_t *response) { if (response->cursor + 2 > response->limit) THROW(ProtocolException, "Data not available -- EOF"); uint16_t value; *(((char *)&value) + 0) = response->cursor[1]; *(((char *)&value) + 1) = response->cursor[0]; response->cursor += 2; return ntohs(value); } static uint32_t _getUInt3(mysql_response_t *response) { if (response->cursor + 3 > response->limit) THROW(ProtocolException, "Data not available -- EOF"); uint32_t value; *(((char *)&value) + 0) = 0; *(((char *)&value) + 1) = response->cursor[2]; *(((char *)&value) + 2) = response->cursor[1]; *(((char *)&value) + 3) = response->cursor[0]; response->cursor += 3; return ntohl(value); } static uint32_t _getUInt4(mysql_response_t *response) { if (response->cursor + 4 > response->limit) THROW(ProtocolException, "Data not available -- EOF"); uint32_t value; *(((char *)&value) + 0) = response->cursor[3]; *(((char *)&value) + 1) = response->cursor[2]; *(((char *)&value) + 2) = response->cursor[1]; *(((char *)&value) + 3) = response->cursor[0]; response->cursor += 4; return ntohl(value); } static char *_getString(mysql_response_t *response) { int i; char *value; for (i = 0; response->cursor[i]; i++) // Check limits (cannot use strlen here as no terminating '\0' is guaranteed in the buffer) if (response->cursor + i >= response->limit) // If we reached the limit and didn't found '\0', throw error THROW(ProtocolException, "Data not available -- EOF"); value = response->cursor; response->cursor += i + 1; return value; } static void _getPadding(mysql_response_t *response, int count) { if (response->cursor + count > response->limit) THROW(ProtocolException, "Data not available -- EOF"); response->cursor += count; } /* ----------------------------------------------------------- Data setter */ static void _setUInt1(mysql_request_t *request, uint8_t value) { if (request->cursor + 1 > request->limit) THROW(ProtocolException, "Maximum packet size exceeded"); request->cursor[0] = value; request->cursor += 1; } static void _setUInt4(mysql_request_t *request, uint32_t value) { if (request->cursor + 4 > request->limit) THROW(ProtocolException, "Maximum packet size exceeded"); uint32_t v = htonl(value); request->cursor[0] = *(((char *)&v) + 3); request->cursor[1] = *(((char *)&v) + 2); request->cursor[2] = *(((char *)&v) + 1); request->cursor[3] = *(((char *)&v) + 0); request->cursor += 4; } static void _setData(mysql_request_t *request, const void *data, size_t length) { if (request->cursor + length > request->limit) THROW(ProtocolException, "Maximum packet size exceeded"); memcpy(request->cursor, data, length); request->cursor += length; } static void _setPadding(mysql_request_t *request, int count) { if (request->cursor + count > request->limit) THROW(ProtocolException, "Maximum packet size exceeded"); request->cursor += count; } /* ----------------------------------------------------- Response handlers */ // OK packet (see https//dev.mysql.com/doc/internals/en/packet-OK_Packet.html) static void _responseOk(mysql_t *mysql) { mysql->state = MySQL_Ok; } // AuthMoreData packet static void _responseAuthMoreData(mysql_t *mysql) { if (mysql->state == MySQL_Handshake) { uint8_t data = _getUInt1(&mysql->response); switch (data) { case 3: // Success mysql->state = MySQL_FastAuthSuccess; DEBUG("MySQL Fast Authentication success\n"); break; case 4: // Full authentication is needed mysql->state = MySQL_FullAuthenticationNeeded; DEBUG("MySQL Full Authentication required\n"); break; default: THROW(ProtocolException, "Unexpected AuthMoreData message as part of caching_sha2_password authentication: 0x%x", data); break; } } else if (mysql->state == MySQL_FetchRSAKey) { // Fetch the RSA key if ((size_t)mysql->response.len >= sizeof(mysql->publicKey)) { THROW(ProtocolException, "AuthMoreData response too large: %d", mysql->response.len); } else { strncpy(mysql->publicKey, _getString(&mysql->response), sizeof(mysql->publicKey) - 1); } } else { THROW(ProtocolException, "Unexpected AuthMoreData message -- current state %d", mysql->state); } } // Get the password (see https//dev.mysql.com/doc/internals/en/secure-password-authentication.html): static unsigned char *_getNativePassword(unsigned char result[static SHA1_DIGEST_SIZE], const char *password, const char *salt) { sha1_context_t ctx; // SHA1(password) uint8_t stage1[SHA1_DIGEST_SIZE]; sha1_init(&ctx); sha1_append(&ctx, (const unsigned char *)password, strlen(password)); sha1_finish(&ctx, stage1); // SHA1(SHA1(password)) uint8_t stage2[SHA1_DIGEST_SIZE]; sha1_init(&ctx); sha1_append(&ctx, (const unsigned char *)stage1, SHA1_DIGEST_SIZE); sha1_finish(&ctx, stage2); // SHA1("20-bytes random data from server" SHA1(SHA1(password))) uint8_t stage3[SHA1_DIGEST_SIZE]; sha1_init(&ctx); sha1_append(&ctx, (const unsigned char *)salt, strlen(salt)); sha1_append(&ctx, (const unsigned char *)stage2, SHA1_DIGEST_SIZE); sha1_finish(&ctx, stage3); // XOR for (int i = 0; i < SHA1_DIGEST_SIZE; i++) result[i] = stage1[i] ^ stage3[i]; return result; } // Get the password (see https://dev.mysql.com/doc/internals/en/sha256.html and https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_caching_sha2_authentication_exchanges.html): static unsigned char *_getCachingSha2Password(unsigned char result[static SHA256_DIGEST_LENGTH], const char *password, const char *salt) { #ifdef HAVE_OPENSSL // SHA256(password) uint8_t stage1[SHA256_DIGEST_LENGTH]; SHA256((const unsigned char *)password, strlen(password), stage1); // SHA256(SHA256(password)) uint8_t stage2[SHA256_DIGEST_LENGTH]; SHA256(stage1, SHA256_DIGEST_LENGTH, stage2); // SHA256(SHA256(SHA256(password)), Nonce) uint8_t stage3[SHA256_DIGEST_LENGTH]; SHA256_CTX ctx; SHA256_Init(&ctx); SHA256_Update(&ctx, stage2, SHA256_DIGEST_LENGTH); SHA256_Update(&ctx, salt, strlen(salt)); SHA256_Final(stage3, &ctx); // XOR(SHA256(password), SHA256(SHA256(SHA256(password)), Nonce)) for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) result[i] = stage1[i] ^ stage3[i]; #else THROW(ProtocolException, "MYSQL: caching_sha2_password authentication requires monit to be compiled with SSL library"); #endif return result; } static void _parsePlugin(mysql_t *mysql, const char *plugin) { DEBUG("Server wants %s plugin\n", plugin); if (IS(plugin, "caching_sha2_password")) { mysql->authentication.type = Auth_CachingSha2; mysql->authentication.hashLength = SHA256_DIGEST_LENGTH; mysql->authentication.getPassword = _getCachingSha2Password; snprintf(mysql->response.data.handshake.authplugin, sizeof(mysql->response.data.handshake.authplugin), "%s", plugin); DEBUG("Will use caching_sha2_password plugin\n"); } else if (IS(plugin, "mysql_native_password")) { mysql->authentication.type = Auth_Native; mysql->authentication.hashLength = SHA1_DIGEST_SIZE; mysql->authentication.getPassword = _getNativePassword; snprintf(mysql->response.data.handshake.authplugin, sizeof(mysql->response.data.handshake.authplugin), "%s", plugin); DEBUG("Will use mysql_native_password plugin\n"); } else { THROW(ProtocolException, "MYSQL: unsupported authentication plugin: %s", plugin); } } // AuthSwitchRequest (see https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_request.html) static void _responseAuthSwitch(mysql_t *mysql) { DEBUG("AuthSwitch request from the server\n"); mysql->state = MySQL_AuthSwitch; if (mysql->capabilities & CLIENT_PLUGIN_AUTH) { // New plugin name _parsePlugin(mysql, _getString(&mysql->response)); // New salt snprintf(mysql->salt, sizeof(mysql->salt), "%s", _getString(&mysql->response)); } else { THROW(ProtocolException, "Unexpected AuthSwitchRequest -- the server doesn't support plugin authentication"); } } // ERR packet (see https//dev.mysql.com/doc/internals/en/packet-ERR_Packet.html) static void _responseError(mysql_t *mysql) { mysql->state = MySQL_Error; mysql->response.data.error.code = _getUInt2(&mysql->response); if (mysql->capabilities & CLIENT_PROTOCOL_41) _getPadding(&mysql->response, 6); // skip sql_state_marker and sql_state which we don't use mysql->response.data.error.message = _getString(&mysql->response); THROW(ProtocolException, "Server returned error code %d -- %s", mysql->response.data.error.code, mysql->response.data.error.message); } // Initial greeting packet (see https//dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake) static void _greeting(mysql_t *mysql) { mysql->state = MySQL_Greeting; // Protocol is 10 for MySQL 5.x if (mysql->response.header != 10) THROW(ProtocolException, "Invalid protocol version %d", mysql->response.header); mysql->response.data.handshake.version = _getString(&mysql->response); mysql->response.data.handshake.connectionid = _getUInt4(&mysql->response); snprintf(mysql->salt, 9, "%s", _getString(&mysql->response)); // auth_plugin_data_part_1 mysql->response.data.handshake.capabilities = _getUInt2(&mysql->response); // capability flags (lower 2 bytes) mysql->response.data.handshake.characterset = _getUInt1(&mysql->response); mysql->response.data.handshake.status = _getUInt2(&mysql->response); mysql->response.data.handshake.capabilities |= ((uint32_t)_getUInt2(&mysql->response) << 16); // merge capability flags (lower 2 bytes + upper 2 bytes) mysql->response.data.handshake.authdatalen = _getUInt1(&mysql->response); _getPadding(&mysql->response, 10); // reserved bytes if (mysql->response.data.handshake.capabilities & CLIENT_SECURE_CONNECTION) snprintf(mysql->salt + 8, 13, "%s", _getString(&mysql->response)); // auth_plugin_data_part_2 mysql->capabilities = mysql->response.data.handshake.capabilities; // Save capabilities if (mysql->capabilities & CLIENT_PLUGIN_AUTH) { _parsePlugin(mysql, _getString(&mysql->response)); } DEBUG("MySQL Server: Protocol: %d, Version: %s, Connection ID: %d, Capabilities: 0x%x, AuthPlugin: %s\n", mysql->response.header, mysql->response.data.handshake.version, mysql->response.data.handshake.connectionid, mysql->response.data.handshake.capabilities, *mysql->response.data.handshake.authplugin ? mysql->response.data.handshake.authplugin : "N/A"); } // Response handler static void _readResponse(mysql_t *mysql) { memset(&mysql->response, 0, sizeof(mysql_response_t)); mysql->response.cursor = mysql->response.buf; mysql->response.limit = mysql->response.buf + sizeof(mysql->response.buf); // Read the packet length if (Socket_read(mysql->socket, mysql->response.cursor, 4) < 4) THROW(IOException, "Error receiving server response -- %s", STRERROR); mysql->response.len = _getUInt3(&mysql->response); mysql->response.seq = _getUInt1(&mysql->response); if (mysql->state == MySQL_Init) { if (! mysql->response.len || mysql->response.len > MYSQL_RESPONSE_BUFFER) THROW(ProtocolException, "Invalid handshake packet length -- not MySQL protocol"); if (mysql->response.seq > 1) THROW(ProtocolException, "Invalid handshake packet sequence id -- not MySQL protocol"); } if (mysql->response.len > MYSQL_RESPONSE_BUFFER) { DEBUG("MySQL response: The response length %d is too large for our buffer, will read just %d\n", mysql->response.len, MYSQL_RESPONSE_BUFFER); mysql->response.len = MYSQL_RESPONSE_BUFFER; } mysql->response.len = mysql->response.len > MYSQL_RESPONSE_BUFFER ? MYSQL_RESPONSE_BUFFER : mysql->response.len; // Adjust packet length for this buffer // Read payload if (Socket_read(mysql->socket, mysql->response.cursor, mysql->response.len) != mysql->response.len) THROW(IOException, "Error receiving server response -- %s", STRERROR); // Packet type router mysql->response.header = _getUInt1(&mysql->response); switch (mysql->response.header) { case MYSQL_OK: _responseOk(mysql); break; case MYSQL_AUTHMOREDATA: _responseAuthMoreData(mysql); break; case MYSQL_AUTHSWITCH: _responseAuthSwitch(mysql); break; case MYSQL_ERROR: _responseError(mysql); break; default: _greeting(mysql); break; } mysql->sequence = mysql->response.seq + 1; } /* ------------------------------------------------------ Request handlers */ // Initiate the request static void _initRequest(mysql_t *mysql) { memset(&mysql->request, 0, sizeof(mysql_request_t)); mysql->request.seq = mysql->sequence++; mysql->request.cursor = mysql->request.buf; mysql->request.limit = mysql->request.buf + sizeof(mysql->request.buf); } // Set payload length and send the request to the server static void _sendRequest(mysql_t *mysql, mysql_state_t targetState) { mysql->request.len = (uint32_t)(mysql->request.cursor - mysql->request.buf); // Send request if (Socket_write(mysql->socket, &mysql->request, mysql->request.len + 4) < 0) // Note: mysql->request.len value is just payload size + need to add 4 bytes for the header itself (len + seq) THROW(IOException, "Cannot send handshake response -- %s", STRERROR); mysql->state = targetState; } // Hadshake response packet (see https//dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse) static void _sendHandshake(mysql_t *mysql) { if (mysql->state != MySQL_Greeting && mysql->state != MySQL_Ssl && mysql->state != MySQL_AuthSwitch) THROW(ProtocolException, "Unexpected communication state %d before handshake", mysql->state); _initRequest(mysql); uint32_t capabilities = CLIENT_LONG_PASSWORD | CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION; if (Socket_isSecure(mysql->socket)) capabilities |= CLIENT_SSL; // Does the server support plugin authentication? If yes, we announce we do as well if (mysql->capabilities & CLIENT_PLUGIN_AUTH) capabilities |= CLIENT_PLUGIN_AUTH; _setUInt4(&mysql->request, capabilities); // capabilities _setUInt4(&mysql->request, 8192); // maxpacketsize _setUInt1(&mysql->request, 8); // characterset _setPadding(&mysql->request, 23); // reserved bytes if (mysql->port->parameters.mysql.username) _setData(&mysql->request, mysql->port->parameters.mysql.username, strlen(mysql->port->parameters.mysql.username)); // username _setPadding(&mysql->request, 1); // NUL if (STR_DEF(mysql->port->parameters.mysql.password)) { unsigned char password[SHA256_DIGEST_LENGTH] = {}; _setUInt1(&mysql->request, mysql->authentication.hashLength); // authdatalen _setData(&mysql->request, mysql->authentication.getPassword(password, mysql->port->parameters.mysql.password, mysql->salt), mysql->authentication.hashLength); // password } else { // empty password _setUInt1(&mysql->request, 0); } if (mysql->capabilities & CLIENT_PLUGIN_AUTH) { _setData(&mysql->request, mysql->response.data.handshake.authplugin, strlen(mysql->response.data.handshake.authplugin) + 1); // auth plugin } _sendRequest(mysql, MySQL_Handshake); DEBUG("MySQL handshake sent\n"); } // SSL request packet (see https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_protocol_connection_phase_packets_protocol_ssl_request.html) static void _sendSSLRequest(mysql_t *mysql) { if (mysql->state != MySQL_Greeting) THROW(ProtocolException, "Unexpected communication state %d before SSL start", mysql->state); _initRequest(mysql); _setUInt4(&mysql->request, CLIENT_LONG_PASSWORD | CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION | CLIENT_PLUGIN_AUTH | CLIENT_SSL); // capabilities _setUInt4(&mysql->request, 8192); // maxpacketsize _setUInt1(&mysql->request, 8); // characterset _setPadding(&mysql->request, 23); // reserved bytes _sendRequest(mysql, MySQL_Ssl); DEBUG("MySQL SSL request sent\n"); } // RSA key request (see https://dev.mysql.com/doc/mysql-security-excerpt/8.0/en/caching-sha2-pluggable-authentication.html) static void _sendRSAKeyRequest(mysql_t *mysql) { _initRequest(mysql); _setUInt1(&mysql->request, 2); _sendRequest(mysql, MySQL_FetchRSAKey); DEBUG("MySQL RSA key request sent\n"); } // COM_QUIT packet (see https//dev.mysql.com/doc/internals/en/com-quit.html) static void _sendQuit(mysql_t *mysql) { if (mysql->state != MySQL_Ok) THROW(ProtocolException, "Unexpected communication state %d before Quit", mysql->state); mysql->sequence = 0; _initRequest(mysql); _setUInt1(&mysql->request, COM_QUIT); _sendRequest(mysql, MySQL_Ok); DEBUG("MySQL QUIT sent\n"); } static void _sendPassword(mysql_t *mysql, const unsigned char *password, int passwordLength) { if (mysql->state != MySQL_FullAuthenticationNeeded && mysql->state != MySQL_FetchRSAKey && mysql->state != MySQL_AuthSwitch) THROW(ProtocolException, "Unexpected communication state %d before password exchange", mysql->state); _initRequest(mysql); _setData(&mysql->request, (const char *)password, passwordLength); // password _sendRequest(mysql, MySQL_PasswordSent); DEBUG("MySQL password sent\n"); } // Send the RSA encrypted password (https://dev.mysql.com/doc/internals/en/not-so-fast-path.html) static void _sendEncryptedPassword(mysql_t *mysql) { #ifdef HAVE_OPENSSL // Parse the server RSA public key BIO *bio = BIO_new_mem_buf((void *)mysql->publicKey, -1); RSA *rsa = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL); BIO_free(bio); if (! rsa) THROW(ProtocolException, "RSA public key load failed -- %s", ERR_error_string(ERR_get_error(), NULL)); // XOR the password with the salt unsigned char saltedPassword[STRLEN]; size_t saltLength = strlen(mysql->salt); size_t passwordLength = strlen(mysql->port->parameters.mysql.password) + 1; // Include the terminating NUL for (size_t i = 0; i < passwordLength; i++) saltedPassword[i] = mysql->port->parameters.mysql.password[i] ^ mysql->salt[i % saltLength]; // RSA encrypt the salted password unsigned char encryptedPassword[RSA_size(rsa)]; int encryptedPasswordLength = RSA_public_encrypt((int)passwordLength, saltedPassword, encryptedPassword, rsa, RSA_PKCS1_OAEP_PADDING); RSA_free(rsa); if (encryptedPasswordLength < 0) { THROW(ProtocolException, "RSA public encrypt failed -- %s", ERR_error_string(ERR_get_error(), NULL)); } DEBUG("MySQL password encrypted successfully\n"); // Send the encrypted password _sendPassword(mysql, encryptedPassword, encryptedPasswordLength); #else THROW(ProtocolException, "MYSQL: _sendEncryptedPassword requires monit to be compiled with SSL library"); #endif } static void _getRSAKey(mysql_t *mysql) { _sendRSAKeyRequest(mysql); _readResponse(mysql); DEBUG("MySQL RSA key retrieved successfully:\n%s\n", mysql->publicKey); } static void _checkRSAKey(mysql_t *mysql) { struct ChecksumContext_T context; Checksum_init(&context, mysql->port->parameters.mysql.rsaChecksumType); Checksum_append(&context, mysql->publicKey, (int)strlen(mysql->publicKey)); Checksum_verify(&context, mysql->port->parameters.mysql.rsaChecksum); Checksum_verify(&context, mysql->port->parameters.mysql.rsaChecksum); DEBUG("MySQL RSA key checksum passed\n"); } /* // Note: we currently don't implement COM_QUERY *response* handler (OK/EOF packet with payload), if it'll be added and COM_QUERY used, uncomment the following COM_QUERY request implementation. // // Usage (for example): // _requestQuery(&mysql, "show global status"); // // COM_QUERY packet (see https//dev.mysql.com/doc/internals/en/com-query.html) static void _requestQuery(mysql_t *mysql, const unsigned char *query) { assert(mysql->state == MySQL_Ok); _initRequest(mysql); _setUInt1(&mysql->request, COM_QUERY); _setData(&mysql->request, query, strlen(query)); _sendRequest(mysql, MySQL_Ok); } */ /* ---------------------------------------------------------------- Public */ /** * Simple MySQL test. Connect to MySQL and read Server Handshake Packet. If we can read the packet and it is not an error packet we assume the server is up and working. * * @see https//dev.mysql.com/doc/internals/en/client-server-protocol.html */ void check_mysql(Socket_T S) { assert(S); mysql_t mysql = { .state = MySQL_Init, .sequence = 1, .authentication.type = Auth_Native, .authentication.hashLength = SHA1_DIGEST_SIZE, .authentication.getPassword = _getNativePassword, .socket = S, .port = Socket_getPort(S) }; // Parse the server greeting _readResponse(&mysql); if (mysql.state != MySQL_Greeting) THROW(ProtocolException, "Invalid server greeting, the server didn't sent a handshake packet -- not MySQL protocol"); if (mysql.port->parameters.mysql.username) { // If credentials are specified for the test, try to login if (mysql.port->target.net.ssl.options.flags == SSL_StartTLS) { if (mysql.capabilities & CLIENT_SSL) { // Send SSL request to the MySQL server (https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_protocol_connection_phase.html#sect_protocol_connection_phase_initial_handshake_ssl_handshake) _sendSSLRequest(&mysql); // Switch to TLS encryption Socket_enableSsl(S, &(Run.ssl), NULL); } else { THROW(ProtocolException, "The MySQL server doesn't support SSL"); } } // Login _sendHandshake(&mysql); // The response to the handshake depends on authentication type. The native authentication sends just the OK message, the caching_sha2_password signalizes status using AuthMoreData _readResponse(&mysql); if (mysql.state == MySQL_AuthSwitch) { if (STR_DEF(mysql.port->parameters.mysql.password)) { // Resend the password encoded per requested plugin rules unsigned char password[SHA256_DIGEST_LENGTH] = {}; _sendPassword(&mysql, mysql.authentication.getPassword(password, mysql.port->parameters.mysql.password, mysql.salt), mysql.authentication.hashLength); } else { // Send plain password _sendPassword(&mysql, (const unsigned char *)"", 0); } _readResponse(&mysql); } else if (mysql.state == MySQL_FastAuthSuccess) { // The server should send an OK message immediately after fast auth success _readResponse(&mysql); } else if (mysql.state == MySQL_FullAuthenticationNeeded) { if (Socket_isSecure(S)) { // Send the password to the server including the terminating NUL (plain as we use TLS already) _sendPassword(&mysql, (unsigned char *)mysql.port->parameters.mysql.password, (int)strlen(mysql.port->parameters.mysql.password) + 1); _readResponse(&mysql); } else { // unsecured channel: This requires encryption of the password with server's RSA public key. The client can: // 1. either store a copy of server's public RSA key locally (safe) ... not implemented currently // 2. or retrieve the key from the server (vulnerable to man-in-the-middle attack) => we allow to test the key fingerprint before submitting the password // Get the server key _getRSAKey(&mysql); // Test the checksum if (mysql.port->parameters.mysql.rsaChecksum) { _checkRSAKey(&mysql); } // Send password _sendEncryptedPassword(&mysql); _readResponse(&mysql); } } _sendQuit(&mysql); } } monit-5.35.2/src/protocols/dwp.c0000644000016400001720000000410215007061157013420 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * A simple DWP (database wire protocol) test. * * We send the following request to the server: * 'HEAD / HTTP/1.1' * and check the server's status code. * * If the status code is >= 400, an error has occurred. * * @file */ void check_dwp(Socket_T socket) { #define REQ_LENGTH 1024 int n; int status; char buf[STRLEN]; char proto[STRLEN]; assert(socket); if (Socket_print(socket, "HEAD / HTTP/1.1\r\nConnection: close\r\n\r\n") < 0) THROW(IOException, "DWP: error sending data -- %s", STRERROR); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "DWP: error receiving data -- %s", STRERROR); Str_chomp(buf); n = sscanf(buf, "%255s %d", proto, &status); if (n != 2 || (status >= 400)) THROW(ProtocolException, "DWP error: %s", buf); } monit-5.35.2/src/protocols/tns.c0000644000016400001720000001022115007061157013431 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Simple Oracle Transparent Network Substrate protocol ping test * * @file */ #define TNS_TYPE_REFUSED 4 void check_tns(Socket_T socket) { unsigned char buf[STRLEN]; unsigned char requestPing[] = { 0x00, 0x57, /** Packet Length */ 0x00, 0x00, /** Packet Checksum */ 0x01, /** Packet Type: CONNECT */ 0x00, /** Reserved */ 0x00, 0x00, /** Header Checksum */ 0x01, 0x36, /** Version */ 0x01, 0x2c, /** Compatible */ 0x00, 0x00, /** Service Options */ 0x08, 0x00, /** Session Data Unit Size */ 0x7f, 0xff, /** Maximum Transmission Data Unit Size */ 0xa3, 0x0a, /** NT Protocol Characteristics */ 0x00, 0x00, /** Line Turnaround Value */ 0x01, 0x00, /** Value of 1 in Hardware */ 0x00, 0x1d, /** Length of Connect Data */ 0x00, 0x3a, /** Offset of Connect Data */ 0x00, 0x00, 0x00, 0x00, /** Maximum Receivable Connect Data */ 0x00, /** Connect flags 0 */ 0x00, /** Connect flags 1 */ 0x00, 0x00, 0x00, 0x00, /** Trace Cross Facility Item 1 */ 0x00, 0x00, 0x00, 0x00, /** Trace Cross Facility Item 2 */ 0x00, 0x00, 0x0b, 0x1c, /** Trace Unique Connection ID */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x43, 0x4f, 0x4e, /** Connect Data */ 0x4e, 0x45, 0x43, 0x54, /** (CONNECT_DATA=(COMMAND=ping)) */ 0x5f, 0x44, 0x41, 0x54, 0x41, 0x3d, 0x28, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x3d, 0x70, 0x69, 0x6e, 0x67, 0x29, 0x29 }; assert(socket); if (Socket_write(socket, (unsigned char *)requestPing, sizeof(requestPing)) < 0) THROW(IOException, "TNS: error sending ping -- %s", STRERROR); /* read just first few bytes which contains enough information */ if (Socket_read(socket, (unsigned char *)buf, 5) < 5) THROW(IOException, "TNS: error receiving ping response -- %s", STRERROR); /* compare packet type */ if (buf[4] != TNS_TYPE_REFUSED) THROW(ProtocolException, "TNS: invalid ping response"); } monit-5.35.2/src/protocols/generic.c0000644000016400001720000001452415007061157014253 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_REGEX_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" #include "util/Str.h" #define MIN(x,y) ((x) < (y) ? (x) : (y)) // Escape zero i.e. '\0' in the buffer with "\0". If there are no '\0' in // the buffer it is returned as it is. In the case that the buffer is not // large enough for escaping, the data will be truncated. The buffer will // always be nul-terminated. static char *_escapeZero(char *buf, int bufferLength, int contentLength) { int currentByteIndex = 0; for (int bytesProcessed = 0; bytesProcessed < contentLength && currentByteIndex < bufferLength; bytesProcessed++, currentByteIndex++) { if (buf[currentByteIndex] == '\0') { // Escape the zero, unless we run out of space in the buffer. We reserve the last byte for trailing nul-terminator, so if there is no space for the // nul-terminated escape sequence, we won't perform the escaping and this zero will become the string terminator) if (currentByteIndex + 1 < bufferLength - 1) { // Shift the remaining content by one to the right, to make space for '\'. If there's no space for all remaining bytes, we'll truncate the data memmove(buf + currentByteIndex + 1, buf + currentByteIndex, MIN(contentLength - bytesProcessed, bufferLength - currentByteIndex - 1)); // Escape 0 with "\0" buf[currentByteIndex] = '\\'; buf[currentByteIndex + 1] = '0'; currentByteIndex++; } } } if (currentByteIndex < bufferLength) buf[currentByteIndex] = 0; else buf[bufferLength - 1] = 0; return buf; } /** * Generic service test. * * @file */ void check_generic(Socket_T socket) { assert(socket); Generic_T g = NULL; if (Socket_getPort(socket)) g = ((Port_T)(Socket_getPort(socket)))->parameters.generic.sendexpect; char *buf = CALLOC(sizeof(char), Run.limits.sendExpectBuffer + 1); // Allocate one extra byte for nul-terminator while (g != NULL) { if (g->send != NULL) { /* Unescape any \0x00 escaped chars in g's send string to allow sending a string containing \0 bytes also */ char *X = Str_dup(g->send); int l = Util_handle0Escapes(X); if (Socket_write(socket, X, l) < 0) { FREE(X); FREE(buf); THROW(IOException, "GENERIC: error sending data -- %s", STRERROR); } else { DEBUG("GENERIC: successfully sent: '%s'\n", g->send); } FREE(X); } else if (g->expect != NULL) { /* Since the protocol is unknown we need to wait on EOF. To avoid waiting timeout seconds on EOF we first read one byte to fill the socket's read buffer and then set a low timeout on next read which reads remaining bytes as well as wait on EOF */ int first_byte = Socket_readByte(socket); if (first_byte < 0) { FREE(buf); THROW(IOException, "GENERIC: error receiving data -- %s", STRERROR); } *buf = first_byte; int timeout = Socket_getTimeout(socket); Socket_setTimeout(socket, 200); int n = Socket_read(socket, buf + 1, Run.limits.sendExpectBuffer - 1) + 1; buf[n] = 0; if (n > 0) _escapeZero(buf, Run.limits.sendExpectBuffer + 1, n); // We pass the whole buffer length, including the byte reserved for nul-terminator Socket_setTimeout(socket, timeout); // Reset back original timeout for next send/expect int regex_return = regexec(g->expect, buf, 0, NULL, 0); if (regex_return != 0) { char e[STRLEN]; regerror(regex_return, g->expect, e, STRLEN); char error[512]; snprintf(error, sizeof(error), "GENERIC: received unexpected data [%s] -- %s", Str_trunc(Str_trim(buf), sizeof(error) - 128), e); FREE(buf); THROW(ProtocolException, "%s", error); } else { DEBUG("GENERIC: successfully received: '%s'\n", Str_trunc(buf, STRLEN)); } } else { /* This should not happen */ FREE(buf); THROW(ProtocolException, "GENERIC: unexpected strangeness"); } g = g->next; } FREE(buf); } monit-5.35.2/src/protocols/mqtt.c0000644000016400001720000002575515007061157013634 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* ----------------------------------------------------------- Definitions */ // Message type (see https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718021) typedef enum { MQTT_Type_ConnectRequest = 1, MQTT_Type_ConnectResponse, MQTT_Type_PublishRequest, MQTT_Type_PublishResponse, MQTT_Type_PublishReceived, MQTT_Type_PublishRelease, MQTT_Type_PublishComplete, MQTT_Type_SubscribeRequest, MQTT_Type_SubscribeResponse, MQTT_Type_UnsubscribeRequest, MQTT_Type_UnsubscribeResponse, MQTT_Type_PingRequest, MQTT_Type_PingResponse, MQTT_Type_Disconnect } __attribute__((__packed__)) MQTT_Type; // Connect request flags (see https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718030) - we use just subset for CONNECT and DISCONNECT typedef enum { MQTT_ConnectRequest_None = 0x00, MQTT_ConnectRequest_CleanSession = 0x02, MQTT_ConnectRequest_Password = 0x40, MQTT_ConnectRequest_Username = 0x80 } __attribute__((__packed__)) MQTT_ConnectRequest_Flags; // Connect response flags (see https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718035) typedef enum { MQTT_ConnectResponse_Accepted = 0, MQTT_ConnectResponse_Refused_Protocol, MQTT_ConnectResponse_Refused_ClientIdentifier, MQTT_ConnectResponse_Refused_ServiceUnavailable, MQTT_ConnectResponse_Refused_Credentials, MQTT_ConnectResponse_Refused_NotAuthorized } __attribute__((__packed__)) MQTT_ConnectResponse_Codes; /* -------------------------------------------------------------- Messages */ typedef struct { #if BYTE_ORDER == LITTLE_ENDIAN uint8_t flags : 4; MQTT_Type messageType : 4; #else MQTT_Type messageType : 4; uint8_t flags : 4; #endif uint8_t messageLength; } mqtt_header_t; typedef struct { uint16_t length; char data[STRLEN]; } *mqtt_payload_t; typedef struct { mqtt_header_t header; uint16_t protocolNameLength; char protocolName[4]; uint8_t protocolLevel; uint8_t flags; uint16_t keepAlive; char data[1024]; } mqtt_connect_request_t; typedef struct { mqtt_header_t header; uint8_t acknowledgeFlags; uint8_t returnCode; } mqtt_connect_response_t; typedef struct { mqtt_header_t header; } mqtt_disconnect_request_t; typedef enum { MQTT_Init = 0, MQTT_ConnectSent, MQTT_Connected } __attribute__((__packed__)) mqtt_state_t; typedef struct mqtt_t { mqtt_state_t state; Socket_T socket; Port_T port; } mqtt_t; /* ------------------------------------------------------ Request handlers */ static const char *_describeType(int type) { switch (type) { case MQTT_Type_ConnectRequest: return "Connect Request"; case MQTT_Type_ConnectResponse: return "Connect Response"; case MQTT_Type_PublishRequest: return "Publish Request"; case MQTT_Type_PublishResponse: return "Publish Response"; case MQTT_Type_PublishReceived: return "Publish Received"; case MQTT_Type_PublishRelease: return "Publish Release"; case MQTT_Type_PublishComplete: return "Publish Complete"; case MQTT_Type_SubscribeRequest: return "Subscribe Request"; case MQTT_Type_SubscribeResponse: return "Subscribe Response"; case MQTT_Type_UnsubscribeRequest: return "Unsubscribe Request"; case MQTT_Type_UnsubscribeResponse: return "Unsubscribe Response"; case MQTT_Type_PingRequest: return "Ping Request"; case MQTT_Type_PingResponse: return "Ping Response"; case MQTT_Type_Disconnect: return "Disconnect"; default: break; } return "unknown"; } static const char *_describeConnectionCode(int code) { switch (code) { case MQTT_ConnectResponse_Accepted: return "Connection accepted"; case MQTT_ConnectResponse_Refused_Protocol: return "Connection Refused: unacceptable protocol version"; case MQTT_ConnectResponse_Refused_ClientIdentifier: return "Connection Refused: client identifier rejected"; case MQTT_ConnectResponse_Refused_ServiceUnavailable: return "Connection Refused: server unavailable"; case MQTT_ConnectResponse_Refused_Credentials: return "Connection Refused: bad user name or password"; case MQTT_ConnectResponse_Refused_NotAuthorized: return "Connection Refused: not authorized"; default: break; } return "unknown"; } static void _payload(mqtt_connect_request_t *request, const char *data, MQTT_ConnectRequest_Flags flags) { size_t dataLength = strlen(data); uint16_t dataLengthNetworkOrder = htons(dataLength); // length memcpy(request->data + request->header.messageLength, &dataLengthNetworkOrder, sizeof(dataLengthNetworkOrder)); // data memcpy(request->data + request->header.messageLength + sizeof(uint16_t), data, dataLength); request->header.messageLength += sizeof(dataLengthNetworkOrder) + dataLength; request->flags |= flags; } static void _connectRequest(mqtt_t *mqtt) { mqtt_connect_request_t connect = { .header.messageType = MQTT_Type_ConnectRequest, .header.flags = 0, .protocolNameLength = htons(4), .protocolName[0] = 'M', .protocolName[1] = 'Q', .protocolName[2] = 'T', .protocolName[3] = 'T', .protocolLevel = 4, // protocol for version 3.1.1 .flags = MQTT_ConnectRequest_CleanSession, .keepAlive = htons(1), .data[0] = 0 }; // Client ID char id[STRLEN] = {}; snprintf(id, sizeof(id), "monit-%lld", (long long)Run.incarnation); _payload(&connect, id, MQTT_ConnectRequest_None); // Username if (mqtt->port->parameters.mqtt.username) { _payload(&connect, mqtt->port->parameters.mqtt.username, MQTT_ConnectRequest_Username); } // Password if (mqtt->port->parameters.mqtt.password) { _payload(&connect, mqtt->port->parameters.mqtt.password, MQTT_ConnectRequest_Password); } connect.header.messageLength += sizeof(mqtt_connect_request_t) - sizeof(mqtt_header_t) - sizeof(connect.data); if (Socket_write(mqtt->socket, &connect, sizeof(mqtt_header_t) + connect.header.messageLength) < 0) { THROW(IOException, "Cannot connect -- %s\n", STRERROR); } mqtt->state = MQTT_ConnectSent; } static void _connectResponse(mqtt_t *mqtt) { mqtt_connect_response_t response = {}; if ((long)Socket_read(mqtt->socket, &response, sizeof(mqtt_connect_response_t)) < (long)sizeof(mqtt_connect_response_t)) { THROW(IOException, "Error receiving connection response -- %s", STRERROR); } if (response.header.messageType != MQTT_Type_ConnectResponse) { THROW(ProtocolException, "Unexpected connection response type -- %s (%d)", _describeType(response.header.messageType), response.header.messageType); } if (response.header.messageLength != 2) { THROW(ProtocolException, "Unexpected connection response length -- %d", response.header.messageLength); } if (response.returnCode != MQTT_ConnectResponse_Accepted) { THROW(ProtocolException, "Unexpected connection response code -- %s (%d)", _describeConnectionCode(response.returnCode), response.returnCode); } mqtt->state = MQTT_Connected; } static void _disconnect(mqtt_t *mqtt) { if (mqtt->state == MQTT_Connected) { mqtt_disconnect_request_t disconnect = { .header.messageType = MQTT_Type_Disconnect, .header.flags = 0, .header.messageLength = 0 }; if (Socket_write(mqtt->socket, &disconnect, sizeof(mqtt_disconnect_request_t)) < 0) { THROW(IOException, "Cannot disconnect -- %s\n", STRERROR); } } mqtt->state = MQTT_Init; } /* ---------------------------------------------------------------- Public */ /** * MQTT test. Connect and disconnect. * * @see https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html */ void check_mqtt(Socket_T socket) { assert(socket); mqtt_t mqtt = {.state = MQTT_Init, .socket = socket, .port = Socket_getPort(socket)}; _connectRequest(&mqtt); _connectResponse(&mqtt); _disconnect(&mqtt); } monit-5.35.2/src/protocols/redis.c0000644000016400001720000000440015007061157013735 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* --------------------------------------------------------------- Public */ /** * Simple redis RESP protocol ping test: * * 1. send a PING command * 2. expect a PONG response * 3. send a QUIT command * * @see https://redis.io/docs/latest/develop/reference/protocol-spec/ * * @file */ void check_redis(Socket_T socket) { assert(socket); char buf[STRLEN]; if (Socket_print(socket, "*1\r\n$4\r\nPING\r\n") < 0) THROW(IOException, "REDIS: PING command error -- %s", STRERROR); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "REDIS: PING response error -- %s", STRERROR); Str_chomp(buf); if (! Str_isEqual(buf, "+PONG") && ! Str_startsWith(buf, "-NOAUTH")) // We accept authentication error (-NOAUTH Authentication required): redis responded to request, but requires authentication => we assume it works THROW(ProtocolException, "REDIS: PING error -- %s", buf); if (Socket_print(socket, "*1\r\n$4\r\nQUIT\r\n") < 0) THROW(IOException, "REDIS: QUIT command error -- %s", STRERROR); } monit-5.35.2/src/protocols/ldap3.c0000644000016400001720000001267415007061157013646 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Simple LDAPv3 protocol test. * * Try anonymous bind to the server. * * BindRequest based on RFC2251. Request and response are ASN.1 * BER encoded strings. To make the test as simple as possible * we work with BER encoded data. * * The test checks only if the bind was successful - in the * case of failure it don't provide any erroneous message * analysis. * * @file */ void check_ldap3(Socket_T socket) { unsigned char buf[STRLEN]; unsigned char request[14] = { 0x30, /** Universal Sequence TAG */ 0x0c, /** Length of the packet's data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x00, /** MessageID */ 0x60, /** Application BindRequest TAG */ 0x07, /** Length of the data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x03, /** Protocol version */ 0x04, /** Universal Octet string TAG */ 0x00, /** Octet string length */ /* NULL */ /** Anonymous BindDN */ 0x80, /** Context specific SimpleAuth TAG */ 0x00 /** SimpleAuth (octet string) length */ /* NULL */ /** Anonymous Credentials */ }; unsigned char response[14] = { 0x30, /** Universal Sequence TAG */ 0x0c, /** Length of the packet's data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x00, /** MessageID */ 0x61, /** Application BindResponse TAG */ 0x07, /** Length of the data part */ 0x0a, /** Universal Enumerated TAG */ 0x01, /** Enumerated length */ 0x00, /** Success */ 0x04, /** Universal Octet string TAG */ 0x00, /** Octet string length */ /* NULL */ /** MatchedDN */ 0x04, /** Universal Octet string TAG */ 0x00 /** Octet string length */ /* NULL */ /** ErrorMessage */ }; unsigned char unbind[7] = { 0x30, /** Universal Sequence TAG */ 0x05, /** Length of the packet's data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x01, /** MessageID */ 0x42, /** Application UnbindRequest TAG */ 0x00 /** Length of the data part */ /* NULL */ }; assert(socket); if (Socket_write(socket, (unsigned char *)request, sizeof(request)) < 0) THROW(IOException, "LDAP: error sending data -- %s", STRERROR); if (Socket_read(socket, (unsigned char *)buf, sizeof(response)) <= 0) THROW(IOException, "LDAP: error receiving data -- %s", STRERROR); if (memcmp((unsigned char *)buf, (unsigned char *)response, sizeof(response))) THROW(ProtocolException, "LDAP: anonymous bind failed"); if (Socket_write(socket, (unsigned char *)unbind, sizeof(unbind)) < 0) THROW(IOException, "LDAP: error sending data -- %s", STRERROR); } monit-5.35.2/src/protocols/protocol.c0000644000016400001720000000706315007061157014500 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "protocol.h" static Protocol_T protocols[] = { &(struct Protocol_T){"DEFAULT", check_default}, &(struct Protocol_T){"HTTP", check_http}, &(struct Protocol_T){"FTP", check_ftp}, &(struct Protocol_T){"SMTP", check_smtp}, &(struct Protocol_T){"POP", check_pop}, &(struct Protocol_T){"IMAP", check_imap}, &(struct Protocol_T){"NNTP", check_nntp}, &(struct Protocol_T){"SSH", check_ssh}, &(struct Protocol_T){"DWP", check_dwp}, &(struct Protocol_T){"LDAP2", check_ldap2}, &(struct Protocol_T){"LDAP3", check_ldap3}, &(struct Protocol_T){"RDATE", check_rdate}, &(struct Protocol_T){"RSYNC", check_rsync}, &(struct Protocol_T){"generic", check_generic}, &(struct Protocol_T){"APACHESTATUS", check_apache_status}, &(struct Protocol_T){"NTP3", check_ntp3}, &(struct Protocol_T){"MYSQL", check_mysql}, &(struct Protocol_T){"DNS", check_dns}, &(struct Protocol_T){"POSTFIX-POLICY", check_postfix_policy}, &(struct Protocol_T){"TNS", check_tns}, &(struct Protocol_T){"PGSQL", check_pgsql}, &(struct Protocol_T){"CLAMAV", check_clamav}, &(struct Protocol_T){"SIP", check_sip}, &(struct Protocol_T){"LMTP", check_lmtp}, &(struct Protocol_T){"GPS", check_gps}, &(struct Protocol_T){"RADIUS", check_radius}, &(struct Protocol_T){"MEMCACHE", check_memcache}, &(struct Protocol_T){"WEBSOCKET", check_websocket}, &(struct Protocol_T){"REDIS", check_redis}, &(struct Protocol_T){"MONGODB", check_mongodb}, &(struct Protocol_T){"SIEVE", check_sieve}, &(struct Protocol_T){"SPAMASSASSIN", check_spamassassin}, &(struct Protocol_T){"FAIL2BAN", check_fail2ban}, &(struct Protocol_T){"MQTT", check_mqtt} }; /* ------------------------------------------------------------------ Public */ Protocol_T Protocol_get(Protocol_Type type) { if (type >= sizeof(protocols)/sizeof(protocols[0])) return protocols[0]; return protocols[type]; } monit-5.35.2/src/protocols/ldap2.c0000644000016400001720000001266015007061157013640 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Simple LDAPv2 protocol test. * * Try anonymous bind to the server. * * BindRequest based on RFC1777. Request and response are ASN.1 * BER encoded strings. To make the test as simple as possible * we work with BER encoded data. * * The test checks only if the bind was successful - in the * case of failure it don't provide any erroneous message * analysis. * * @file */ void check_ldap2(Socket_T socket) { unsigned char buf[STRLEN]; unsigned char request[14] = { 0x30, /** Universal Sequence TAG */ 0x0c, /** Length of the packet's data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x00, /** MessageID */ 0x60, /** Application BindRequest TAG */ 0x07, /** Length of the data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x02, /** Protocol version */ 0x04, /** Universal Octet string TAG */ 0x00, /** Octet string length */ /* NULL */ /** Anonymous BindDN */ 0x80, /** Context specific SimpleAuth TAG */ 0x00 /** SimpleAuth (octet string) length */ /* NULL */ /** Anonymous Credentials */ }; unsigned char response[14] = { 0x30, /** Universal Sequence TAG */ 0x0c, /** Length of the packet's data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x00, /** MessageID */ 0x61, /** Application BindResponse TAG */ 0x07, /** Length of the data part */ 0x0a, /** Universal Enumerated TAG */ 0x01, /** Enumerated length */ 0x00, /** Success */ 0x04, /** Universal Octet string TAG */ 0x00, /** Octet string length */ /* NULL */ /** MatchedDN */ 0x04, /** Universal Octet string TAG */ 0x00 /** Octet string length */ /* NULL */ /** ErrorMessage */ }; unsigned char unbind[7] = { 0x30, /** Universal Sequence TAG */ 0x05, /** Length of the packet's data part */ 0x02, /** Universal Integer TAG */ 0x01, /** Integer length */ 0x01, /** MessageID */ 0x42, /** Application UnbindRequest TAG */ 0x00 /** Length of the data part */ /* NULL */ }; assert(socket); if (Socket_write(socket, (unsigned char *)request, sizeof(request)) < 0) THROW(IOException, "LDAP: error sending data -- %s", STRERROR); if (Socket_read(socket, (unsigned char *)buf, sizeof(response)) <= 0) THROW(IOException, "LDAP: error receiving data -- %s", STRERROR); if (memcmp((unsigned char *)buf, (unsigned char *)response, sizeof(response))) THROW(ProtocolException, "LDAP: anonymous bind failed"); if (Socket_write(socket, (unsigned char *)unbind, sizeof(unbind)) < 0) THROW(IOException, "LDAP: error sending data -- %s", STRERROR); } monit-5.35.2/src/protocols/radius.c0000644000016400001720000001332015007061157014117 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * Copyright (C) 2009 Alan DeKok All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #include "md5.h" #include "sha1.h" #include "checksum.h" #include "protocol.h" // libmonit #include "system/Random.h" #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Simple RADIUS test. * * We send a Status-Server packet, and expect an Access-Accept or Accounting-Response packet. * * */ void check_radius(Socket_T socket) { int length, left; int secret_len; Port_T P; md5_context_t ctx; const char *secret; unsigned char *attr; unsigned char digest[16]; unsigned char response[STRLEN]; unsigned char request[38] = { /* Status-Server */ 0x0c, /* Code, we always use zero */ 0x00, /* Packet length */ 0x00, 0x26, /* Request Authenticator */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Message-Authenticator */ 0x50, /* Length */ 0x12, /* Contents of Message-Authenticator */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; assert(socket); P = Socket_getPort(socket); assert(P); secret = P->parameters.radius.secret ? P->parameters.radius.secret : "testing123"; secret_len = (int)strlen(secret); /* get 16 bytes of random data */ Random_bytes(request + 4, 16); /* sign the packet */ Checksum_hmacMD5(request, sizeof(request), (const unsigned char *)secret, secret_len, request + 22); if (Socket_write(socket, (unsigned char *)request, sizeof(request)) < 0) THROW(IOException, "RADIUS: error sending query -- %s", STRERROR); /* the response should have at least 20 bytes */ if ((length = Socket_read(socket, (unsigned char *)response, sizeof(response))) < 20) THROW(IOException, "RADIUS: error receiving response -- %s", STRERROR); /* compare the response code (should be Access-Accept or Accounting-Response) */ if ((response[0] != 2) && (response[0] != 5)) THROW(ProtocolException, "RADIUS: Invalid reply code -- error occurred"); /* compare the packet ID (it should be the same as in our request) */ if (response[1] != 0x00) THROW(ProtocolException, "RADIUS: ID mismatch"); /* check the length */ if (response[2] != 0) THROW(ProtocolException, "RADIUS: message is too long"); /* check length against packet data */ if (response[3] != length) THROW(ProtocolException, "RADIUS: message has invalid length"); /* validate that it is a well-formed packet */ attr = response + 20; left = length - 20; while (left > 0) { if (left < 2) THROW(ProtocolException, "RADIUS: message is malformed"); if (attr[1] < 2) THROW(ProtocolException, "RADIUS: message has invalid attribute length"); if (attr[1] > left) THROW(ProtocolException, "RADIUS: message has attribute that is too long"); /* validate Message-Authenticator, if found */ if (attr[0] == 0x50) { /* FIXME: validate it */ } left -= attr[1]; } /* save the reply authenticator, and copy the request authenticator over */ memcpy(digest, response + 4, 16); memcpy(response + 4, request + 4, 16); md5_init(&ctx); md5_append(&ctx, (const md5_byte_t *)response, length); md5_append(&ctx, (const md5_byte_t *)secret, secret_len); md5_finish(&ctx, response + 4); if (memcmp(digest, response + 4, 16) != 0) Log_info("RADIUS: message fails authentication"); } monit-5.35.2/src/protocols/ssh.c0000644000016400001720000000403015007061157013423 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * A simple 'SSH protocol version exchange' implementation based on RFC (https://www.openssh.com/txt/draft-ietf-secsh-transport-14.txt) * * @file */ void check_ssh(Socket_T socket) { char buf[STRLEN]; assert(socket); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "SSH: error receiving identification string -- %s", STRERROR); if (! Str_startsWith(buf, "SSH-")) THROW(ProtocolException, "SSH: protocol error %s", buf); /* send identification string back to server */ if (Socket_write(socket, buf, strlen(buf)) <= 0) THROW(IOException, "SSH: error sending identification string -- %s", STRERROR); /* Read one extra line to prevent the "Read from socket failed" warning */ Socket_readLine(socket, buf, sizeof(buf)); } monit-5.35.2/src/protocols/postfix_policy.c0000644000016400001720000000512015007061157015702 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * A simple Postfix SMTP access policy delegation protocol test * * To not affect real traffic, we send the following request with * fixed virtual triplet values to the server: * request=smtpd_access_policy * protocol_state=RCPT * protocol_name=SMTP * sender=monit@foo.tld * recipient=monit@foo.tld * client_address=1.2.3.4 * client_name=mx.foo.tld * and check that the server replies with some action. * * @file */ void check_postfix_policy(Socket_T socket) { char buf[STRLEN]; assert(socket); if (Socket_print(socket, "request=smtpd_access_policy\n" "protocol_state=RCPT\n" "protocol_name=SMTP\n" "sender=monit@foo.tld\n" "recipient=monit@foo.tld\n" "client_address=1.2.3.4\n" "client_name=mx.foo.tld\n" "\n") < 0) { THROW(IOException, "POSTFIX-POLICY: error sending data -- %s", STRERROR); } if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "POSTFIX-POLICY: error receiving data -- %s", STRERROR); Str_chomp(buf); if ((strlen(buf) <= 7) || strncasecmp(buf, "action=", 7)) THROW(ProtocolException, "POSTFIX-POLICY error: %s", *buf ? buf : "no action returned"); } monit-5.35.2/src/protocols/ntp3.c0000644000016400001720000000655115007061157013524 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * NTP (Network time procol) version 3 test * * Synchronization request based on RFC1305. * * */ /* ------------------------------------------------------------- Definitions */ #define NTPLEN 48 #define NTP_LEAP_NOWARN 0 /** Leap Indicator: No warning */ #define NTP_LEAP_NOTSYNC 3 /** Leap Indicator: Clock not synchronized */ #define NTP_VERSION 3 /** Version Number: 3 */ #define NTP_MODE_CLIENT 3 /** Mode: Client */ #define NTP_MODE_SERVER 4 /** Mode: Server */ /* ------------------------------------------------------------------ Public */ void check_ntp3(Socket_T socket) { int br; unsigned char ntpRequest[NTPLEN] = {}; char ntpResponse[NTPLEN] = {}; assert(socket); /* Prepare NTP request. The first octet consists of: bits 0-1 ... Leap Indicator bits 2-4 ... Version Number bits 5-7 ... Mode */ ntpRequest[0]= (NTP_LEAP_NOTSYNC << 6) | (NTP_VERSION << 3) | (NTP_MODE_CLIENT); /* Send request to NTP server */ if (Socket_write(socket, ntpRequest, NTPLEN) <= 0) THROW(IOException, "NTP: error sending NTP request -- %s", STRERROR); /* Receive and validate response */ if ((br = Socket_read(socket, ntpResponse, NTPLEN)) <= 0) THROW(IOException, "NTP: did not receive answer from server -- %s", STRERROR); if (br != NTPLEN) THROW(ProtocolException, "NTP: Received %d bytes from server, expected %d bytes", br, NTPLEN); /* Compare NTP response. The first octet consists of: bits 0-1 ... Leap Indicator bits 2-4 ... Version Number bits 5-7 ... Mode */ if ((ntpResponse[0] & 0x07) != NTP_MODE_SERVER) THROW(ProtocolException, "NTP: Server mode error"); if ((ntpResponse[0] & 0x38) != NTP_VERSION << 3) THROW(ProtocolException, "NTP: Server protocol version error"); if ((ntpResponse[0] & 0xc0) == NTP_LEAP_NOTSYNC << 6) THROW(ProtocolException, "NTP: Server not synchronized"); } monit-5.35.2/src/protocols/clamav.c0000644000016400001720000000344515007061157014102 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Send PING and check for PONG. * * @file */ void check_clamav(Socket_T socket) { assert(socket); // Send PING if (Socket_print(socket, "PING\r\n") < 0) THROW(IOException, "CLAMAV: PING command error -- %s", STRERROR); // Read and check PONG char buf[STRLEN]; if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "CLAMAV: PONG read error -- %s", STRERROR); Str_chomp(buf); if (strncasecmp(buf, "PONG", 4) != 0) THROW(ProtocolException, "CLAMAV: invalid PONG response -- %s", buf); } monit-5.35.2/src/protocols/dns.c0000644000016400001720000001177015007061157013423 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Simple DNS test. * * The nameserver is queried for NS record of DNS root. * * @file */ void check_dns(Socket_T socket) { int offset_request = 0; int offset_response = 0; int rc; unsigned char buf[STRLEN]; unsigned char *response = NULL; unsigned char request[19] = { 0x00, /** Request Length field for DNS via TCP */ 0x11, 0x00, /** Transaction ID */ 0x01, 0x01, /** Flags */ 0x00, 0x00, /** Queries count */ 0x01, 0x00, /** Answer resource records count */ 0x00, 0x00, /** Authority resource records count */ 0x00, 0x00, /** Additional resource records count */ 0x00, /** Query: */ 0x00, /** Name: DNS root (empty string) */ 0x00, /** Type: NS */ 0x02, 0x00, /** Class: IN */ 0x01 }; assert(socket); switch (Socket_getType(socket)) { case Socket_Udp: offset_request = 2; /* Skip Length field in request */ offset_response = 0; break; case Socket_Tcp: offset_request = 0; offset_response = 2; /* Skip Length field in response */ break; default: THROW(IOException, "DNS: unsupported socket type -- protocol test skipped"); break; } if (Socket_write(socket, (unsigned char *)request + offset_request, sizeof(request) - offset_request) < 0) THROW(IOException, "DNS: error sending query -- %s", STRERROR); /* Response should have at least 14 bytes */ if (Socket_read(socket, (unsigned char *)buf, 15) <= 14) THROW(IOException, "DNS: error receiving response -- %s", STRERROR); response = buf + offset_response; /* Compare transaction ID (it should be the same as in our request): */ if (response[0] != 0x00 && response[1] != 0x01) THROW(ProtocolException, "DNS: response transaction ID mismatch -- received 0x%x%x, expected 0x1", response[0], response[1]); /* Compare flags: */ /* Response type */ if ((response[2] & 0x80) != 0x80) THROW(ProtocolException, "DNS: invalid response type: 0x%x", response[2] & 0x80); /* Response code: accept request refusal as correct response as the server may disallow NS root query but the negative response means, it reacts to requests */ rc = response[3] & 0x0F; if (rc != 0x0 && rc != 0x5) THROW(ProtocolException, "DNS: invalid response code: 0x%x", rc); /* Compare queries count (it should be one as in our request): */ if (response[4] != 0x00 && response[5] != 0x01) THROW(ProtocolException, "DNS: invalid query count in response -- received 0x%x%x, expected 1", response[4], response[5]); /* Compare answer and authority resource record counts (they shouldn't be both zero) */ if (rc == 0 && response[6] == 0x00 && response[7] == 0x00 && response[8] == 0x00 && response[9] == 0x00) THROW(ProtocolException, "DNS: no answer or authority records returned"); } monit-5.35.2/src/protocols/rdate.c0000644000016400001720000000404715007061157013735 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #include "protocol.h" // libmonit #include "system/Time.h" #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check the server time with three seconds difference tolerance * * This test is based on RFC868 * * @file */ void check_rdate(Socket_T socket) { assert(socket); time_t time; if (Socket_read(socket, (char *)&time, sizeof(time)) <= 0) THROW(IOException, "RDATE: error receiving data -- %s", STRERROR); // Compare system time with the RDATE server time (RDATE starts at 00:00:00 UTC, January 1, 1900 => add offset to 00:00:00 UTC, January 1, 1970) if (llabs((long long)Time_now() + 2208988800LL - (long long)ntohl(time)) > 3LL) THROW(ProtocolException, "RDATE error: time does not match system time"); } monit-5.35.2/src/protocols/mongodb.c0000644000016400001720000001471615007061157014267 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* ----------------------------------------------------------- Definitions */ typedef struct { // header int32_t messageSize; // total message size int32_t messageId; // message id (set by server) int32_t responseToId; // response to id (from the original request) int32_t operation; // operation type // OP_REPLY int32_t flags; // flags long long cursorId; // cursor id int32_t cursorStart; // cursor start int32_t returned; // returned documents count unsigned char *response; // BSON encoded response object } op_reply_t; /* Keep position, don't memory pack! */ /* --------------------------------------------------------------- Private */ static unsigned int B4(unsigned char *b) { unsigned int x; *(((char *)&x) + 0) = b[3]; *(((char *)&x) + 1) = b[2]; *(((char *)&x) + 2) = b[1]; *(((char *)&x) + 3) = b[0]; return ntohl(x); } static void _ping(Socket_T socket) { unsigned char ping[58] = { // Message header 0x3a, 0x00, 0x00, 0x00, // total message size (58 bytes) 0x01, 0x00, 0x00, 0x00, // message id (1) 0xff, 0xff, 0xff, 0xff, // response to id (not used in request) 0xd4, 0x07, 0x00, 0x00, // operation type (OP_QUERY = 2004) // Query 0x00, 0x00, 0x00, 0x00, // flags 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x24, 0x63, 0x6d, 0x64, 0x00, // db.collection C-string ("admin.$cmd") 0x00, 0x00, 0x00, 0x00, // number of documents to skip 0xff, 0xff, 0xff, 0xff, // number of documents to return // BSON encoded PING command: {ping:1} 0x13, 0x00, 0x00, 0x00, // total document length (19 bytes) 0x01, // element type (double = 0x1) 0x70, 0x69, 0x6e, 0x67, 0x00, // element name C-string ("ping") 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, // element value (1) 0x00 // BSON document terminal }; if (Socket_write(socket, (unsigned char *)ping, sizeof(ping)) < 0) THROW(IOException, "MONGODB: ping command error -- %s", STRERROR); } static void _pong(Socket_T socket) { op_reply_t pong; unsigned char buf[STRLEN + 1]; memset(&pong, 0, sizeof(op_reply_t)); if (Socket_read(socket, buf, 16) < 16) // read the header THROW(IOException, "MONGODB: error receiving PING response -- %s", STRERROR); // check response ID: should be 1 (hardcoded in _ping request above) pong.responseToId = B4(buf + 8); if (pong.responseToId != 1) THROW(ProtocolException, "MONGODB: PING response error -- unexpected response id (%d)", pong.responseToId); // check operation type: should be OP_REPLY == 0x1 pong.operation = B4(buf + 12); if (pong.operation != 1) THROW(ProtocolException, "MONGODB: PING response error -- unexpected operation type (0x%x)", pong.operation); // read OP_REPLY pong.messageSize = B4(buf); int len = pong.messageSize - 16 > STRLEN ? STRLEN : pong.messageSize - 16; // Adjust message size for this buffer (minus 16 bytes of header - already read) if (Socket_read(socket, buf, len) != len) THROW(IOException, "MONGODB: error receiving OP_REPLY data -- %s", STRERROR); // check BSON encoded OK response: {ok:1} pong.response = buf + 20; unsigned char ok[17] = { 0x11, 0x00, 0x00, 0x00, // total document length (17 bytes) 0x01, // element type (double = 0x1) 0x6f, 0x6b, 0x00, // element name C-string ("ok") 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, // element value (1) 0x00 // BSON document terminal }; if (memcmp(pong.response, ok, sizeof(ok))) THROW(ProtocolException, "MONGODB: PING response error -- invalid reply"); } /* ---------------------------------------------------------------- Public */ /** * Simple mongoDB ping test. * * 1. send a {ping:1} request to "admin.$cmd" * 2. expect a {ok:1} response * * @see https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/ and https://bsonspec.org/spec.html * * @file */ void check_mongodb(Socket_T socket) { assert(socket); _ping(socket); _pong(socket); } monit-5.35.2/src/protocols/default.c0000644000016400001720000000422015007061157014253 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "system/Net.h" /** * Default service test with no protocol. TCP socket is connection-oriented so we know if it is reachable after the TCP handshake already - the UDP is connection-less so we have to send something to see * if the UDP server is down/unreachable. In such case the remote host should send an ICMP error, we then need to call read to get the ICMP error as a ECONNREFUSED errno. * * @file */ void check_default(Socket_T socket) { assert(socket); if (Socket_getType(socket) == Socket_Udp) { char token[1] = {}; int s = Socket_getSocket(socket); Net_write(s, token, 1, 0); if (Net_read(s, token, 1, 1200) < 0) { switch (errno) { case ECONNREFUSED: THROW(IOException, "%s", STRERROR); break; default: break; } } } } monit-5.35.2/src/protocols/websocket.c0000644000016400001720000001353315007061157014624 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * A WebSocket test. * * https://datatracker.ietf.org/doc/html/rfc6455 * * Establish websocket connection, send ping and close. * * @file */ /* ----------------------------------------------------------------- Private */ static void read_response(Socket_T socket, int opcode) { int n; do { char buf[STRLEN]; // Read frame header if ((n = Socket_read(socket, buf, 2)) != 2) THROW(IOException, "WEBSOCKET: response 0x%x: header read error -- %s", opcode, STRERROR); /* * As we don't know the specific protocol used by this websocket server, the pipeline * may contain some frames sent by server before the response we're waiting for (such * as chat prompt sent by the server on connect) => drain frames until we find what * we need or timeout */ if ((*buf & 0xF) != opcode) { // Skip payload of current frame int payload_size = *(buf + 1) & 0x7F; if ((size_t)payload_size <= sizeof(buf)) { if ((n = Socket_read(socket, buf, payload_size)) != payload_size) THROW(IOException, "WEBSOCKET: response 0x%x: data read error", opcode); } else { /* STRLEN buffer should be sufficient for any frame spuriously sent by * the server. Guard against too large frames. If in real life such * situation will be valid (payload > STRLEN), then fix */ THROW(ProtocolException, "WEBSOCKET: response 0x%x: unexpected payload size: %d", opcode, payload_size); } } else { break; // Found frame with matching opcode } } while (n > 0); } /* ------------------------------------------------------------------ Public */ void check_websocket(Socket_T socket) { assert(socket); Port_T P = Socket_getPort(socket); assert(P); // Establish websocket connection char buf[STRLEN]; if (Socket_print(socket, "GET %s HTTP/1.1\r\n" "Host: %s\r\n" "Upgrade: websocket\r\n" "Connection: Upgrade\r\n" "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\n" "Sec-WebSocket-Version: %d\r\n" "Origin: %s\r\n" "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "\r\n", P->parameters.websocket.request ? P->parameters.websocket.request : "/", P->parameters.websocket.host ? P->parameters.websocket.host : Util_getHTTPHostHeader(socket, buf, sizeof(buf)), P->parameters.websocket.version, P->parameters.websocket.origin ? P->parameters.websocket.origin : "https://mmonit.com") < 0) { THROW(IOException, "WEBSOCKET: error sending data -- %s", STRERROR); } if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "WEBSOCKET: error receiving data -- %s", STRERROR); int status; if (! sscanf(buf, "%*s %d", &status) || (status != 101)) THROW(ProtocolException, "WEBSOCKET: error -- %s", buf); while (Socket_readLine(socket, buf, sizeof(buf)) && ! Str_isEqual(buf, "\r\n")) ; // drop remaining HTTP response headers from the pipeline // Ping unsigned char ping[6] = { 0x89, // Fin:True, Opcode:Ping 0x80, // Mask:True, Payload:0 0x5b, 0x63, 0x68, 0x84 // Key }; if (Socket_write(socket, ping, sizeof(ping)) < 0) THROW(IOException, "WEBSOCKET: error sending ping -- %s", STRERROR); // Pong: verify response opcode is Pong (0xA) read_response(socket, 0xA); // Close request unsigned char close_request[6] = { 0x88, // Fin:True, Opcode:Close 0x80, // Mask:True, Payload:0 0x5b, 0x63, 0x68, 0x84 // Key }; if (Socket_write(socket, close_request, sizeof(close_request)) < 0) THROW(IOException, "WEBSOCKET: error sending close -- %s", STRERROR); // Close response (0x8) read_response(socket, 0x8); } monit-5.35.2/src/protocols/apache_status.c0000644000016400001720000002047715007061157015467 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" #include "base64.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check an Apache server status using the server-status report from mod_status * * @file */ /* ----------------------------------------------------------------- Private */ static void parse_scoreboard(char *scoreboard, Port_T p) { int logging = 0, close = 0, dns = 0, keepalive = 0, reply = 0, request = 0, start = 0, wait = 0, graceful = 0, cleanup = 0, open = 0; for (char *state = scoreboard; *state; state++) { switch (*state) { case 'S': start++; break; case 'R': request++; break; case 'W': reply++; break; case 'K': keepalive++; break; case 'D': dns++; break; case 'C': close++; break; case 'L': logging++; break; case 'G': graceful++; break; case 'I': cleanup++; break; case '_': wait++; break; case '.': open++; break; } } int total = logging + close + dns + keepalive + reply + request + start + wait + graceful + cleanup + open; if (! total) return; // Idle server if (p->parameters.apachestatus.loglimit > 0 && Util_evalQExpression(p->parameters.apachestatus.loglimitOP, (100 * logging / total), p->parameters.apachestatus.loglimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are logging", 100 * logging / total); if (p->parameters.apachestatus.startlimit > 0 && Util_evalQExpression(p->parameters.apachestatus.startlimitOP, (100 * start / total), p->parameters.apachestatus.startlimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are starting", 100 * start / total); if (p->parameters.apachestatus.requestlimit > 0 && Util_evalQExpression(p->parameters.apachestatus.requestlimitOP, (100 * request / total), p->parameters.apachestatus.requestlimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are reading requests", 100 * request / total); if (p->parameters.apachestatus.replylimit > 0 && Util_evalQExpression(p->parameters.apachestatus.replylimitOP, (100 * reply / total), p->parameters.apachestatus.replylimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are sending a reply", 100 * reply / total); if (p->parameters.apachestatus.keepalivelimit > 0 && Util_evalQExpression(p->parameters.apachestatus.keepalivelimitOP, (100 * keepalive / total), p->parameters.apachestatus.keepalivelimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are in keepalive", 100 * keepalive / total); if (p->parameters.apachestatus.dnslimit > 0 && Util_evalQExpression(p->parameters.apachestatus.dnslimitOP, (100 * dns / total), p->parameters.apachestatus.dnslimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are waiting for DNS", 100 * dns / total); if (p->parameters.apachestatus.closelimit > 0 && Util_evalQExpression(p->parameters.apachestatus.closelimitOP, (100 * close / total), p->parameters.apachestatus.closelimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are closing connections", 100 * close / total); if (p->parameters.apachestatus.gracefullimit > 0 && Util_evalQExpression(p->parameters.apachestatus.gracefullimitOP, (100 * graceful / total), p->parameters.apachestatus.gracefullimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are finishing gracefully", 100 * graceful / total); if (p->parameters.apachestatus.cleanuplimit > 0 && Util_evalQExpression(p->parameters.apachestatus.cleanuplimitOP, (100 * cleanup / total), p->parameters.apachestatus.cleanuplimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are in idle cleanup", 100 * cleanup / total); if (p->parameters.apachestatus.waitlimit > 0 && Util_evalQExpression(p->parameters.apachestatus.waitlimitOP, (100 * wait / total), p->parameters.apachestatus.waitlimit)) THROW(ProtocolException, "APACHE-STATUS: error -- %d percent of processes are waiting for a connection", 100 * wait / total); } static void _parseResponseHeaders(Socket_T socket) { int status; char buf[STRLEN]; if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "APACHE-STATUS: error receiving data -- %s", STRERROR); Str_chomp(buf); if (! sscanf(buf, "%*s %d", &status)) THROW(ProtocolException, "APACHE-STATUS: error -- cannot parse HTTP status in response: %s", buf); if (status != 200) THROW(ProtocolException, "APACHE-STATUS: error -- server returned status %d", status); while (Socket_readLine(socket, buf, sizeof(buf))) { if (! strncmp(buf, "\r\n", sizeof(buf))) break; } } /* ------------------------------------------------------------------ Public */ void check_apache_status(Socket_T socket) { assert(socket); char buf[4096]; Port_T p = Socket_getPort(socket); assert(p); char *auth = Util_getBasicAuthHeader(p->parameters.apachestatus.username, p->parameters.apachestatus.password); int rv = Socket_print(socket, "GET %s?auto HTTP/1.1\r\n" "Host: %s\r\n" "Accept: */*\r\n" "User-Agent: Monit/%s\r\n" "Connection: close\r\n" "%s" "\r\n", p->parameters.apachestatus.path ? p->parameters.apachestatus.path : "/server-status", Util_getHTTPHostHeader(socket, buf, sizeof(buf)), VERSION, auth ? auth : ""); FREE(auth); if (rv < 0) THROW(IOException, "APACHE-STATUS: error sending data -- %s", STRERROR); _parseResponseHeaders(socket); while (Socket_readLine(socket, buf, sizeof(buf))) { if (Str_startsWith(buf, "Scoreboard: ")) { char *scoreboard = buf + 12; // skip header parse_scoreboard(scoreboard, p); return; } } THROW(ProtocolException, "APACHE-STATUS: error -- no scoreboard found"); } monit-5.35.2/src/protocols/sieve.c0000644000016400001720000000470115007061157013746 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* --------------------------------------------------------------- Public */ /** * Sieve protocol test. Expect "OK" when connected, send "LOGOUT" to quit. * * @see RFC 5804 * * @file */ void check_sieve(Socket_T socket) { assert(socket); char buf[STRLEN]; do { if (! Socket_readLine(socket, buf, STRLEN)) THROW(IOException, "SIEVE: error receiving server capabilities -- %s", STRERROR); Str_chomp(buf); if (Str_startsWith(buf, "OK")) { if (Socket_print(socket, "LOGOUT\r\n") < 0) THROW(ProtocolException, "SIEVE: error sending LOGOUT command -- %s", STRERROR); if (! Socket_readLine(socket, buf, STRLEN)) THROW(IOException, "SIEVE: error receiving LOGOUT response -- %s", STRERROR); Str_chomp(buf); if (! Str_startsWith(buf, "OK")) THROW(ProtocolException, "SIEVE: invalid LOGOUT response -- %s", buf); return; } } while (true); // Discard all server capabilities until we receive "OK" THROW(ProtocolException, "SIEVE: data error"); } monit-5.35.2/src/protocols/protocol.h0000644000016400001720000000603615007061157014504 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_PROTOCOL_H #define MONIT_PROTOCOL_H #include "config.h" #include "monit.h" /* Protocols supported */ typedef enum { Protocol_DEFAULT = 0, Protocol_HTTP, Protocol_FTP, Protocol_SMTP, Protocol_POP, Protocol_IMAP, Protocol_NNTP, Protocol_SSH, Protocol_DWP, Protocol_LDAP2, Protocol_LDAP3, Protocol_RDATE, Protocol_RSYNC, Protocol_GENERIC, Protocol_APACHESTATUS, Protocol_NTP3, Protocol_MYSQL, Protocol_DNS, Protocol_POSTFIXPOLICY, Protocol_TNS, Protocol_PGSQL, Protocol_CLAMAV, Protocol_SIP, Protocol_LMTP, Protocol_GPS, Protocol_RADIUS, Protocol_MEMCACHE, Protocol_WEBSOCKET, Protocol_REDIS, Protocol_MONGODB, Protocol_SIEVE, Protocol_SPAMASSASSIN, Protocol_FAIL2BAN, Protocol_MQTT } Protocol_Type; void check_apache_status(Socket_T); void check_default(Socket_T); void check_dns(Socket_T); void check_dwp(Socket_T); void check_fail2ban(Socket_T); void check_ftp(Socket_T); void check_generic(Socket_T); void check_http(Socket_T); void check_imap(Socket_T); void check_clamav(Socket_T); void check_ldap2(Socket_T); void check_ldap3(Socket_T); void check_mongodb(Socket_T); void check_mysql(Socket_T); void check_nntp(Socket_T); void check_ntp3(Socket_T); void check_postfix_policy(Socket_T); void check_pop(Socket_T); void check_sieve(Socket_T); void check_smtp(Socket_T); void check_spamassassin(Socket_T); void check_ssh(Socket_T); void check_redis(Socket_T); void check_rdate(Socket_T); void check_rsync(Socket_T); void check_tns(Socket_T); void check_pgsql(Socket_T); void check_sip(Socket_T); void check_lmtp(Socket_T); void check_gps(Socket_T); void check_radius(Socket_T); void check_memcache(Socket_T); void check_mqtt(Socket_T); void check_websocket(Socket_T); /* * Returns a protocol object for the given protocol type */ Protocol_T Protocol_get(Protocol_Type type); #endif monit-5.35.2/src/protocols/http.c0000644000016400001720000003704515007061157013621 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif #include "md5.h" #include "sha1.h" #include "base64.h" #include "checksum.h" #include "protocol.h" #include "httpstatus.h" #include "util/Str.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * A HTTP test. * * We send the following request to the server: * 'GET / HTTP/1.1' ... if request statement isn't defined * 'GET /custom/page HTTP/1.1' ... if request statement is defined * and check the server's status code. * * If the statement defines hostname, it's used in the 'Host:' header otherwise a default (empty) Host header is set. * * If the status code is >= 400, an error has occurred. * * @file */ /* ------------------------------------------------------------- Definitions */ #define BUFSIZE 4096 /* ----------------------------------------------------------------- Private */ static void _contentVerify(Port_T P, const char *data) { if (P->url_request && P->url_request->regex) { bool rv = false; char error[512]; int regex_return = regexec(P->url_request->regex, data, 0, NULL, 0); switch (P->url_request->operator) { case Operator_Equal: if (regex_return == 0) { rv = true; DEBUG("HTTP: Regular expression matches\n"); } else { char errbuf[STRLEN]; regerror(regex_return, NULL, errbuf, sizeof(errbuf)); snprintf(error, sizeof(error), "Regular expression doesn't match: %s", errbuf); } break; case Operator_NotEqual: if (regex_return == 0) { snprintf(error, sizeof(error), "Regular expression matches"); } else { rv = true; DEBUG("HTTP: Regular expression doesn't match\n"); } break; default: snprintf(error, sizeof(error), "Invalid content operator"); break; } if (! rv) THROW(ProtocolException, "HTTP error: %s", error); } } static bool _hasHeader(List_T list, const char *name) { if (list) { for (_list_t h = list->head; h; h = h->next) { char *header = h->e; if (Str_startsWith(header, name)) if (header[strlen(name)] == ':') // Ensure that name is not just a prefix return true; } } return false; } static unsigned int _getChunkSize(Socket_T socket) { char buf[9]; unsigned int wantBytes = 0; if (! Socket_readLine(socket, buf, sizeof(buf))) { THROW(IOException, "HTTP error: failed to read chunk size -- %s", STRERROR); } if (sscanf(buf, "%x", &wantBytes) != 1) { THROW(ProtocolException, "HTTP error: invalid chunk size: %s", buf); } return wantBytes; } static int _readDataFromSocket(Socket_T socket, char *data, int wantBytes) { int readBytes = 0; do { int n = Socket_read(socket, data + readBytes, wantBytes - readBytes); if (n <= 0) { THROW(ProtocolException, "HTTP error: Receiving data -- %s", STRERROR); } readBytes += n; } while (readBytes < wantBytes); if (readBytes != wantBytes) { THROW(ProtocolException, "HTTP error: Content too small -- the server announced %d bytes but just %d bytes were received", wantBytes, readBytes); } return readBytes; } static void _readData(Socket_T socket, Port_T P, char **data, int wantBytes, int *haveBytes, ChecksumContext_T context) { if (P->url_request && P->url_request->regex) { // The content test is required => cache the whole body *data = realloc(*data, *haveBytes + wantBytes + 1); *haveBytes += _readDataFromSocket(socket, *data + *haveBytes, wantBytes); if (P->parameters.http.checksum) Checksum_append(context, *data, wantBytes); *(*data + *haveBytes) = 0; } else { // No content check is required => use small buffer and compute the checksum on the fly *haveBytes = 0; for (int readBytes = (wantBytes < BUFSIZE) ? wantBytes : BUFSIZE; *haveBytes < wantBytes; readBytes = (wantBytes - *haveBytes) < BUFSIZE ? (wantBytes - *haveBytes) : BUFSIZE) { _readDataFromSocket(socket, *data, readBytes); if (P->parameters.http.checksum) Checksum_append(context, *data, readBytes); *haveBytes += readBytes; } } } static void _processBodyChunked(Socket_T socket, Port_T P, char **data, __attribute__ ((unused)) int *contentLength, ChecksumContext_T context) { char crlf[2] = {}; int wantBytes = 0; int haveBytes = 0; while ((wantBytes = _getChunkSize(socket)) && haveBytes < Run.limits.httpContentBuffer) { if (haveBytes + wantBytes > Run.limits.httpContentBuffer) { DEBUG("HTTP: content buffer limit exceeded -- limiting the data to %d\n", Run.limits.httpContentBuffer); wantBytes = Run.limits.httpContentBuffer - haveBytes; } _readData(socket, P, data, wantBytes, &haveBytes, context); // Read the CRLF terminator _readDataFromSocket(socket, crlf, 2); } } static void _processBodyContentLength(Socket_T socket, Port_T P, char **data, int *contentLength, ChecksumContext_T context) { int haveBytes = 0; if (*contentLength < 0) { THROW(ProtocolException, "HTTP error: Missing Content-Length header"); } else if (*contentLength == 0) { THROW(ProtocolException, "HTTP error: No content returned from server"); } else if (*contentLength > (int)Run.limits.httpContentBuffer) { DEBUG("HTTP: content buffer limit exceeded -- limiting the data to %d\n", Run.limits.httpContentBuffer); *contentLength = Run.limits.httpContentBuffer; } _readData(socket, P, data, *contentLength, &haveBytes, context); } static void _processBodyUntilEOF(Socket_T socket, Port_T P, char **data, __attribute__ ((unused)) int *contentLength, ChecksumContext_T context) { int readBytes = 0; if (P->url_request && P->url_request->regex) { // The content test is required => cache the whole body int haveBytes = 0; int wantBytes = STRLEN; while (haveBytes < Run.limits.httpContentBuffer && (readBytes = Socket_read(socket, *data + haveBytes, wantBytes)) > 0) { if (P->parameters.http.checksum) Checksum_append(context, *data + haveBytes, readBytes); haveBytes += readBytes; if (haveBytes + wantBytes > Run.limits.httpContentBuffer) wantBytes = Run.limits.httpContentBuffer - haveBytes; *data = realloc(*data, haveBytes + wantBytes + 1); } *(*data + haveBytes) = 0; } else { // No content check is required => use small buffer and compute the checksum on the fly while ((readBytes = Socket_read(socket, *data, BUFSIZE)) > 0) { if (P->parameters.http.checksum) Checksum_append(context, *data, readBytes); } } if (readBytes < 0) { THROW(ProtocolException, "HTTP error: Receiving data -- %s", STRERROR); } } static void _processStatus(Socket_T socket, Port_T P) { int status; char buf[512] = {}; if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "HTTP: Error receiving data -- %s", STRERROR); Str_chomp(buf); if (! sscanf(buf, "%*s %d", &status)) THROW(ProtocolException, "HTTP error: Cannot parse HTTP status in response: %s", buf); if (! Util_evalQExpression(P->parameters.http.operator, status, P->parameters.http.hasStatus ? P->parameters.http.status : 400)) THROW(ProtocolException, "HTTP error: Server returned status %d", status); } static void _processHeaders(Socket_T socket, void (**processBody)(Socket_T socket, Port_T P, char **data, int *contentLength, ChecksumContext_T context), int *contentLength) { char buf[8193] = {}; *processBody = _processBodyUntilEOF; while (Socket_readLine(socket, buf, sizeof(buf))) { if ((buf[0] == '\r' && buf[1] == '\n') || (buf[0] == '\n')) break; if (strlen(buf) == (sizeof(buf) - 1) && buf[sizeof(buf) - 2] != '\n') THROW(ProtocolException, "HTTP error: response header exceeded maximum size %d", sizeof(buf) - 1); Str_chomp(buf); if (Str_startsWith(buf, "Content-Length")) { if (! sscanf(buf, "%*s%*[: ]%d", contentLength)) THROW(ProtocolException, "HTTP error: Parsing Content-Length response header '%s'", buf); if (*contentLength < 0) THROW(ProtocolException, "HTTP error: Illegal Content-Length response header '%s'", buf); *processBody = _processBodyContentLength; } else if (Str_startsWith(buf, "Transfer-Encoding")) { if (Str_sub(buf, "chunked")) { *processBody = _processBodyChunked; } } } } /** * Check that the server returns a valid HTTP response as well as checksum * or content regex if required * @param s A socket */ static void _checkResponse(Socket_T socket, Port_T P) { int contentLength = -1; void (*processBody)(Socket_T socket, Port_T P, char **data, int *contentLength, ChecksumContext_T context); _processStatus(socket, P); _processHeaders(socket, &processBody, &contentLength); if ((P->url_request && P->url_request->regex) || P->parameters.http.checksum) { if (processBody) { char *data = CALLOC(1, BUFSIZE); struct ChecksumContext_T context; TRY { // Read data if (P->parameters.http.checksum) Checksum_init(&context, P->parameters.http.hashtype); processBody(socket, P, &data, &contentLength, &context); // Perform tests if (P->parameters.http.checksum) Checksum_verify(&context, P->parameters.http.checksum); _contentVerify(P, data); } FINALLY { FREE(data); } END_TRY; } else { THROW(ProtocolException, "HTTP error: unknown transfer encoding"); } } } static char *_getAuthHeader(Port_T P) { if (P->url_request) { URL_T U = P->url_request->url; if (U) return Util_getBasicAuthHeader(U->user, U->password); } return Util_getBasicAuthHeader(P->parameters.http.username, P->parameters.http.password); } static void _sendRequest(Socket_T socket, Port_T P) { char *auth = _getAuthHeader(P); StringBuffer_T sb = StringBuffer_create(168); //FIXME: add decompression support to InputStream and switch here to it + set Accept-Encoding to gzip, so the server can send body compressed (if we test checksum/content) StringBuffer_append(sb, "%s %s HTTP/1.1\r\n" "%s", Httpmethod_Names[P->parameters.http.method], P->parameters.http.request ? P->parameters.http.request : "/", auth ? auth : ""); FREE(auth); // Set default header values unless defined if (! _hasHeader(P->parameters.http.headers, "Host")) StringBuffer_append(sb, "Host: %s\r\n", Util_getHTTPHostHeader(socket, (char[STRLEN]){}, STRLEN)); if (! _hasHeader(P->parameters.http.headers, "User-Agent")) StringBuffer_append(sb, "User-Agent: Monit/%s\r\n", VERSION); if (! _hasHeader(P->parameters.http.headers, "Accept")) StringBuffer_append(sb, "Accept: */*\r\n"); if (! _hasHeader(P->parameters.http.headers, "Accept-Encoding")) StringBuffer_append(sb, "Accept-Encoding: identity\r\n"); // We want no compression if (! _hasHeader(P->parameters.http.headers, "Connection")) StringBuffer_append(sb, "Connection: close\r\n"); // Add headers if we have them if (P->parameters.http.headers) { for (_list_t p = P->parameters.http.headers->head; p; p = p->next) { char *header = p->e; StringBuffer_append(sb, "%s\r\n", header); } } StringBuffer_append(sb, "\r\n"); int send_status = Socket_write(socket, StringBuffer_toString(sb), StringBuffer_length(sb)); StringBuffer_free(&sb); if (send_status < 0) THROW(IOException, "HTTP: error sending data -- %s", STRERROR); } /* ------------------------------------------------------------------ Public */ void check_http(Socket_T socket) { assert(socket); Port_T P = Socket_getPort(socket); assert(P); _sendRequest(socket, P); _checkResponse(socket, P); } monit-5.35.2/src/protocols/nntp.c0000644000016400001720000000415215007061157013612 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check the server for greeting code 200 and then send a QUIT and check for code 205 * * @file */ void check_nntp(Socket_T socket) { int status = 0; char buf[STRLEN]; assert(socket); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "NNTP: error receiving data -- %s", STRERROR); Str_chomp(buf); if (sscanf(buf, "%d %*s", &status) != 1 || status != 200) THROW(ProtocolException, "NNTP error: %s", buf); if (Socket_print(socket, "QUIT\r\n") < 0) THROW(IOException, "NNTP: error sending data -- %s", STRERROR); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "NNTP: error receiving data -- %s", STRERROR); Str_chomp(buf); if (sscanf(buf, "%d %*s", &status) != 1 || status != 205) THROW(ProtocolException, "NNTP error: %s", buf); } monit-5.35.2/src/protocols/spamassassin.c0000644000016400001720000000360515007061157015342 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Send PING and check for PONG. * * @file */ void check_spamassassin(Socket_T socket) { assert(socket); // Send PING if (Socket_print(socket, "PING SPAMC/1.2\r\n") < 0) { THROW(IOException, "SPAMASSASSIN: PING command error -- %s", STRERROR); } // Read and check PONG char buf[STRLEN]; if (! Socket_readLine(socket, buf, sizeof(buf))) { THROW(IOException, "SPAMASSASSIN: PONG read error -- %s", STRERROR); } Str_chomp(buf); if (! Str_startsWith(buf, "SPAMD/") || ! Str_sub(buf, " PONG")) { THROW(ProtocolException, "SPAMASSASSIN: invalid PONG response -- %s", buf); } } monit-5.35.2/src/protocols/smtp.c0000644000016400001720000000366515007061157013626 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "protocol.h" #include "SMTP.h" /* --------------------------------------------------------------- Public */ /** * Check the SMTP server. * * @file */ void check_smtp(Socket_T socket) { assert(socket); SMTP_T smtp = SMTP_new(socket); TRY { Port_T port = Socket_getPort(socket); SMTP_greeting(smtp); SMTP_helo(smtp, "localhost"); if (port->family != Socket_Unix && port->target.net.ssl.options.flags == SSL_StartTLS) SMTP_starttls(smtp, &(port->target.net.ssl.options)); if (port->parameters.smtp.username && port->parameters.smtp.password) SMTP_auth(smtp, port->parameters.smtp.username, port->parameters.smtp.password); SMTP_quit(smtp); } FINALLY { SMTP_free(&smtp); } END_TRY; } monit-5.35.2/src/protocols/pgsql.c0000644000016400001720000005214415007061157013765 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDDEF_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #include "protocol.h" #include "md5.h" #include "sha1.h" #include "checksum.h" // libmonit #include "system/Net.h" #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" #define PGERROR(e) ((e) ? (e->value) : "N/A") /* ----------------------------------------------------------- Definitions */ typedef enum { PostgreSQL_Init, PostgreSQL_Error, PostgreSQL_AuthenticationOk, PostgreSQL_AuthenticationNeeded, PostgreSQL_AuthenticationNeededUnknownType } __attribute__((__packed__)) PostgreSQLState; typedef enum { PostgreSQLPacket_Notification = 'A', PostgreSQLPacket_CommandComplete = 'C', PostgreSQLPacket_Error = 'E', PostgreSQLPacket_CopyIn = 'G', PostgreSQLPacket_CopyOut = 'H', PostgreSQLPacket_EmptyQuery = 'I', PostgreSQLPacket_Notice = 'N', PostgreSQLPacket_Authentication = 'R', //Note: used by the whole Authentication message family PostgreSQLPacket_FunctionCall = 'V', PostgreSQLPacket_CopyBoth = 'W', PostgreSQLPacket_Terminate = 'X', PostgreSQLPacket_PasswordMessage = 'p', //Note: also used for GSSResponse, SASLInitialResponse, SASLResponse PostgreSQLPacket_PortalSuspended = 's' } __attribute__((__packed__)) PostgreSQLPacket; typedef enum { PostgreSQLError_SeverityLocalized = 'S', PostgreSQLError_SeverityNative = 'V', PostgreSQLError_Code = 'C', PostgreSQLError_Message = 'M', PostgreSQLError_Detail = 'D', PostgreSQLError_Hint = 'H', PostgreSQLError_Position = 'P', PostgreSQLError_PositionInternal = 'p', PostgreSQLError_QueryInternal = 'q', PostgreSQLError_Where = 'W', PostgreSQLError_SchemaName = 's', PostgreSQLError_TableName = 't', PostgreSQLError_ColumnName = 'c', PostgreSQLError_DataTypeName = 'd', PostgreSQLError_ConstraintName = 'n', PostgreSQLError_File = 'F', PostgreSQLError_Line = 'L', PostgreSQLError_Routine = 'R' } __attribute__((__packed__)) PostgreSQLError; typedef enum { PostgreSQLAuthentication_Ok = 0, PostgreSQLAuthentication_KerberosV5 = 2, PostgreSQLAuthentication_CleartextPassword = 3, PostgreSQLAuthentication_MD5Password = 5, PostgreSQLAuthentication_SCMCredential = 6, PostgreSQLAuthentication_GSS = 7, PostgreSQLAuthentication_GSSContinue = 8, PostgreSQLAuthentication_SSPI = 9, PostgreSQLAuthentication_SASL = 10, PostgreSQLAuthentication_SASLContinue = 11, PostgreSQLAuthentication_SASLFinal = 12 } PostgreSQLAuthentication; // See StartupMessage at https://www.postgresql.org/docs/current/protocol-message-formats.html typedef struct postgresql_startupmessage_t { uint32_t length; uint32_t protocol_major : 16; uint32_t protocol_minor : 16; char parameters[1024]; } __attribute__((__packed__)) *postgresql_startupmessage_t; // See PasswordMessage at https://www.postgresql.org/docs/current/protocol-message-formats.html typedef struct postgresql_passwordmessage_t { PostgreSQLPacket type; uint32_t length; char data[1024]; } __attribute__((__packed__)) *postgresql_passwordmessage_t; // See Terminate at https://www.postgresql.org/docs/current/protocol-message-formats.html typedef struct postgresql_terminatemessage_t { PostgreSQLPacket type; uint32_t length; } __attribute__((__packed__)) *postgresql_terminatemessage_t; // https://www.postgresql.org/docs/current/protocol-message-formats.html: generic part which is common to all valid responses // Note: we must pack the structure to match the PostgreSQL binary protocol typedef struct postgresql_response_header_t { PostgreSQLPacket type; uint32_t length; } __attribute__((__packed__)) *postgresql_response_header_t; typedef struct postgresql_error_t { PostgreSQLError type; char value[256]; } __attribute__((__packed__)) *postgresql_error_t; typedef struct postgresql_response_authentication_header_t { uint32_t length; } __attribute__((__packed__)) *postgresql_response_authentication_header_t; typedef struct postgresql_response_authentication_t { PostgreSQLAuthentication type; union { struct { char salt[4]; } md5; struct { char data[64]; } generic; } data; } __attribute__((__packed__)) *postgresql_response_authentication_t; typedef struct postgresql_response_t { struct postgresql_response_header_t header; union { char buffer[1024]; struct postgresql_response_authentication_t authentication; } data; } __attribute__((__packed__)) *postgresql_response_t; typedef struct postgresql_t { PostgreSQLState state; Socket_T socket; Port_T port; struct { char salt[4]; void (*callback)(struct postgresql_t *postgresql); } authentication; } *postgresql_t; /* ------------------------------------------------------ Request handlers */ // Compute MD5 hash of the concatenated string static void _getMd5Hash(const char *s1, int s1Length, const char *s2, int s2Length, MD_T result) { MD_T digest; md5_context_t ctx; md5_init(&ctx); md5_append(&ctx, (const md5_byte_t *)s1, s1Length); md5_append(&ctx, (const md5_byte_t *)s2, s2Length); md5_finish(&ctx, (md5_byte_t *)digest); Checksum_digest2Bytes((unsigned char *)digest, 16, result); } // Password message with MD5 hash of username and password with salt per following algorithm: // concat('md5', md5(concat(md5(concat(password, username)), random-salt))) // See: // PasswordMessage at https://www.postgresql.org/docs/current/protocol-message-formats.html // AuthenticationMD5Password at https://www.postgresql.org/docs/current/protocol-flow.html#id-1.10.5.7.3 static void _authenticateMd5(postgresql_t postgresql) { MD_T hash; struct postgresql_passwordmessage_t passwordMessage = { .type = PostgreSQLPacket_PasswordMessage }; int length = sizeof(passwordMessage.length); const char *username = postgresql->port->parameters.postgresql.username ? postgresql->port->parameters.postgresql.username : ""; const char *password = postgresql->port->parameters.postgresql.password ? postgresql->port->parameters.postgresql.password : ""; // Compute the hash of username and password with salt _getMd5Hash(password, (int)strlen(password), username, (int)strlen(username), hash); _getMd5Hash(hash, 32, postgresql->authentication.salt, 4, hash); // Set the password message length += snprintf(passwordMessage.data, sizeof(passwordMessage.data), "md5%s", hash) + 1; // Set the message length passwordMessage.length = htonl(length); // Send the password message if (Socket_write(postgresql->socket, (unsigned char *)&passwordMessage, length + 1) != length + 1) THROW(IOException, "PGSQL: error sending clear text password message -- %s", STRERROR); DEBUG("PGSQL: DEBUG: MD5 authentication message sent\n"); } // See: // PasswordMessage at https://www.postgresql.org/docs/current/protocol-message-formats.html // AuthenticationCleartextPassword at https://www.postgresql.org/docs/current/protocol-flow.html#id-1.10.5.7.3 static void _authenticateClearPassword(postgresql_t postgresql) { struct postgresql_passwordmessage_t passwordMessage = { .type = PostgreSQLPacket_PasswordMessage }; int length = sizeof(passwordMessage.length); // Add clear text password (if set) if (postgresql->port->parameters.postgresql.password) length += snprintf(passwordMessage.data, sizeof(passwordMessage.data), "%s", postgresql->port->parameters.postgresql.password); // Add null terminator length += 1; passwordMessage.length = htonl(length); if (Socket_write(postgresql->socket, (unsigned char *)&passwordMessage, length + 1) != length + 1) THROW(IOException, "PGSQL: error sending clear text password message -- %s", STRERROR); DEBUG("PGSQL: DEBUG: clear password authentication message sent\n"); } // See StartupMessage at https://www.postgresql.org/docs/current/protocol-message-formats.html static void _requestStartup(postgresql_t postgresql) { int length = 0; struct postgresql_startupmessage_t startupMessage = { .protocol_major = htons(3), .protocol_minor = 0 }; // Username: this is the only required parameter length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "user") + 1; if (postgresql->port->parameters.postgresql.username) { length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "%s", postgresql->port->parameters.postgresql.username) + 1; } else { // No username set in the protocol, fallback to 'root' for backward compatibility length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "root") + 1; } // Database: optional, defaults to username if not set if (postgresql->port->parameters.postgresql.database) { length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "database") + 1; length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "%s", postgresql->port->parameters.postgresql.database) + 1; } else if (! postgresql->port->parameters.postgresql.username) { // Backward compatibility: Monit < 5.29.0 did always set user=root and database=root. If the test doesn't specify user nor database, mimick Monit 5.29.0 behaviour length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "database") + 1; length += snprintf(startupMessage.parameters + length, sizeof(startupMessage.parameters) - length, "root") + 1; } length += sizeof(startupMessage.length) + sizeof(uint32_t) + 1; // Add protocol length and the name/value pair NULL terminator startupMessage.length = htonl(length); if (Socket_write(postgresql->socket, (unsigned char *)&startupMessage, length) != length) THROW(IOException, "PGSQL: error sending startup message -- %s", STRERROR); DEBUG("PGSQL: DEBUG: startup message sent\n"); } static void _requestTerminate(postgresql_t postgresql) { struct postgresql_terminatemessage_t terminateMessage = { .type = PostgreSQLPacket_Terminate, .length = htonl(4) }; if (Socket_write(postgresql->socket, (unsigned char *)&terminateMessage, sizeof(struct postgresql_terminatemessage_t)) != sizeof(struct postgresql_terminatemessage_t)) THROW(IOException, "PGSQL: error sending terminate message -- %s", STRERROR); DEBUG("PGSQL: DEBUG: terminate message sent\n"); } /* ----------------------------------------------------- Response handlers */ static void _handleError(postgresql_t postgresql, postgresql_response_t response) { DEBUG("PGSQL: DEBUG: error message received\n"); // Process subset of error messages, that will help to diagnoze the startup message failure (full list: https://www.postgresql.org/docs/current/protocol-error-fields.html) postgresql_error_t errorSeverity = NULL; postgresql_error_t errorCode = NULL; postgresql_error_t errorMessage = NULL; for (postgresql_error_t error = (postgresql_error_t)&(response->data.buffer); error->type != 0; error = (postgresql_error_t)((char *)error + 1 + strlen(error->value) + 1)) { switch (error->type) { case PostgreSQLError_SeverityLocalized: errorSeverity = error; break; case PostgreSQLError_SeverityNative: // Postgresql 9.6 or later errorSeverity = error; break; case PostgreSQLError_Code: errorCode = error; break; case PostgreSQLError_Message: errorMessage = error; break; default: break; } } if (! postgresql->port->parameters.postgresql.username && ! postgresql->port->parameters.postgresql.database) { // Backward compatibility: Monit < 5.29.0 used a hardcoded user and database, hence it interpreted the error as a sign that the server is able to respond (regardless of result). // Monit > 5.29.0 allows to set custom user and database, hence we expect successful response here and will throw error. DEBUG("PGSQL: DEBUG: error message received, but as no custom user or database is set, accept it for backward compatibility with Monit < 5.29.0 -- Severity=%s, Code=%s, Message=%s\n", PGERROR(errorSeverity), PGERROR(errorCode), PGERROR(errorMessage)); } else { THROW(IOException, "PGSQL: startup message error -- Severity=%s, Code=%s, Message=%s", PGERROR(errorSeverity), PGERROR(errorCode), PGERROR(errorMessage)); } postgresql->state = PostgreSQL_Error; } static void _handleAuthentication(postgresql_t postgresql, postgresql_response_t response) { postgresql_response_authentication_t a = &(response->data.authentication); PostgreSQLAuthentication authenticationType = ntohl(a->type); DEBUG("PGSQL: DEBUG: authentication message received, type=%d\n", authenticationType); switch (authenticationType) { case PostgreSQLAuthentication_Ok: DEBUG("PGSQL: DEBUG: authentication OK\n"); postgresql->state = PostgreSQL_AuthenticationOk; break; case PostgreSQLAuthentication_CleartextPassword: DEBUG("PGSQL: DEBUG: clear text password authentication required\n"); postgresql->authentication.callback = _authenticateClearPassword; postgresql->state = PostgreSQL_AuthenticationNeeded; break; case PostgreSQLAuthentication_MD5Password: DEBUG("PGSQL: DEBUG: MD5 password authentication required, salt %.2x%.2x%.2x%.2x\n", a->data.md5.salt[0], a->data.md5.salt[1], a->data.md5.salt[2], a->data.md5.salt[3]); postgresql->state = PostgreSQL_AuthenticationNeeded; memcpy(postgresql->authentication.salt, a->data.md5.salt, sizeof(a->data.md5.salt)); postgresql->authentication.callback = _authenticateMd5; break; default: DEBUG("PGSQL: DEBUG: authentication method type %d not supported, stopping the protocol test here with success (server communicates)\n", authenticationType); postgresql->state = PostgreSQL_AuthenticationNeededUnknownType; break; } } static int _readResponse(postgresql_t postgresql, void *buffer, int length, const char *description, bool eofAllowed) { int rv = Socket_read(postgresql->socket, buffer, length); DEBUG("PGSQL: DEBUG: read %s -- %d bytes received\n", description, rv); if (rv == 0 && eofAllowed) return 0; else if (rv < 0) THROW(IOException, "PGSQL: response %s read error -- %s", description, STRERROR); else if (rv != length) THROW(IOException, "PGSQL: response %s read error -- %d bytes expected, got %d bytes", description, length, rv); return rv; } static void _handleResponse(postgresql_t postgresql) { DEBUG("PGSQL: DEBUG: trying to read response\n"); // PostgreSQL may send several messages in response, for example: // authentication ok message can be immediately followed by error message if the database doesn't exist // if authentication passed and the database exists, the server sends set of ParameterStatus messages with information about the server (version, timezone, encoding, etc.) bool eofAllowed = false; // We need to read at least one message in response int s = Socket_getSocket(postgresql->socket); int timeout = Socket_getTimeout(postgresql->socket); struct postgresql_response_t response = {}; while (Net_canRead(s, timeout) && _readResponse(postgresql, &response, sizeof(struct postgresql_response_header_t), "header", eofAllowed)) { // Read in the response header (packet type and payload length) // Payload length to host order int payloadLength = ntohl(response.header.length); // Subtract the payload part which we read already (the 'length' attribute size) int remainingPayloadLength = payloadLength - sizeof(response.header.length); if (remainingPayloadLength > 0) { // Sanity check (our current limit is 1Kb as we don't implement SQL queries and need only session setup messages) if ((size_t)remainingPayloadLength > sizeof(response.data.buffer)) THROW(IOException, "PGSQL: response message is too large: %d bytes received (maximum %d)", remainingPayloadLength, sizeof(response.data.buffer)); // Read the response payload _readResponse(postgresql, &(response.data.buffer), remainingPayloadLength, "payload", false); } if (response.header.type == PostgreSQLPacket_Error) _handleError(postgresql, &response); else if (response.header.type == PostgreSQLPacket_Authentication) _handleAuthentication(postgresql, &response); else DEBUG("PGSQL: DEBUG: message type '%c' received -- skipping\n", response.header.type); // We need to retry to see if there are more messages in the response, but EOF for header read is also acceptable at this point (server may close the connection if it sends error). eofAllowed = true; // Lower the timeout to 50ms to not block after the last message in the response stream (when session remains open) timeout = 50; } } /* ---------------------------------------------------------------- Public */ /** * PostgreSQL test. * * @file */ void check_pgsql(Socket_T S) { assert(S); struct postgresql_t postgresql = { .state = PostgreSQL_Init, .socket = S, .port = Socket_getPort(S) }; // Send startup message _requestStartup(&postgresql); // Read startup message response _handleResponse(&postgresql); // Handle authentication if needed if (postgresql.state == PostgreSQL_AuthenticationNeeded) { postgresql.authentication.callback(&postgresql); _handleResponse(&postgresql); } // Terminate the session if (postgresql.port->family != Socket_Unix && postgresql.state == PostgreSQL_AuthenticationOk) _requestTerminate(&postgresql); } monit-5.35.2/src/protocols/gps.c0000644000016400001720000000430415007061157013423 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check gpsd (http://www.catb.org/gpsd/) status. * * @file */ void check_gps(Socket_T socket) { char buf[STRLEN]; const char *ok_gps_device = "GPSD,G=GPS"; const char *ok_rtcm104_device = "GPSD,G=RTCM104"; const char *ok_rtcm104v2_device = "GPSD,G=RTCM104v2"; assert(socket); if (Socket_print(socket, "G\r\n") < 0) THROW(IOException, "GPS: error sending data -- %s", STRERROR); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "GPS: error receiving data -- %s", STRERROR); Str_chomp(buf); if (strncasecmp(buf, ok_gps_device, strlen(ok_gps_device)) != 0) if (strncasecmp(buf, ok_rtcm104v2_device, strlen(ok_rtcm104v2_device)) != 0) if (strncasecmp(buf, ok_rtcm104_device, strlen(ok_rtcm104_device)) != 0) THROW(ProtocolException, "GPS error (no device): %s", buf); } monit-5.35.2/src/protocols/pop.c0000644000016400001720000000433115007061157013430 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check the server for greeting code +OK, then send QUIT and check for code +OK * * @file */ void check_pop(Socket_T socket) { assert(socket); char buf[STRLEN]; const char *ok = "+OK"; // Read and check POP greeting if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "POP: greeting read error -- %s", errno ? STRERROR : "no data"); Str_chomp(buf); if (strncasecmp(buf, ok, strlen(ok)) != 0) THROW(ProtocolException, "POP: invalid greeting -- %s", buf); // QUIT and check response if (Socket_print(socket, "QUIT\r\n") < 0) THROW(IOException, "POP: QUIT command error -- %s", STRERROR); if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "POP: QUIT response read error -- %s", errno ? STRERROR : "no data"); Str_chomp(buf); if (strncasecmp(buf, ok, strlen(ok)) != 0) THROW(ProtocolException, "POP: invalid QUIT response -- %s", buf); } monit-5.35.2/src/protocols/imap.c0000644000016400001720000000621015007061157013556 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" #define BYE "* BYE" /** * Check the server for greeting code '* OK' and then send LOGOUT and check for code '* BYE' * * @file */ void check_imap(Socket_T socket) { char buf[512]; int sequence = 1; Port_T port = Socket_getPort(socket); assert(socket); // Read and check IMAP greeting if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "IMAP: greeting read error -- %s", errno ? STRERROR : "no data"); Str_chomp(buf); if (! Str_startsWith(buf, "* OK")) THROW(ProtocolException, "IMAP: invalid greeting -- %s", buf); if (port->family != Socket_Unix && port->target.net.ssl.options.flags == SSL_StartTLS) { // Send STARTTLS command if (Socket_print(socket, "%03d STARTTLS\r\n", sequence++) < 0) THROW(IOException, "IMAP: STARTTLS command error -- %s", STRERROR); // Parse STARTTLS response if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "IMAP: STARTTLS response read error -- %s", errno ? STRERROR : "no data"); Str_chomp(buf); if (! Str_startsWith(buf, "001 OK")) THROW(ProtocolException, "IMAP: invalid logout response: %s", buf); // Switch to TLS Socket_enableSsl(socket, &(Run.ssl), NULL); } // Send LOGOUT command if (Socket_print(socket, "%03d LOGOUT\r\n", sequence++) < 0) THROW(IOException, "IMAP: logout command error -- %s", STRERROR); // Check LOGOUT response if (! Socket_readLine(socket, buf, sizeof(buf))) THROW(IOException, "IMAP: logout response read error -- %s", errno ? STRERROR : "no data"); Str_chomp(buf); if (strncasecmp(buf, BYE, strlen(BYE)) != 0) THROW(ProtocolException, "IMAP: invalid logout response: %s", buf); } monit-5.35.2/src/protocols/ftp.c0000644000016400001720000000427115007061157013426 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #include "protocol.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /** * Check the server for greeting code 220 and then send a QUIT and check for code 221 * * @file */ void check_ftp(Socket_T socket) { int status; char buf[STRLEN]; assert(socket); do { if (! Socket_readLine(socket, buf, STRLEN)) THROW(IOException, "FTP: error receiving data -- %s", STRERROR); Str_chomp(buf); } while (buf[3] == '-'); // Discard multi-line response if (sscanf(buf, "%d", &status) != 1 || status != 220) THROW(ProtocolException, "FTP greeting error: %s", buf); if (Socket_print(socket, "QUIT\r\n") < 0) THROW(IOException, "FTP: error sending data -- %s", STRERROR); if (! Socket_readLine(socket, buf, STRLEN)) THROW(IOException, "FTP: error receiving data -- %s", STRERROR); Str_chomp(buf); if (sscanf(buf, "%d", &status) != 1 || status != 221) THROW(ProtocolException, "FTP quit error: %s", buf); } monit-5.35.2/src/process/0000755000016400001720000000000015007061157012177 500000000000000monit-5.35.2/src/process/sysdep_AIX.c0000644000016400001720000002720215007061157014276 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "monit.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_PROCINFO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_PROC_H #include #endif #ifdef HAVE_SYS_PROCFS_H #include #endif #ifdef HAVE_CF_H #include #endif #ifdef HAVE_SYS_CFGODM_H #include #endif #ifdef HAVE_SYS_CFGDB_H #include #endif #ifdef HAVE_SYS_SYSTEMCFG_H #include #endif #ifdef HAVE_SYS_PROC_H #include #endif #ifdef HAVE_SYS_PROTOSW_H #include #endif #ifdef HAVE_LIBPERFSTAT_H #include #endif #ifdef HAVE_UTMPX_H #include #endif #include "ProcessTree.h" #include "process_sysdep.h" /** * System dependent resource data collecting code for AIX * * @file */ int getprocs64(void *, int, void *, int, pid_t *, int); int getargs(struct procentry64 *processBuffer, int bufferLen, char *argsBuffer, int argsLen); static int page_size; static int cpu_initialized = 0; static unsigned long long cpu_total_old = 0ULL; static unsigned long long cpu_user_old = 0ULL; static unsigned long long cpu_syst_old = 0ULL; static unsigned long long cpu_iowait_old = 0ULL; bool init_systeminfo_sysdep(void) { perfstat_memory_total_t mem; if (perfstat_memory_total(NULL, &mem, sizeof(perfstat_memory_total_t), 1) < 1) { Log_error("system statistic error -- perfstat_memory_total failed: %s\n", STRERROR); return false; } page_size = getpagesize(); System_Info.memory.size = (unsigned long long)mem.real_total * (unsigned long long)page_size; System_Info.cpu.count = sysconf(_SC_NPROCESSORS_ONLN); setutxent(); struct utmpx _booted = {.ut_type = BOOT_TIME}; struct utmpx *booted = getutxid(&_booted); if (booted) System_Info.booted = booted->ut_tv.tv_sec; endutxent(); return true; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep (double *loadv, int nelem) { perfstat_cpu_total_t cpu; if (perfstat_cpu_total(NULL, &cpu, sizeof(perfstat_cpu_total_t), 1) < 1) { Log_error("system statistic error -- perfstat_cpu_total failed: %s\n", STRERROR); return -1; } switch (nelem) { case 3: loadv[2] = (double)cpu.loadavg[2] / (double)(1 << SBITS); case 2: loadv[1] = (double)cpu.loadavg[1] / (double)(1 << SBITS); case 1: loadv[0] = (double)cpu.loadavg[0] / (double)(1 << SBITS); } return 0; } /** * Read all processes to initialize the process tree * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0. */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { int treesize; pid_t firstproc = 0; if ((treesize = getprocs64(NULL, 0, NULL, 0, &firstproc, PID_MAX)) < 0) { Log_error("system statistic error -- getprocs64 failed: %s\n", STRERROR); return 0; } struct procentry64 *procs = CALLOC(sizeof(struct procentry64), treesize); firstproc = 0; if ((treesize = getprocs64(procs, sizeof(struct procentry64), NULL, 0, &firstproc, treesize)) < 0) { FREE(procs); Log_error("system statistic error -- getprocs64 failed: %s\n", STRERROR); return 0; } unsigned long long now = Time_milli(); ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), treesize); for (int i = 0; i < treesize; i++) { pt[i].pid = procs[i].pi_pid; pt[i].ppid = procs[i].pi_ppid; pt[i].cred.euid = procs[i].pi_uid; pt[i].threads.self = procs[i].pi_thcount; pt[i].uptime = System_Info.time / 10. - procs[i].pi_start; pt[i].memory.usage = (unsigned long long)(procs[i].pi_drss + procs[i].pi_trss) * (unsigned long long)page_size; pt[i].cpu.time = procs[i].pi_ru.ru_utime.tv_sec * 10 + (double)procs[i].pi_ru.ru_utime.tv_usec / 100000. + procs[i].pi_ru.ru_stime.tv_sec * 10 + (double)procs[i].pi_ru.ru_stime.tv_usec / 100000.; pt[i].read.bytes = -1; pt[i].read.bytesPhysical = -1; pt[i].read.operations = procs[i].pi_ru.ru_inblock; pt[i].read.time = now; pt[i].write.bytes = -1; pt[i].write.bytesPhysical = -1; pt[i].write.operations = procs[i].pi_ru.ru_oublock; pt[i].write.time = now; pt[i].zombie = procs[i].pi_state == SZOMB ? true: false; char filename[STRLEN]; snprintf(filename, sizeof(filename), "/proc/%d/psinfo", pt[i].pid); int fd = open(filename, O_RDONLY); if (fd < 0) { DEBUG("Cannot open proc file %s -- %s\n", filename, STRERROR); continue; } struct psinfo ps; if (read(fd, &ps, sizeof(ps)) < 0) { DEBUG("Cannot read proc file %s -- %s\n", filename, STRERROR); if (close(fd) < 0) Log_error("Socket close failed -- %s\n", STRERROR); continue; } if (close(fd) < 0) Log_error("Socket close failed -- %s\n", STRERROR); pt[i].cred.uid = ps.pr_uid; pt[i].cred.gid = ps.pr_gid; if (pflags & ProcessEngine_CollectCommandLine) { if (ps.pr_argc == 0) { pt[i].cmdline = Str_dup(procs[i].pi_comm); // Kernel thread } else { char command[8192]; if (! getargs(&procs[i], sizeof(struct procentry64), command, sizeof(command))) { // The arguments are separated with '\0' with the last one terminated by '\0\0' -> merge arguments into one string for (int i = 0; i < sizeof(command) - 1; i++) { if (command[i] == '\0') { if (command[i + 1] == '\0') break; command[i] = ' '; } } pt[i].cmdline = Str_dup(command); } else { pt[i].cmdline = Str_dup(procs[i].pi_comm); } } } } FREE(procs); *reference = pt; return treesize; } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { perfstat_memory_total_t mem; /* Memory */ if (perfstat_memory_total(NULL, &mem, sizeof(perfstat_memory_total_t), 1) < 1) { Log_error("system statistic error -- perfstat_memory_total failed: %s\n", STRERROR); return false; } si->memory.usage.bytes = (unsigned long long)(mem.real_total - mem.real_free - mem.numperm) * (unsigned long long)page_size; /* Swap */ si->swap.size = (unsigned long long)mem.pgsp_total * 4096; /* 4kB blocks */ si->swap.usage.bytes = (unsigned long long)(mem.pgsp_total - mem.pgsp_free) * 4096; /* 4kB blocks */ return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed (or not available) */ bool used_system_cpu_sysdep(SystemInfo_T *si) { perfstat_cpu_total_t cpu; unsigned long long cpu_total; unsigned long long cpu_total_new = 0ULL; unsigned long long cpu_user = 0ULL; unsigned long long cpu_syst = 0ULL; unsigned long long cpu_iowait = 0ULL; if (perfstat_cpu_total(NULL, &cpu, sizeof(perfstat_cpu_total_t), 1) < 0) { Log_error("system statistic error -- perfstat_cpu_total failed: %s\n", STRERROR); return -1; } cpu_total_new = (cpu.user + cpu.sys + cpu.wait + cpu.idle) / cpu.ncpus; cpu_total = cpu_total_new - cpu_total_old; cpu_total_old = cpu_total_new; cpu_user = cpu.user / cpu.ncpus; cpu_syst = cpu.sys / cpu.ncpus; cpu_iowait = cpu.wait / cpu.ncpus; if (cpu_initialized) { if (cpu_total > 0) { si->cpu.usage.user = 100. * ((double)(cpu_user - cpu_user_old) / (double)cpu_total); si->cpu.usage.system = 100. * ((double)(cpu_syst - cpu_syst_old) / (double)cpu_total); si->cpu.usage.iowait = 100. * ((double)(cpu_iowait - cpu_iowait_old) / (double)cpu_total); } else { si->cpu.usage.user = 0.; si->cpu.usage.system = 0.; si->cpu.usage.iowait = 0.; } } cpu_user_old = cpu_user; cpu_syst_old = cpu_syst; cpu_iowait_old = cpu_iowait; cpu_initialized = 1; return true; } bool used_system_filedescriptors_sysdep(SystemInfo_T *si) { // Not implemented return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuIOWait; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/process/sysdep_FREEBSD.c0000644000016400001720000003060115007061157014724 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_KVM_H #include #endif #ifdef HAVE_PATHS_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_PROC_H #include #endif #ifdef HAVE_SYS_USER_H #include #endif #ifdef HAVE_SYS_VMMETER_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_SYS_DKSTAT_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" /** * System dependent resource data collecting code for FreeBSD. * * @file */ /* ----------------------------------------------------------------- Private */ static int pagesize; static long total_old = 0; static long cpu_user_old = 0; static long cpu_nice_old = 0; static long cpu_syst_old = 0; static long cpu_intr_old = 0; /* ------------------------------------------------------------------ Public */ bool init_systeminfo_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(System_Info.cpu.count); if (sysctl(mib, 2, &System_Info.cpu.count, &len, NULL, 0) == -1) { DEBUG("system statistics error -- cannot get cpu count: %s\n", STRERROR); return false; } mib[1] = HW_PHYSMEM; len = sizeof(System_Info.memory.size); if (sysctl(mib, 2, &System_Info.memory.size, &len, NULL, 0) == -1) { DEBUG("system statistics error -- cannot get real memory amount: %s\n", STRERROR); return false; } mib[1] = HW_PAGESIZE; len = sizeof(pagesize); if (sysctl(mib, 2, &pagesize, &len, NULL, 0) == -1) { DEBUG("system statistics error -- cannot get memory page size: %s\n", STRERROR); return false; } struct timeval booted; size_t size = sizeof(booted); if (sysctlbyname("kern.boottime", &booted, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.boottime failed: %s\n", STRERROR); return false; } else { System_Info.booted = booted.tv_sec; } return true; } /** * Read all processes to initialize the information tree. * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0. */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { char errbuf[_POSIX2_LINE_MAX]; kvm_t *kvm_handle = kvm_openfiles(NULL, _PATH_DEVNULL, NULL, O_RDONLY, errbuf); if (! kvm_handle) { Log_error("system statistics error -- cannot initialize kvm interface\n"); return 0; } int treesize; struct kinfo_proc *pinfo = kvm_getprocs(kvm_handle, KERN_PROC_PROC, 0, &treesize); if (! pinfo || (treesize < 1)) { Log_error("system statistics error -- kvm_getprocs: %s\n", kvm_geterr(kvm_handle)); kvm_close(kvm_handle); return 0; } unsigned long long now = Time_milli(); ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), treesize); StringBuffer_T cmdline = NULL; if (pflags & ProcessEngine_CollectCommandLine) cmdline = StringBuffer_create(64); for (int i = 0; i < treesize; i++) { pt[i].pid = pinfo[i].ki_pid; pt[i].ppid = pinfo[i].ki_ppid; pt[i].cred.uid = pinfo[i].ki_ruid; pt[i].cred.euid = pinfo[i].ki_uid; pt[i].cred.gid = pinfo[i].ki_rgid; pt[i].threads.self = pinfo[i].ki_numthreads; pt[i].uptime = System_Info.time / 10. - pinfo[i].ki_start.tv_sec; pt[i].cpu.time = (double)pinfo[i].ki_runtime / 100000.; pt[i].memory.usage = (uint64_t)pinfo[i].ki_rssize * (uint64_t)pagesize; pt[i].read.bytes = -1; pt[i].read.bytesPhysical = -1; pt[i].read.operations = pinfo[i].ki_rusage.ru_inblock; pt[i].write.bytes = -1; pt[i].write.bytesPhysical = -1; pt[i].write.operations = pinfo[i].ki_rusage.ru_oublock; pt[i].read.time = pt[i].write.time = now; pt[i].zombie = pinfo[i].ki_stat == SZOMB ? true : false; if (pflags & ProcessEngine_CollectCommandLine) { char **args = kvm_getargv(kvm_handle, &pinfo[i], 0); if (args) { StringBuffer_clear(cmdline); for (int j = 0; args[j]; j++) StringBuffer_append(cmdline, args[j + 1] ? "%s " : "%s", args[j]); if (StringBuffer_length(cmdline)) pt[i].cmdline = Str_dup(StringBuffer_toString(StringBuffer_trim(cmdline))); } if (STR_UNDEF(pt[i].cmdline)) { FREE(pt[i].cmdline); pt[i].cmdline = Str_dup(pinfo[i].ki_comm); } } } if (pflags & ProcessEngine_CollectCommandLine) StringBuffer_free(&cmdline); *reference = pt; kvm_close(kvm_handle); return treesize; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep(double *loadv, int nelem) { return getloadavg(loadv, nelem); } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { /* Memory */ size_t len = sizeof(unsigned int); unsigned int active; if (sysctlbyname("vm.stats.vm.v_active_count", &active, &len, NULL, 0) == -1) { Log_error("system statistics error -- cannot get active memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { Log_error("system statistics error -- active memory usage statics error\n"); return false; } unsigned int wired; if (sysctlbyname("vm.stats.vm.v_wire_count", &wired, &len, NULL, 0) == -1) { Log_error("system statistics error -- cannot get wired memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { Log_error("system statistics error -- wired memory usage statics error\n"); return false; } unsigned long long arcsize = 0ULL; len = sizeof(arcsize); if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arcsize, &len, NULL, 0) == 0) { if (len != sizeof(arcsize)) { Log_error("system statistics error -- ZFS ARC memory usage statics error\n"); return false; } } si->memory.usage.bytes = (unsigned long long)(active + wired) * (unsigned long long)pagesize - arcsize; /* Swap */ int mib[16] = {}; unsigned long long total = 0ULL; unsigned long long used = 0ULL; size_t miblen = sizeof(mib) / sizeof(mib[0]); if (sysctlnametomib("vm.swap_info", mib, &miblen) == -1) { Log_error("system statistics error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0ULL; return false; } int n = 0; while (true) { struct xswdev xsw; mib[miblen] = n; len = sizeof(struct xswdev); if (sysctl(mib, miblen + 1, &xsw, &len, NULL, 0) == -1) break; if (xsw.xsw_version != XSWDEV_VERSION) { Log_error("system statistics error -- cannot get swap usage: xswdev version mismatch\n"); si->swap.size = 0ULL; return false; } total += xsw.xsw_nblks; used += xsw.xsw_used; n++; } si->swap.size = (unsigned long long)total * (unsigned long long)pagesize; si->swap.usage.bytes = (unsigned long long)used * (unsigned long long)pagesize; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ bool used_system_cpu_sysdep(SystemInfo_T *si) { int mib[2]; long cp_time[CPUSTATES]; long total_new = 0; long total; size_t len; len = sizeof(mib); if (sysctlnametomib("kern.cp_time", mib, &len) == -1) { Log_error("system statistics error -- cannot get cpu time handler: %s\n", STRERROR); return false; } len = sizeof(cp_time); if (sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1) { Log_error("system statistics error -- cannot get cpu time: %s\n", STRERROR); return false; } for (int i = 0; i < CPUSTATES; i++) total_new += cp_time[i]; total = total_new - total_old; total_old = total_new; si->cpu.usage.user = (total > 0) ? (100. * (double)(cp_time[CP_USER] - cpu_user_old) / total) : -1.; si->cpu.usage.nice = (total > 0) ? (100. * (double)(cp_time[CP_NICE] - cpu_nice_old) / total) : -1.; si->cpu.usage.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.hardirq = (total > 0) ? (100. * (double)(cp_time[CP_INTR] - cpu_intr_old) / total) : -1.; cpu_user_old = cp_time[CP_USER]; cpu_nice_old = cp_time[CP_NICE]; cpu_syst_old = cp_time[CP_SYS]; cpu_intr_old = cp_time[CP_INTR]; return true; } bool used_system_filedescriptors_sysdep(SystemInfo_T *si) { // Open files size_t len = sizeof(si->filedescriptors.allocated); if (sysctlbyname("kern.openfiles", &si->filedescriptors.allocated, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.openfiles failed: %s\n", STRERROR); return false; } // Max files int mib[2] = {CTL_KERN, KERN_MAXFILES}; len = sizeof(si->filedescriptors.maximum); if (sysctl(mib, 2, &si->filedescriptors.maximum, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.maxfiles failed: %s\n", STRERROR); return false; } return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuNice | Statistics_CpuHardIRQ | Statistics_FiledescriptorsPerSystem; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/process/sysdep_DARWIN.c0000644000016400001720000003652415007061157014650 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_MACH_MACH_H #include #endif #ifdef HAVE_LIBPROC_H #include #endif #ifdef HAVE_COREFOUNDATION_COREFOUNDATION_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" /** * System dependent resource data collecting code for MacOS X. * * @file */ #define ARGSSIZE 8192 /* ----------------------------------------------------------------- Private */ static int pagesize; static long total_old = 0; static long cpu_user_old = 0; static long cpu_nice_old = 0; static long cpu_syst_old = 0; void static _setOSInfo(void) { #ifdef HAVE_COREFOUNDATION_COREFOUNDATION_H CFURLRef url = CFURLCreateWithFileSystemPath(NULL, CFSTR("/System/Library/CoreServices/SystemVersion.plist"), kCFURLPOSIXPathStyle, false); if (url) { CFReadStreamRef stream = CFReadStreamCreateWithFile(NULL, url); if (stream) { if (CFReadStreamOpen(stream)) { CFPropertyListRef propertyList = CFPropertyListCreateWithStream(NULL, stream, 0, kCFPropertyListImmutable, NULL, NULL); if (propertyList) { CFStringRef value = CFDictionaryGetValue(propertyList, CFSTR("ProductName")); if (value) { CFStringGetCString(value, System_Info.uname.sysname, sizeof(System_Info.uname.sysname), CFStringGetSystemEncoding()); } value = CFDictionaryGetValue(propertyList, CFSTR("ProductVersion")); if (value) { CFStringGetCString(value, System_Info.uname.release, sizeof(System_Info.uname.release), CFStringGetSystemEncoding()); } CFRelease(propertyList); } CFReadStreamClose(stream); } CFRelease(stream); } CFRelease(url); } #endif } /* ------------------------------------------------------------------ Public */ bool init_systeminfo_sysdep(void) { _setOSInfo(); size_t size = sizeof(System_Info.cpu.count); if (sysctlbyname("hw.logicalcpu", &System_Info.cpu.count, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl hw.logicalcpu failed: %s\n", STRERROR); return false; } size = sizeof(System_Info.memory.size); if (sysctlbyname("hw.memsize", &System_Info.memory.size, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl hw.memsize failed: %s\n", STRERROR); return false; } size = sizeof(pagesize); if (sysctlbyname("hw.pagesize", &pagesize, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl hw.pagesize failed: %s\n", STRERROR); return false; } size = sizeof(System_Info.argmax); if (sysctlbyname("kern.argmax", &System_Info.argmax, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.argmax failed: %s\n", STRERROR); return false; } struct timeval booted; size = sizeof(booted); if (sysctlbyname("kern.boottime", &booted, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.boottime failed: %s\n", STRERROR); return false; } else { System_Info.booted = booted.tv_sec; } return true; } /** * Read all processes to initialize the information tree. * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0 */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { size_t pinfo_size = 0; int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0}; if (sysctl(mib, 4, NULL, &pinfo_size, NULL, 0) < 0) { Log_error("system statistic error -- sysctl failed: %s\n", STRERROR); return 0; } struct kinfo_proc *pinfo = CALLOC(1, pinfo_size); if (sysctl(mib, 4, pinfo, &pinfo_size, NULL, 0)) { FREE(pinfo); Log_error("system statistic error -- sysctl failed: %s\n", STRERROR); return 0; } size_t treesize = pinfo_size / sizeof(struct kinfo_proc); ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), treesize); char *args = NULL; StringBuffer_T cmdline = NULL; if (pflags & ProcessEngine_CollectCommandLine) { cmdline = StringBuffer_create(64); args = CALLOC(1, System_Info.argmax + 1); } for (size_t i = 0; i < treesize; i++) { pt[i].uptime = System_Info.time / 10. - pinfo[i].kp_proc.p_starttime.tv_sec; pt[i].zombie = pinfo[i].kp_proc.p_stat == SZOMB ? true : false; pt[i].pid = pinfo[i].kp_proc.p_pid; pt[i].ppid = pinfo[i].kp_eproc.e_ppid; pt[i].cred.uid = pinfo[i].kp_eproc.e_pcred.p_ruid; pt[i].cred.euid = pinfo[i].kp_eproc.e_ucred.cr_uid; pt[i].cred.gid = pinfo[i].kp_eproc.e_pcred.p_rgid; if (pflags & ProcessEngine_CollectCommandLine) { size_t size = System_Info.argmax; mib[0] = CTL_KERN; mib[1] = KERN_PROCARGS2; mib[2] = pt[i].pid; if (sysctl(mib, 3, args, &size, NULL, 0) != -1) { /* KERN_PROCARGS2 sysctl() returns following pseudo structure: * struct { * int argc * char execname[]; * char argv[argc][]; * char env[][]; * } * The strings are terminated with '\0' and may have variable '\0' padding */ int argc = *args; char *p = args + sizeof(int); // arguments beginning StringBuffer_clear(cmdline); p += strlen(p); // skip exename while (argc > 0 && p < args + System_Info.argmax) { if (*p == 0) { // skip terminating 0 and variable length 0 padding p++; continue; } StringBuffer_append(cmdline, argc-- ? "%s " : "%s", p); p += strlen(p); } if (StringBuffer_length(cmdline)) pt[i].cmdline = Str_dup(StringBuffer_toString(StringBuffer_trim(cmdline))); } if (STR_UNDEF(pt[i].cmdline)) { char cmdpath[PROC_PIDPATHINFO_MAXSIZE] = {}; FREE(pt[i].cmdline); if (proc_pidpath(pt[i].pid, cmdpath, sizeof(cmdpath)) > 0) { pt[i].cmdline = Str_dup(cmdpath); } else { pt[i].cmdline = Str_dup(pinfo[i].kp_proc.p_comm); } } } if (! pt[i].zombie) { // CPU, memory, threads struct proc_taskinfo tinfo; int rv = proc_pidinfo(pt[i].pid, PROC_PIDTASKINFO, 0, &tinfo, sizeof(tinfo)); // If the process is zombie, skip this if (rv <= 0) { if (errno != EPERM) DEBUG("proc_pidinfo for pid %d failed -- %s\n", pt[i].pid, STRERROR); } else if ((unsigned long)rv < sizeof(tinfo)) { Log_error("proc_pidinfo for pid %d -- invalid result size\n", pt[i].pid); } else { pt[i].memory.usage = (unsigned long long)tinfo.pti_resident_size; pt[i].cpu.time = (double)(tinfo.pti_total_user + tinfo.pti_total_system) / 100000000.; // The time is in nanoseconds, we store it as 1/10s pt[i].threads.self = tinfo.pti_threadnum; } #ifdef rusage_info_current // Disk IO rusage_info_current rusage; if (proc_pid_rusage(pt[i].pid, RUSAGE_INFO_CURRENT, (rusage_info_t *)&rusage) < 0) { if (errno != EPERM) DEBUG("proc_pid_rusage for pid %d failed -- %s\n", pt[i].pid, STRERROR); } else { pt[i].read.time = pt[i].write.time = Time_milli(); pt[i].read.bytes = -1; pt[i].read.bytesPhysical = rusage.ri_diskio_bytesread; pt[i].read.operations = -1; pt[i].write.bytes = -1; pt[i].write.bytesPhysical = rusage.ri_diskio_byteswritten; pt[i].write.operations = -1; } #endif } } if (pflags & ProcessEngine_CollectCommandLine) { StringBuffer_free(&cmdline); FREE(args); } FREE(pinfo); *reference = pt; return (int)treesize; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep (double *loadv, int nelem) { return getloadavg(loadv, nelem); } /** * This routine returns real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { /* Memory */ vm_statistics_data_t page_info; mach_msg_type_number_t count = HOST_VM_INFO_COUNT; kern_return_t kret = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&page_info, &count); if (kret != KERN_SUCCESS) { DEBUG("system statistic error -- cannot get memory usage\n"); return false; } si->memory.usage.bytes = (unsigned long long)(page_info.wire_count + page_info.active_count) * (unsigned long long)pagesize; /* Swap */ int mib[2] = {CTL_VM, VM_SWAPUSAGE}; size_t len = sizeof(struct xsw_usage); struct xsw_usage swap; if (sysctl(mib, 2, &swap, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0ULL; return false; } si->swap.size = (unsigned long long)swap.xsu_total; si->swap.usage.bytes = (unsigned long long)swap.xsu_used; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ bool used_system_cpu_sysdep(SystemInfo_T *si) { long total; long total_new = 0; kern_return_t kret; host_cpu_load_info_data_t cpu_info; mach_msg_type_number_t count; count = HOST_CPU_LOAD_INFO_COUNT; kret = host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO, (host_info_t)&cpu_info, &count); if (kret == KERN_SUCCESS) { for (int i = 0; i < CPU_STATE_MAX; i++) total_new += cpu_info.cpu_ticks[i]; total = total_new - total_old; total_old = total_new; si->cpu.usage.user = (total > 0) ? (100. * (double)(cpu_info.cpu_ticks[CPU_STATE_USER] - cpu_user_old) / total) : -1.; si->cpu.usage.nice = (total > 0) ? (100. * (double)(cpu_info.cpu_ticks[CPU_STATE_NICE] - cpu_nice_old) / total) : -1.; si->cpu.usage.system = (total > 0) ? (100. * (double)(cpu_info.cpu_ticks[CPU_STATE_SYSTEM] - cpu_syst_old) / total) : -1.; cpu_user_old = cpu_info.cpu_ticks[CPU_STATE_USER]; cpu_nice_old = cpu_info.cpu_ticks[CPU_STATE_NICE]; cpu_syst_old = cpu_info.cpu_ticks[CPU_STATE_SYSTEM]; return true; } return false; } bool used_system_filedescriptors_sysdep(__attribute__ ((unused)) SystemInfo_T *si) { // Open files size_t len = sizeof(si->filedescriptors.allocated); if (sysctlbyname("kern.num_files", &si->filedescriptors.allocated, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.openfiles failed: %s\n", STRERROR); return false; } // Max files int mib[2] = {CTL_KERN, KERN_MAXFILES}; len = sizeof(si->filedescriptors.maximum); if (sysctl(mib, 2, &si->filedescriptors.maximum, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.maxfiles failed: %s\n", STRERROR); return false; } return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuNice | Statistics_FiledescriptorsPerSystem; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/process/sysdep_NETBSD.c0000644000016400001720000002465315007061157014643 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_PROC_H #include #endif #ifdef HAVE_KVM_H #include #endif #ifdef HAVE_UVM_UVM_H #include #endif #ifdef HAVE_UVM_UVM_EXTERN_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_SYS_DKSTAT_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" /** * System dependent resource data collecting code for NetBSD. * * @file */ /* ----------------------------------------------------------------- Private */ static int pagesize; static long total_old = 0; static long cpu_user_old = 0; static long cpu_nice_old = 0; static long cpu_syst_old = 0; static long cpu_intr_old = 0; static unsigned int maxslp; /* ------------------------------------------------------------------ Public */ bool init_systeminfo_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(System_Info.cpu.count); if (sysctl(mib, 2, &System_Info.cpu.count, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); return false; } mib[1] = HW_PHYSMEM; len = sizeof(System_Info.memory.size); if (sysctl(mib, 2, &System_Info.memory.size, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get real memory amount: %s\n", STRERROR); return false; } mib[1] = HW_PAGESIZE; len = sizeof(pagesize); if (sysctl(mib, 2, &pagesize, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get memory page size: %s\n", STRERROR); return false; } struct timeval booted; mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; len = sizeof(booted); if (sysctl(mib, 2, &booted, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.boottime failed: %s\n", STRERROR); return false; } else { System_Info.booted = booted.tv_sec; } return true; } /** * Read all processes to initialize the information tree. * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0 */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { size_t size = sizeof(maxslp); static int mib_maxslp[] = {CTL_VM, VM_MAXSLP}; if (sysctl(mib_maxslp, 2, &maxslp, &size, NULL, 0) < 0) { Log_error("system statistic error -- vm.maxslp failed\n"); return 0; } int mib_proc2[6] = {CTL_KERN, KERN_PROC2, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), 0}; if (sysctl(mib_proc2, 6, NULL, &size, NULL, 0) == -1) { Log_error("system statistic error -- kern.proc2 #1 failed\n"); return 0; } size *= 2; // Add reserve for new processes which were created between calls of sysctl struct kinfo_proc2 *pinfo = CALLOC(1, size); mib_proc2[5] = (int)(size / sizeof(struct kinfo_proc2)); if (sysctl(mib_proc2, 6, pinfo, &size, NULL, 0) == -1) { FREE(pinfo); Log_error("system statistic error -- kern.proc2 #2 failed\n"); return 0; } int treesize = (int)(size / sizeof(struct kinfo_proc2)); ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), treesize); char buf[_POSIX2_LINE_MAX]; kvm_t *kvm_handle = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, buf); if (! kvm_handle) { FREE(pinfo); FREE(pt); Log_error("system statistic error -- kvm_openfiles failed: %s\n", buf); return 0; } unsigned long long now = Time_milli(); StringBuffer_T cmdline = NULL; if (pflags & ProcessEngine_CollectCommandLine) cmdline = StringBuffer_create(64); for (int i = 0; i < treesize; i++) { pt[i].pid = pinfo[i].p_pid; pt[i].ppid = pinfo[i].p_ppid; pt[i].cred.uid = pinfo[i].p_ruid; pt[i].cred.euid = pinfo[i].p_uid; pt[i].cred.gid = pinfo[i].p_rgid; pt[i].threads.self = pinfo[i].p_nlwps; pt[i].uptime = System_Info.time / 10. - pinfo[i].p_ustart_sec; pt[i].cpu.time = pinfo[i].p_rtime_sec * 10 + (double)pinfo[i].p_rtime_usec / 100000.; pt[i].memory.usage = (unsigned long long)pinfo[i].p_vm_rssize * (unsigned long long)pagesize; pt[i].zombie = pinfo[i].p_stat == SZOMB ? true : false; pt[i].read.bytes = -1; pt[i].read.bytesPhysical = -1; pt[i].read.operations = pinfo[i].p_uru_inblock; pt[i].read.time = now; pt[i].write.bytes = -1; pt[i].write.bytesPhysical = -1; pt[i].write.operations = pinfo[i].p_uru_oublock; pt[i].write.time = now; if (pflags & ProcessEngine_CollectCommandLine) { char **args = kvm_getargv2(kvm_handle, &pinfo[i], 0); if (args) { StringBuffer_clear(cmdline); for (int j = 0; args[j]; j++) StringBuffer_append(cmdline, args[j + 1] ? "%s " : "%s", args[j]); if (StringBuffer_length(cmdline)) pt[i].cmdline = Str_dup(StringBuffer_toString(StringBuffer_trim(cmdline))); } if (STR_UNDEF(pt[i].cmdline)) { FREE(pt[i].cmdline); pt[i].cmdline = Str_dup(pinfo[i].p_comm); } } } if (pflags & ProcessEngine_CollectCommandLine) StringBuffer_free(&cmdline); FREE(pinfo); kvm_close(kvm_handle); *reference = pt; return treesize; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep (double *loadv, int nelem) { return getloadavg(loadv, nelem); } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { struct uvmexp_sysctl vm; int mib[2] = {CTL_VM, VM_UVMEXP2}; size_t len = sizeof(struct uvmexp_sysctl); if (sysctl(mib, 2, &vm, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get memory usage: %s\n", STRERROR); si->swap.size = 0ULL; return false; } si->memory.usage.bytes = (unsigned long long)(vm.active + vm.wired) * (unsigned long long)vm.pagesize; si->swap.size = (unsigned long long)vm.swpages * (unsigned long long)vm.pagesize; si->swap.usage.bytes = (unsigned long long)vm.swpginuse * (unsigned long long)vm.pagesize; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ bool used_system_cpu_sysdep(SystemInfo_T *si) { int mib[] = {CTL_KERN, KERN_CP_TIME}; long long cp_time[CPUSTATES]; long total_new = 0; long total; size_t len; len = sizeof(cp_time); if (sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get cpu time: %s\n", STRERROR); return false; } for (int i = 0; i < CPUSTATES; i++) total_new += cp_time[i]; total = total_new - total_old; total_old = total_new; si->cpu.usage.user = (total > 0) ? (100. * (double)(cp_time[CP_USER] - cpu_user_old) / total) : -1.; si->cpu.usage.nice = (total > 0) ? (100. * (double)(cp_time[CP_NICE] - cpu_nice_old) / total) : -1.; si->cpu.usage.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.hardirq = (total > 0) ? (100. * (double)(cp_time[CP_INTR] - cpu_intr_old) / total) : -1.; cpu_user_old = cp_time[CP_USER]; cpu_nice_old = cp_time[CP_NICE]; cpu_syst_old = cp_time[CP_SYS]; cpu_intr_old = cp_time[CP_INTR]; return true; } bool used_system_filedescriptors_sysdep(__attribute__ ((unused)) SystemInfo_T *si) { // Not implemented return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuNice | Statistics_CpuHardIRQ; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/process/process_sysdep.h0000644000016400001720000000273615007061157015345 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_PROCESS_SYSDEP_H #define MONIT_PROCESS_SYSDEP_H bool init_systeminfo_sysdep(void); int init_proc_info_sysdep(void); int getloadavg_sysdep (double *, int); bool used_system_memory_sysdep(SystemInfo_T *); bool used_system_cpu_sysdep(SystemInfo_T *); bool used_system_filedescriptors_sysdep(SystemInfo_T *); bool available_statistics(SystemInfo_T *); int init_processtree_sysdep(ProcessTree_T **, ProcessEngine_Flags); pid_t Sysdep_getMainThread(pid_t pid); #endif monit-5.35.2/src/process/ProcessTree.h0000644000016400001720000001025015007061157014524 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_PROCESSTREE_H #define MONIT_PROCESSTREE_H #include "config.h" typedef struct ProcessTree_T { bool visited; bool zombie; pid_t pid; pid_t ppid; int parent; struct { int uid; int euid; int gid; } cred; struct { struct { float self; float children; } usage; double time; } cpu; struct { int self; int children; } threads; struct { int count; int total; int *list; } children; struct { unsigned long long usage; unsigned long long usage_total; } memory; struct { unsigned long long time; long long bytes; long long bytesPhysical; long long operations; } read; struct { unsigned long long time; long long bytes; long long bytesPhysical; long long operations; } write; time_t uptime; char *cmdline; char *secattr; struct { long long usage; long long usage_total; struct { long long soft; long long hard; } limit; } filedescriptors; } ProcessTree_T; /** * Initialize the process tree * @param pflags Process engine flags * @return The process tree size or -1 if failed */ int ProcessTree_init(ProcessEngine_Flags pflags); /** * Delete the process tree */ void ProcessTree_delete(void); /** * Update the process information. * @param s A Service object * @param pid Process PID to update * @return true if succeeded otherwise false. */ bool ProcessTree_updateProcess(Service_T s, pid_t pid); /** * Get process uptime * @param pid Process PID * @return The PID of the running running process or 0 if the process is not running. */ time_t ProcessTree_getProcessUptime(pid_t pid); /** * Find the process in the process tree * @param s The service being checked * @return The PID of the running running process or 0 if the process is not running. */ pid_t ProcessTree_findProcess(Service_T s); /** * Print a table with all processes matching a given pattern * @param pattern The process pattern */ void ProcessTree_testMatch(char *pattern); /** * Visit every node in the ProcessTree and call the 'visitor' function on * each node. This function first reinitializes the ProcessTree to ensure * the data is up-to-date before visiting nodes. * * @param visitor Callback function called for each Process node in * the ProcessTree * @param ap Application-specific pointer passed to the 'visitor' * function on each call. Use NULL if not needed * @note The ProcessTree is reinitialized when this function is called, * ensuring current system state is reflected */ void ProcessTree_visit(void visitor(ProcessTree_T *p, void *ap), void *ap); #endif monit-5.35.2/src/process/ProcessTree.c0000644000016400001720000005262015007061157014526 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "monit.h" #include "event.h" #include "ProcessTree.h" #include "process_sysdep.h" #include "TextBox.h" #include "TextColor.h" // libmonit #include "system/Time.h" /* ------------------------------------------------------------- Definitions */ static int ptreesize = 0; static ProcessTree_T *ptree = NULL; /* ----------------------------------------------------------------- Private */ static void _delete(ProcessTree_T **pt, int *size) { assert(pt); ProcessTree_T *_pt = *pt; if (_pt) { for (int i = 0; i < *size; i++) { FREE(_pt[i].cmdline); FREE(_pt[i].children.list); FREE(_pt[i].secattr); } FREE(_pt); *pt = NULL; *size = 0; } } /** * Search a leaf in the processtree * @param pid pid of the process * @param pt processtree * @param treesize size of the processtree * @return process index if succeeded otherwise -1 */ static int _findProcess(int pid, ProcessTree_T *pt, int size) { if (size > 0) { for (int i = 0; i < size; i++) if (pid == pt[i].pid) return i; } return -1; } /** * Fill data in the process tree by recursively walking through it * @param pt process tree * @param i process index */ static void _fillProcessTree(ProcessTree_T *pt, int index) { if (! pt[index].visited) { pt[index].visited = true; pt[index].children.total = pt[index].children.count; pt[index].threads.children = 0; pt[index].cpu.usage.children = 0.; pt[index].memory.usage_total = pt[index].memory.usage; pt[index].filedescriptors.usage_total = pt[index].filedescriptors.usage; for (int i = 0; i < pt[index].children.count; i++) { _fillProcessTree(pt, pt[index].children.list[i]); } if (pt[index].parent != -1 && pt[index].parent != index) { ProcessTree_T *parent_pt = &pt[pt[index].parent]; parent_pt->children.total += pt[index].children.total; parent_pt->threads.children += (pt[index].threads.self > 1 ? pt[index].threads.self : 1) + (pt[index].threads.children > 0 ? pt[index].threads.children : 0); if (pt[index].cpu.usage.self >= 0) { parent_pt->cpu.usage.children += pt[index].cpu.usage.self; } if (pt[index].cpu.usage.children >= 0) { parent_pt->cpu.usage.children += pt[index].cpu.usage.children; } parent_pt->memory.usage_total += pt[index].memory.usage_total; parent_pt->filedescriptors.usage_total += pt[index].filedescriptors.usage_total; } } } /** * Adjust the CPU usage based on the available system resources: number of CPU cores the application may utilize. Single threaded application may utilized only one CPU core, 4 threaded application 4 cores, etc.. If the application * has more threads then the machine has cores, it is limited by number of cores, not threads. * @param now Current process information * @param prev Process information from previous cycle * @param delta The delta of system time between current and previous cycle * @return Process's CPU usage [%] since last cycle */ static float _cpuUsage(float rawUsage, unsigned int threads) { if (System_Info.cpu.count > 0 && rawUsage > 0) { int divisor; if (threads > 1) { if (threads >= (unsigned)System_Info.cpu.count) { // Multithreaded application with more threads then CPU cores divisor = System_Info.cpu.count; } else { // Multithreaded application with less threads then CPU cores divisor = threads; } } else { // Single threaded application divisor = 1; } float usage = rawUsage / divisor; return usage > 100. ? 100. : usage; } return 0.; } static int _match(regex_t *regex) { int found = -1; // Scan the whole process tree and find the oldest matching process whose parent doesn't match the pattern for (int i = 0; i < ptreesize; i++) if (ptree[i].cmdline && regexec(regex, ptree[i].cmdline, 0, NULL, 0) == 0 && (i == ptree[i].parent || ! ptree[ptree[i].parent].cmdline || regexec(regex, ptree[ptree[i].parent].cmdline, 0, NULL, 0) != 0) && (found == -1 || ptree[found].uptime < ptree[i].uptime)) found = i; return found >= 0 ? ptree[found].pid : -1; } /* ------------------------------------------------------------------ Public */ /** * Initialize the process tree * @return treesize >= 0 if succeeded otherwise < 0 */ int ProcessTree_init(ProcessEngine_Flags pflags) { ProcessTree_T *oldptree = ptree; int oldptreesize = ptreesize; if (oldptree) { ptree = NULL; ptreesize = 0; // We need only process's cpu.time from the old ptree, so free dynamically allocated parts which we don't need before initializing new ptree (so the memory can be reused, otherwise the memory footprint will hold two ptrees) for (int i = 0; i < oldptreesize; i++) { FREE(oldptree[i].cmdline); FREE(oldptree[i].children.list); FREE(oldptree[i].secattr); } } System_Info.time_prev = System_Info.time; System_Info.time = Time_milli() / 100.; if ((ptreesize = init_processtree_sysdep(&ptree, pflags)) <= 0 || ! ptree) { DEBUG("System statistic -- cannot initialize the process tree -- process resource monitoring disabled\n"); Run.flags &= ~Run_ProcessEngineEnabled; if (oldptree) _delete(&oldptree, &oldptreesize); return -1; } else if (! (Run.flags & Run_ProcessEngineEnabled)) { DEBUG("System statistic -- initialization of the process tree succeeded -- process resource monitoring enabled\n"); Run.flags |= Run_ProcessEngineEnabled; } int root = -1; // Main process. Not all systems have main process with PID 1 (such as Solaris zones and FreeBSD jails), so we try to find process which is parent of itself ProcessTree_T *pt = ptree; double time_delta = System_Info.time - System_Info.time_prev; for (int i = 0; i < (volatile int)ptreesize; i ++) { pt[i].cpu.usage.self = -1; if (oldptree) { int oldentry = _findProcess(pt[i].pid, oldptree, oldptreesize); if (oldentry != -1) { if (System_Info.cpu.count > 0 && time_delta > 0 && oldptree[oldentry].cpu.time >= 0 && pt[i].cpu.time >= oldptree[oldentry].cpu.time) { pt[i].cpu.usage.self = 100. * (pt[i].cpu.time - oldptree[oldentry].cpu.time) / time_delta; } } } // Note: on DragonFly, main process is swapper with pid 0 and ppid -1, so take also this case into consideration if ((pt[i].pid == pt[i].ppid) || (pt[i].ppid == -1)) { root = pt[i].parent = i; } else { // Find this process's parent int parent = _findProcess(pt[i].ppid, pt, ptreesize); if (parent == -1) { /* Parent process wasn't found - on Linux this is normal: main process with PID 0 is not listed, similarly in FreeBSD jail. * We create virtual process entry for missing parent so we can have full tree-like structure with root. */ parent = ptreesize++; pt = RESIZE(ptree, ptreesize * sizeof(ProcessTree_T)); memset(&pt[parent], 0, sizeof(ProcessTree_T)); root = pt[parent].ppid = pt[parent].pid = pt[i].ppid; } pt[i].parent = parent; // Connect the child (this process) to the parent RESIZE(pt[parent].children.list, sizeof(int) * (pt[parent].children.count + 1)); pt[parent].children.list[pt[parent].children.count] = i; pt[parent].children.count++; } } FREE(oldptree); // Free the rest of old ptree if (root == -1) { DEBUG("System statistic error -- cannot find root process id\n"); _delete(&ptree, &ptreesize); return -1; } _fillProcessTree(pt, root); return ptreesize; } /** * Delete the process tree */ void ProcessTree_delete(void) { _delete(&ptree, &ptreesize); } bool ProcessTree_updateProcess(Service_T s, pid_t pid) { assert(s); /* save the previous pid and set actual one */ s->inf.process->_pid = s->inf.process->pid; s->inf.process->pid = pid; int leaf = _findProcess(pid, ptree, ptreesize); if (leaf != -1) { /* save the previous ppid and set actual one */ s->inf.process->_ppid = s->inf.process->ppid; s->inf.process->ppid = ptree[leaf].ppid; s->inf.process->uid = ptree[leaf].cred.uid; s->inf.process->euid = ptree[leaf].cred.euid; s->inf.process->gid = ptree[leaf].cred.gid; s->inf.process->uptime = ptree[leaf].uptime; s->inf.process->threads = ptree[leaf].threads.self; s->inf.process->children = ptree[leaf].children.total; s->inf.process->zombie = ptree[leaf].zombie; snprintf(s->inf.process->secattr, STRLEN, "%s", NVLSTR(ptree[leaf].secattr)); if (ptree[leaf].cpu.usage.self >= 0) { // compute only if initialized (delta between current and previous snapshot is available) s->inf.process->cpu_percent = _cpuUsage(ptree[leaf].cpu.usage.self, ptree[leaf].threads.self); s->inf.process->total_cpu_percent = s->inf.process->cpu_percent + _cpuUsage(ptree[leaf].cpu.usage.children, ptree[leaf].threads.children); if (s->inf.process->total_cpu_percent > 100.) { s->inf.process->total_cpu_percent = 100.; } } else { s->inf.process->cpu_percent = -1; s->inf.process->total_cpu_percent = -1; } s->inf.process->mem = ptree[leaf].memory.usage; s->inf.process->total_mem = ptree[leaf].memory.usage_total; s->inf.process->filedescriptors.open = ptree[leaf].filedescriptors.usage; s->inf.process->filedescriptors.openTotal = ptree[leaf].filedescriptors.usage_total; s->inf.process->filedescriptors.limit.soft = ptree[leaf].filedescriptors.limit.soft; s->inf.process->filedescriptors.limit.hard = ptree[leaf].filedescriptors.limit.hard; if (System_Info.memory.size > 0) { s->inf.process->total_mem_percent = ptree[leaf].memory.usage_total >= System_Info.memory.size ? 100. : (100. * (double)ptree[leaf].memory.usage_total / (double)System_Info.memory.size); s->inf.process->mem_percent = ptree[leaf].memory.usage >= System_Info.memory.size ? 100. : (100. * (double)ptree[leaf].memory.usage / (double)System_Info.memory.size); } if (ptree[leaf].read.bytes >= 0) Statistics_update(&(s->inf.process->read.bytes), ptree[leaf].read.time, ptree[leaf].read.bytes); if (ptree[leaf].read.bytesPhysical >= 0) Statistics_update(&(s->inf.process->read.bytesPhysical), ptree[leaf].read.time, ptree[leaf].read.bytesPhysical); if (ptree[leaf].read.operations >= 0) Statistics_update(&(s->inf.process->read.operations), ptree[leaf].read.time, ptree[leaf].read.operations); if (ptree[leaf].write.bytes >= 0) Statistics_update(&(s->inf.process->write.bytes), ptree[leaf].write.time, ptree[leaf].write.bytes); if (ptree[leaf].write.bytesPhysical >= 0) Statistics_update(&(s->inf.process->write.bytesPhysical), ptree[leaf].write.time, ptree[leaf].write.bytesPhysical); if (ptree[leaf].write.operations >= 0) Statistics_update(&(s->inf.process->write.operations), ptree[leaf].write.time, ptree[leaf].write.operations); return true; } Util_resetInfo(s); return false; } time_t ProcessTree_getProcessUptime(pid_t pid) { if (ptree) { int leaf = _findProcess(pid, ptree, ptreesize); return (time_t)((leaf >= 0 && leaf < ptreesize) ? ptree[leaf].uptime : -1); } return 0; } static pid_t _isProcessRunning(Service_T s, pid_t pid) { pid_t groupLeaderPid = getpgid(pid); if (groupLeaderPid > -1) { // The PID may belong to LWP task on some platforms (e.g. Linux). We need to check that the PID belongs to the main thread to make sure it is the real process PID pid_t mainPid = Sysdep_getMainThread(pid); if (mainPid == pid) return pid; else DEBUG("'%s' The PID %d was found, but it's not main process thread. The PID of the original process was likely reused for the LWP belonging to another process with PID %d\n", s->name, pid, mainPid); } else if (errno == EPERM) { // The process is running, but we don't have permissions (at this point we're not able to differentiate LWP from normal process though) return pid; } else { DEBUG("'%s' The PID %d is not running -- %s\n", s->name, pid, STRERROR); } return 0; } pid_t ProcessTree_findProcess(Service_T s) { assert(s); if (s->matchlist) { // PROCMATCH check // Test the cached PID first if (s->inf.process->pid > 0) { pid_t pid = _isProcessRunning(s, s->inf.process->pid); if (pid) return pid; } // If the cached PID is not running, scan for the process again. Update the process tree including command line. ProcessTree_init(ProcessEngine_CollectCommandLine); if (Run.flags & Run_ProcessEngineEnabled) { int pid = _match(s->matchlist->regex_comp); if (pid >= 0) return pid; } else { DEBUG("Process information not available -- skipping service %s process existence check for this cycle\n", s->name); // Return value is NOOP - it is based on existing errors bitmap so we don't generate false recovery/failures return ! (s->error & Event_NonExist); } } else { // PIDFILE check // Re-read PID from the file pid_t pid = Util_getPid(s->path); if (pid > 0) { pid_t foundPid = _isProcessRunning(s, pid); if (foundPid) return foundPid; } } Util_resetInfo(s); return 0; } void ProcessTree_testMatch(char *pattern) { regex_t *regex_comp; int reg_return; NEW(regex_comp); if ((reg_return = regcomp(regex_comp, pattern, REG_NOSUB|REG_EXTENDED))) { char errbuf[STRLEN]; regerror(reg_return, regex_comp, errbuf, STRLEN); regfree(regex_comp); FREE(regex_comp); printf("Regex %s parsing error: %s\n", pattern, errbuf); exit(1); } ProcessTree_init(ProcessEngine_CollectCommandLine); if (Run.flags & Run_ProcessEngineEnabled) { int count = 0; printf("List of processes matching pattern \"%s\":\n", pattern); StringBuffer_T output = StringBuffer_create(256); TextBox_T t = TextBox_new(output, 4, (TextBoxColumn_T []){ {.name = "", .width = 1, .wrap = false, .align = TextBoxAlign_Left}, {.name = "PID", .width = 8, .wrap = false, .align = TextBoxAlign_Right}, {.name = "PPID", .width = 8, .wrap = false, .align = TextBoxAlign_Right}, {.name = "Command", .width = 50, .wrap = true, .align = TextBoxAlign_Left} }, true); // Select the process matching the pattern int pid = _match(regex_comp); // Print all matching processes and highlight the one which is selected for (int i = 0; i < ptreesize; i++) { if (ptree[i].cmdline && ! strstr(ptree[i].cmdline, "procmatch")) { if (! regexec(regex_comp, ptree[i].cmdline, 0, NULL, 0)) { if (pid == ptree[i].pid) { TextBox_setColumn(t, 1, COLOR_BOLD "*" COLOR_RESET); TextBox_setColumn(t, 2, COLOR_BOLD "%d" COLOR_RESET, ptree[i].pid); TextBox_setColumn(t, 3, COLOR_BOLD "%d" COLOR_RESET, ptree[i].ppid); TextBox_setColumn(t, 4, COLOR_BOLD "%s" COLOR_RESET, ptree[i].cmdline); } else { TextBox_setColumn(t, 2, "%d", ptree[i].pid); TextBox_setColumn(t, 3, "%d", ptree[i].ppid); TextBox_setColumn(t, 4, "%s", ptree[i].cmdline); } TextBox_printRow(t); count++; } } } TextBox_free(&t); if (Run.flags & Run_Batch || ! TextColor_support()) TextColor_strip(TextBox_strip((char *)StringBuffer_toString(output))); printf("%s", StringBuffer_toString(output)); StringBuffer_free(&output); printf("Total matches: %d\n", count); if (count > 1) printf("\n" "WARNING:\n" "Multiple processes match the pattern. Monit will select the process with the\n" "highest uptime, the one highlighted.\n"); } regfree(regex_comp); FREE(regex_comp); } void ProcessTree_visit(void visitor(ProcessTree_T *p, void *ap), void *ap) { ProcessTree_init(ProcessEngine_None); for (int i = 0; i < ptreesize; i++) { visitor(&ptree[i], ap); } } monit-5.35.2/src/process/sysdep_LINUX.c0000644000016400001720000011173715007061157014563 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDDEF_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_ASM_PARAM_H #include #endif #ifdef HAVE_GLOB_H #include #endif #ifdef HAVE_SYS_SYSINFO_H #include #endif #ifdef HAVE_DIRENT_H #include #endif #ifdef HAVE_SYS_RESOURCE_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" /** * System dependent resource data collection code for Linux. * * @file */ /* ------------------------------------------------------------- Definitions */ static struct { int hasIOStatistics; // True if /proc//io is present } _statistics = {}; typedef struct Proc_T { StringBuffer_T name; struct { int pid; int ppid; int uid; int euid; int gid; char item_state; long item_cutime; long item_cstime; long item_rss; int item_threads; unsigned long item_utime; unsigned long item_stime; unsigned long long item_starttime; struct { unsigned long long bytes; unsigned long long bytesPhysical; unsigned long long operations; } read; struct { unsigned long long bytes; unsigned long long bytesPhysical; unsigned long long operations; } write; struct { long long open; struct { long long soft; long long hard; } limit; } filedescriptors; char secattr[STRLEN]; } data; } *Proc_T; /* --------------------------------------- Static constructor and destructor */ static void __attribute__ ((constructor)) _constructor(void) { struct stat sb; _statistics.hasIOStatistics = stat("/proc/self/io", &sb) == 0 ? true : false; } /* ----------------------------------------------------------------- Private */ #define NSEC_PER_SEC 1000000000L static unsigned long long old_cpu_user = 0; static unsigned long long old_cpu_nice = 0; static unsigned long long old_cpu_syst = 0; static unsigned long long old_cpu_iowait = 0; static unsigned long long old_cpu_hardirq = 0; static unsigned long long old_cpu_softirq = 0; static unsigned long long old_cpu_steal = 0; static unsigned long long old_cpu_guest = 0; static unsigned long long old_cpu_guest_nice = 0; static unsigned long long old_cpu_total = 0; static long page_size = 0; static double hz = 0.; /** * Get system start time * @return seconds since unix epoch */ static time_t _getStartTime(void) { struct sysinfo info; if (sysinfo(&info) < 0) { Log_error("system statistic error -- cannot get system uptime: %s\n", STRERROR); return 0; } return Time_now() - info.uptime; } // parse /proc/PID/stat static bool _parseProcPidStat(Proc_T proc) { char buf[8192]; char *tmp = NULL; if (! file_readProc(buf, sizeof(buf), "stat", proc->data.pid, NULL)) { DEBUG("system statistic error -- cannot read /proc/%d/stat\n", proc->data.pid); return false; } // Skip the process name (can have multiple words) if (! (tmp = strrchr(buf, ')'))) { DEBUG("system statistic error -- file /proc/%d/stat parse error\n", proc->data.pid); return false; } if (sscanf(tmp + 2, "%c %d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu %ld %ld %*d %*d %d %*u %llu %*u %ld %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*d %*d\n", &(proc->data.item_state), &(proc->data.ppid), &(proc->data.item_utime), &(proc->data.item_stime), &(proc->data.item_cutime), &(proc->data.item_cstime), &(proc->data.item_threads), &(proc->data.item_starttime), &(proc->data.item_rss)) != 9) { DEBUG("system statistic error -- file /proc/%d/stat parse error\n", proc->data.pid); return false; } return true; } // parse /proc/PID/status static bool _parseProcPidStatus(Proc_T proc) { char buf[4096]; char *tmp = NULL; if (! file_readProc(buf, sizeof(buf), "status", proc->data.pid, NULL)) { DEBUG("system statistic error -- cannot read /proc/%d/status\n", proc->data.pid); return false; } if (! (tmp = strstr(buf, "Uid:"))) { DEBUG("system statistic error -- cannot find process uid\n"); return false; } if (sscanf(tmp + 4, "\t%d\t%d", &(proc->data.uid), &(proc->data.euid)) != 2) { DEBUG("system statistic error -- cannot read process uid\n"); return false; } if (! (tmp = strstr(buf, "Gid:"))) { DEBUG("system statistic error -- cannot find process gid\n"); return false; } if (sscanf(tmp + 4, "\t%d", &(proc->data.gid)) != 1) { DEBUG("system statistic error -- cannot read process gid\n"); return false; } return true; } // parse /proc/PID/io static bool _parseProcPidIO(Proc_T proc) { char buf[4096]; char *tmp = NULL; if (_statistics.hasIOStatistics) { if (file_readProc(buf, sizeof(buf), "io", proc->data.pid, NULL)) { // read bytes (total) if (! (tmp = strstr(buf, "rchar:"))) { DEBUG("system statistic error -- cannot find process read bytes\n"); return false; } if (sscanf(tmp + 6, "\t%llu", &(proc->data.read.bytes)) != 1) { DEBUG("system statistic error -- cannot get process read bytes\n"); return false; } // write bytes (total) if (! (tmp = strstr(tmp, "wchar:"))) { DEBUG("system statistic error -- cannot find process write bytes\n"); return false; } if (sscanf(tmp + 6, "\t%llu", &(proc->data.write.bytes)) != 1) { DEBUG("system statistic error -- cannot get process write bytes\n"); return false; } // read operations if (! (tmp = strstr(tmp, "syscr:"))) { DEBUG("system statistic error -- cannot find process read system calls count\n"); return false; } if (sscanf(tmp + 6, "\t%llu", &(proc->data.read.operations)) != 1) { DEBUG("system statistic error -- cannot get process read system calls count\n"); return false; } // write operations if (! (tmp = strstr(tmp, "syscw:"))) { DEBUG("system statistic error -- cannot find process write system calls count\n"); return false; } if (sscanf(tmp + 6, "\t%llu", &(proc->data.write.operations)) != 1) { DEBUG("system statistic error -- cannot get process write system calls count\n"); return false; } // read bytes (physical I/O) if (! (tmp = strstr(tmp, "read_bytes:"))) { DEBUG("system statistic error -- cannot find process physical read bytes\n"); return false; } if (sscanf(tmp + 11, "\t%llu", &(proc->data.read.bytesPhysical)) != 1) { DEBUG("system statistic error -- cannot get process physical read bytes\n"); return false; } // write bytes (physical I/O) if (! (tmp = strstr(tmp, "write_bytes:"))) { DEBUG("system statistic error -- cannot find process physical write bytes\n"); return false; } if (sscanf(tmp + 12, "\t%llu", &(proc->data.write.bytesPhysical)) != 1) { DEBUG("system statistic error -- cannot get process physical write bytes\n"); return false; } } else { // file_readProc() already printed a DEBUG() message // return false; // sometimes no io data is available, this is not a problem. return true; } } return true; } // parse /proc/PID/cmdline static bool _parseProcPidCmdline(Proc_T proc, ProcessEngine_Flags pflags) { if (pflags & ProcessEngine_CollectCommandLine) { char filename[STRLEN]; // Try to collect the command-line from the procfs cmdline (user-space processes) snprintf(filename, sizeof(filename), "/proc/%d/cmdline", proc->data.pid); FILE *f = fopen(filename, "r"); if (! f) { DEBUG("system statistic error -- cannot open /proc/%d/cmdline: %s\n", proc->data.pid, STRERROR); return false; } size_t n; char buf[STRLEN] = {}; while ((n = fread(buf, 1, sizeof(buf) - 1, f)) > 0) { // The cmdline file contains argv elements/strings separated by '\0' => join the string for (size_t i = 0; i < n; i++) { if (buf[i] == 0) StringBuffer_append(proc->name, " "); else StringBuffer_append(proc->name, "%c", buf[i]); } } fclose(f); StringBuffer_trim(proc->name); // Fallback to procfs stat process name if cmdline was empty (even kernel-space processes have information here) if (! StringBuffer_length(proc->name)) { char buffer[8192]; char *tmp = NULL; char *procname = NULL; if (! file_readProc(buffer, sizeof(buffer), "stat", proc->data.pid, NULL)) { DEBUG("system statistic error -- cannot read /proc/%d/stat\n", proc->data.pid); return false; } if (! (tmp = strrchr(buffer, ')'))) { DEBUG("system statistic error -- file /proc/%d/stat parse error\n", proc->data.pid); return false; } *tmp = 0; if (! (procname = strchr(buffer, '('))) { DEBUG("system statistic error -- file /proc/%d/stat parse error\n", proc->data.pid); return false; } StringBuffer_append(proc->name, "%s", procname + 1); } } return true; } // parse /proc/PID/attr/current static bool _parseProcPidAttrCurrent(Proc_T proc) { if (file_readProc(proc->data.secattr, sizeof(proc->data.secattr), "attr/current", proc->data.pid, NULL)) { Str_trim(proc->data.secattr); return true; } return false; } // count entries in /proc/PID/fd static bool _parseProcFdCount(Proc_T proc) { char path[PATH_MAX] = {}; unsigned long long file_count = 0; snprintf(path, sizeof(path), "/proc/%d/fd", proc->data.pid); DIR *dirp = opendir(path); if (! dirp) { if (Run.debug >= 2) DEBUG("system statistic error -- opendir %s: %s\n", path, STRERROR); return false; } errno = 0; while (readdir(dirp) != NULL) { // count everything file_count++; } // do not closedir() until readdir errno has been evaluated if (errno) { DEBUG("system statistic error -- cannot iterate %s: %s\n", path, STRERROR); closedir(dirp); return false; } closedir(dirp); // assert at least '.' and '..' have been found if (file_count < 2) { DEBUG("system statistic error -- cannot find basic entries in %s\n", path); return false; } // subtract entries '.' and '..' proc->data.filedescriptors.open = file_count - 2; // get process's limits snprintf(path, sizeof(path), "/proc/%d/limits", proc->data.pid); FILE *f = fopen(path, "r"); if (f) { int softLimit; int hardLimit; char line[STRLEN]; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "Max open files %d %d", &softLimit, &hardLimit) == 2) { proc->data.filedescriptors.limit.soft = softLimit; proc->data.filedescriptors.limit.hard = hardLimit; break; } } fclose(f); } else { DEBUG("system statistic error -- cannot open %s\n", path); return false; } return true; } static double _usagePercent(unsigned long long previous, unsigned long long current, double total) { if (current < previous) { // The counter jumped back (observed for cpu wait metric on Linux 4.15) or wrapped return 0.; } return (double)(current - previous) / total * 100.; } /* ------------------------------------------------------------------ Public */ bool init_systeminfo_sysdep(void) { if ((hz = sysconf(_SC_CLK_TCK)) <= 0.) { DEBUG("system statistic error -- cannot get hz: %s\n", STRERROR); return false; } if ((page_size = sysconf(_SC_PAGESIZE)) <= 0) { DEBUG("system statistic error -- cannot get page size: %s\n", STRERROR); return false; } if ((System_Info.cpu.count = sysconf(_SC_NPROCESSORS_ONLN)) < 0) { DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); return false; } else if (System_Info.cpu.count == 0) { DEBUG("system reports cpu count 0, setting dummy cpu count 1\n"); System_Info.cpu.count = 1; } FILE *f = fopen("/proc/meminfo", "r"); if (f) { char line[STRLEN]; System_Info.memory.size = 0L; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "MemTotal: %llu", &System_Info.memory.size) == 1) { System_Info.memory.size *= 1024; break; } } fclose(f); if (! System_Info.memory.size) DEBUG("system statistic error -- cannot get real memory amount\n"); } else { DEBUG("system statistic error -- cannot open /proc/meminfo\n"); } System_Info.booted = (long long)_getStartTime(); return true; } /** * Read all processes of the proc files system to initialize the process tree * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0 */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { assert(reference); // Find all processes in the /proc directory glob_t globbuf; int rv = glob("/proc/[0-9]*", 0, NULL, &globbuf); if (rv) { Log_error("system statistic error -- glob failed: %d (%s)\n", rv, STRERROR); return 0; } ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), globbuf.gl_pathc); int count = 0; struct Proc_T proc = { .name = StringBuffer_create(64) }; time_t starttime = _getStartTime(); for (size_t i = 0; i < globbuf.gl_pathc; i++) { proc.data.pid = atoi(globbuf.gl_pathv[i] + 6); // skip "/proc/" if (_parseProcPidStat(&proc) && _parseProcPidStatus(&proc) && _parseProcPidIO(&proc) && _parseProcPidCmdline(&proc, pflags)) { // Non-mandatory statistics (may not exist) _parseProcFdCount(&proc); _parseProcPidAttrCurrent(&proc); // Set the data in ptree only if all process related reads succeeded (prevent partial data in the case that continue was called during data collecting) pt[count].pid = proc.data.pid; pt[count].ppid = proc.data.ppid; pt[count].cred.uid = proc.data.uid; pt[count].cred.euid = proc.data.euid; pt[count].cred.gid = proc.data.gid; pt[count].threads.self = proc.data.item_threads; pt[count].uptime = starttime > 0 ? (System_Info.time / 10. - (starttime + (time_t)(proc.data.item_starttime / hz))) : 0; pt[count].cpu.time = (double)(proc.data.item_utime + proc.data.item_stime) / hz * 10.; // jiffies -> seconds = 1/hz pt[count].memory.usage = (unsigned long long)proc.data.item_rss * (unsigned long long)page_size; pt[count].read.bytes = proc.data.read.bytes; pt[count].read.bytesPhysical = proc.data.read.bytesPhysical; pt[count].read.operations = proc.data.read.operations; pt[count].write.bytes = proc.data.write.bytes; pt[count].write.bytesPhysical = proc.data.write.bytesPhysical; pt[count].write.operations = proc.data.write.operations; pt[count].read.time = pt[count].write.time = Time_milli(); pt[count].zombie = proc.data.item_state == 'Z' ? true : false; pt[count].cmdline = Str_dup(StringBuffer_toString(proc.name)); pt[count].secattr = Str_dup(proc.data.secattr); pt[count].filedescriptors.usage = proc.data.filedescriptors.open; pt[count].filedescriptors.limit.soft = proc.data.filedescriptors.limit.soft; pt[count].filedescriptors.limit.hard = proc.data.filedescriptors.limit.hard; count++; // Clear memset(&proc.data, 0, sizeof(proc.data)); StringBuffer_clear(proc.name); } } StringBuffer_free(&(proc.name)); *reference = pt; globfree(&globbuf); return count; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep(double *loadv, int nelem) { #ifdef HAVE_GETLOADAVG return getloadavg(loadv, nelem); #else char buf[STRLEN]; double load[3]; if (! file_readProc(buf, sizeof(buf), "loadavg", -1, NULL)) return -1; if (sscanf(buf, "%lf %lf %lf", &load[0], &load[1], &load[2]) != 3) { DEBUG("system statistic error -- cannot get load average\n"); return -1; } for (int i = 0; i < nelem; i++) loadv[i] = load[i]; return 0; #endif } /** * This routine returns real memory in use. * @return: true if successful, false if failed */ bool used_system_memory_sysdep(SystemInfo_T *si) { char *ptr; char buf[2048]; unsigned long long mem_total = 0ULL; unsigned long long mem_available = 0ULL; unsigned long long mem_free = 0ULL; unsigned long long buffers = 0ULL; unsigned long long cached = 0ULL; unsigned long long slabreclaimable = 0ULL; unsigned long long swap_total = 0ULL; unsigned long long swap_free = 0ULL; unsigned long long zfsarcsize = 0ULL; if (! file_readProc(buf, sizeof(buf), "meminfo", -1, NULL)) { Log_error("system statistic error -- cannot get system memory info\n"); goto error; } // Update memory total (physical memory can be added to the online system on some machines, also LXC/KVM containers MemTotal is dynamic and changes frequently if ((ptr = strstr(buf, "MemTotal:")) && sscanf(ptr + 9, "%llu", &mem_total) == 1) { System_Info.memory.size = mem_total * 1024; } // Check if the "MemAvailable" value is available on this system. If it is, we will use it. Otherwise we will attempt to calculate the amount of available memory ourself if ((ptr = strstr(buf, "MemAvailable:")) && sscanf(ptr + 13, "%llu", &mem_available) == 1) { si->memory.usage.bytes = System_Info.memory.size - mem_available * 1024; } else { DEBUG("'MemAvailable' value not available on this system. Attempting to calculate available memory manually...\n"); if (! (ptr = strstr(buf, "MemFree:")) || sscanf(ptr + 8, "%llu", &mem_free) != 1) { Log_error("system statistic error -- cannot get real memory free amount\n"); goto error; } if (! (ptr = strstr(buf, "Buffers:")) || sscanf(ptr + 8, "%llu", &buffers) != 1) DEBUG("system statistic error -- cannot get real memory buffers amount\n"); if (! (ptr = strstr(buf, "Cached:")) || sscanf(ptr + 7, "%llu", &cached) != 1) DEBUG("system statistic error -- cannot get real memory cache amount\n"); if (! (ptr = strstr(buf, "SReclaimable:")) || sscanf(ptr + 13, "%llu", &slabreclaimable) != 1) DEBUG("system statistic error -- cannot get slab reclaimable memory amount\n"); FILE *f = fopen("/proc/spl/kstat/zfs/arcstats", "r"); if (f) { char line[STRLEN]; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "size %*d %llu", &zfsarcsize) == 1) { break; } } fclose(f); } si->memory.usage.bytes = System_Info.memory.size - zfsarcsize - (unsigned long long)(mem_free + buffers + cached + slabreclaimable) * 1024; } // Swap if (! (ptr = strstr(buf, "SwapTotal:")) || sscanf(ptr + 10, "%llu", &swap_total) != 1) { Log_error("system statistic error -- cannot get swap total amount\n"); goto error; } if (! (ptr = strstr(buf, "SwapFree:")) || sscanf(ptr + 9, "%llu", &swap_free) != 1) { Log_error("system statistic error -- cannot get swap free amount\n"); goto error; } si->swap.size = swap_total * 1024; si->swap.usage.bytes = (swap_total - swap_free) * 1024; return true; error: si->memory.usage.bytes = 0ULL; si->swap.size = 0ULL; return false; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed (or not available) */ bool used_system_cpu_sysdep(SystemInfo_T *si) { int rv; unsigned long long cpu_total; // Total CPU time unsigned long long cpu_user; // Time spent in user mode unsigned long long cpu_nice; // Time spent in user mode with low priority (nice) unsigned long long cpu_syst; // Time spent in system mode unsigned long long cpu_idle; // Time idle unsigned long long cpu_iowait; // Time waiting for I/O to complete. This value is not reliable unsigned long long cpu_hardirq; // Time servicing hardware interrupts unsigned long long cpu_softirq; // Time servicing software interrupts unsigned long long cpu_steal; // Stolen time, which is the time spent in other operating systems when running in a virtualized environment unsigned long long cpu_guest; // Time spent running a virtual CPU for guest operating systems under the control of the Linux kernel unsigned long long cpu_guest_nice; // Time spent running a niced guest (virtual CPU for guest operating systems under the control of the Linux kernel) char buf[8192]; if (! file_readProc(buf, sizeof(buf), "stat", -1, NULL)) { Log_error("system statistic error -- cannot read /proc/stat\n"); goto error; } rv = sscanf(buf, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu", &cpu_user, &cpu_nice, &cpu_syst, &cpu_idle, &cpu_iowait, &cpu_hardirq, &cpu_softirq, &cpu_steal, &cpu_guest, &cpu_guest_nice); switch (rv) { case 4: // linux < 2.5.41 cpu_iowait = 0; cpu_hardirq = 0; cpu_softirq = 0; cpu_steal = 0; cpu_guest = 0; cpu_guest_nice = 0; break; case 5: // linux >= 2.5.41 cpu_hardirq = 0; cpu_softirq = 0; cpu_steal = 0; cpu_guest = 0; cpu_guest_nice = 0; break; case 7: // linux >= 2.6.0-test4 cpu_steal = 0; cpu_guest = 0; cpu_guest_nice = 0; break; case 8: // linux 2.6.11 cpu_guest = 0; cpu_guest_nice = 0; break; case 9: // linux >= 2.6.24 cpu_guest_nice = 0; break; case 10: // linux >= 2.6.33 break; default: Log_error("system statistic error -- cannot read cpu usage\n"); goto error; } cpu_total = cpu_user + cpu_nice + cpu_syst + cpu_idle + cpu_iowait + cpu_hardirq + cpu_softirq + cpu_steal; // Note: cpu_guest and cpu_guest_nice are included in user and nice already if (old_cpu_total == 0) { si->cpu.usage.user = -1.; si->cpu.usage.nice = -1.; si->cpu.usage.system = -1.; si->cpu.usage.iowait = -1.; si->cpu.usage.hardirq = -1.; si->cpu.usage.softirq = -1.; si->cpu.usage.steal = -1.; si->cpu.usage.guest = -1.; si->cpu.usage.guest_nice = -1.; } else { double delta = cpu_total - old_cpu_total; si->cpu.usage.user = _usagePercent(old_cpu_user - old_cpu_guest, cpu_user - cpu_guest, delta); // the guest (if available) is sub-statistics of user si->cpu.usage.nice = _usagePercent(old_cpu_nice - old_cpu_guest_nice, cpu_nice - cpu_guest_nice, delta); // the guest_nice (if available) is sub-statistics of nice si->cpu.usage.system = _usagePercent(old_cpu_syst, cpu_syst, delta); si->cpu.usage.iowait = _usagePercent(old_cpu_iowait, cpu_iowait, delta); si->cpu.usage.hardirq = _usagePercent(old_cpu_hardirq, cpu_hardirq, delta); si->cpu.usage.softirq = _usagePercent(old_cpu_softirq, cpu_softirq, delta); si->cpu.usage.steal = _usagePercent(old_cpu_steal, cpu_steal, delta); si->cpu.usage.guest = _usagePercent(old_cpu_guest, cpu_guest, delta); si->cpu.usage.guest_nice = _usagePercent(old_cpu_guest_nice, cpu_guest_nice, delta); } old_cpu_user = cpu_user; old_cpu_nice = cpu_nice; old_cpu_syst = cpu_syst; old_cpu_iowait = cpu_iowait; old_cpu_hardirq = cpu_hardirq; old_cpu_softirq = cpu_softirq; old_cpu_steal = cpu_steal; old_cpu_guest = cpu_guest; old_cpu_guest_nice = cpu_guest_nice; old_cpu_total = cpu_total; return true; error: si->cpu.usage.user = 0.; si->cpu.usage.nice = 0.; si->cpu.usage.system = 0.; si->cpu.usage.iowait = 0.; si->cpu.usage.hardirq = 0.; si->cpu.usage.softirq = 0.; si->cpu.usage.steal = 0.; si->cpu.usage.guest = 0.; si->cpu.usage.guest_nice = 0.; return false; } /** * This routine returns filedescriptors statistics * @return: true if successful, false if failed (or not available) */ bool used_system_filedescriptors_sysdep(SystemInfo_T *si) { bool rv = false; FILE *f = fopen("/proc/sys/fs/file-nr", "r"); if (f) { char line[STRLEN]; if (fgets(line, sizeof(line), f)) { if (sscanf(line, "%lld %lld %lld\n", &(si->filedescriptors.allocated), &(si->filedescriptors.unused), &(si->filedescriptors.maximum)) == 3) { rv = true; } } fclose(f); } else { DEBUG("system statistic error -- cannot open /proc/sys/fs/file-nr\n"); } return rv; } bool available_statistics(SystemInfo_T *si) { int rv; unsigned long long cpu_user; // Time spent in user mode unsigned long long cpu_nice; // Time spent in user mode with low priority (nice) unsigned long long cpu_syst; // Time spent in system mode unsigned long long cpu_idle; // Time idle unsigned long long cpu_iowait; // Time waiting for I/O to complete. This value is not reliable unsigned long long cpu_hardirq; // Time servicing hardware interrupts unsigned long long cpu_softirq; // Time servicing software interrupts unsigned long long cpu_steal; // Stolen time, which is the time spent in other operating systems when running in a virtualized environment unsigned long long cpu_guest; // Time spent running a virtual CPU for guest operating systems under the control of the Linux kernel unsigned long long cpu_guest_nice; // Time spent running a niced guest (virtual CPU for guest operating systems under the control of the Linux kernel) char buf[8192]; if (! file_readProc(buf, sizeof(buf), "stat", -1, NULL)) { Log_error("system statistic error -- cannot read /proc/stat\n"); return false; } rv = sscanf(buf, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu", &cpu_user, &cpu_nice, &cpu_syst, &cpu_idle, &cpu_iowait, &cpu_hardirq, &cpu_softirq, &cpu_steal, &cpu_guest, &cpu_guest_nice); switch (rv) { case 4: // linux < 2.5.41 si->statisticsAvailable |= Statistics_CpuUser | Statistics_CpuNice | Statistics_CpuSystem; break; case 5: // linux >= 2.5.41 si->statisticsAvailable |= Statistics_CpuUser | Statistics_CpuNice | Statistics_CpuSystem | Statistics_CpuIOWait; break; case 7: // linux >= 2.6.0-test4 si->statisticsAvailable |= Statistics_CpuUser | Statistics_CpuNice | Statistics_CpuSystem | Statistics_CpuIOWait | Statistics_CpuHardIRQ | Statistics_CpuSoftIRQ; break; case 8: // linux 2.6.11 si->statisticsAvailable |= Statistics_CpuUser | Statistics_CpuNice | Statistics_CpuSystem | Statistics_CpuIOWait | Statistics_CpuHardIRQ | Statistics_CpuSoftIRQ | Statistics_CpuSteal; break; case 9: // linux >= 2.6.24 si->statisticsAvailable |= Statistics_CpuUser | Statistics_CpuNice | Statistics_CpuSystem | Statistics_CpuIOWait | Statistics_CpuHardIRQ | Statistics_CpuSoftIRQ | Statistics_CpuSteal | Statistics_CpuGuest; break; case 10: // linux >= 2.6.33 si->statisticsAvailable |= Statistics_CpuUser | Statistics_CpuNice | Statistics_CpuSystem | Statistics_CpuIOWait | Statistics_CpuHardIRQ | Statistics_CpuSoftIRQ | Statistics_CpuSteal | Statistics_CpuGuest | Statistics_CpuGuestNice; break; default: Log_error("system statistic error -- cannot read cpu usage\n"); return false; } si->statisticsAvailable |= Statistics_FiledescriptorsPerSystem | Statistics_FiledescriptorsPerProcess; struct stat sb; if (stat("/proc/sys/fs/file-nr", &sb) == 0) si->statisticsAvailable |= Statistics_FiledescriptorsPerProcessMax; return true; } pid_t Sysdep_getMainThread(pid_t pid) { char path[PATH_MAX]; // Read PID's thread group (TGID) snprintf(path, sizeof(path), "/proc/%d/status", pid); FILE *fp = fopen(path, "r"); if (! fp) { // Process doesn't exist return 0; } char line[STRLEN]; pid_t tgid = -1; while (fgets(line, sizeof(line), fp)) { if (sscanf(line, "Tgid:\t%d", &tgid) == 1) { break; } } fclose(fp); // Return the thread group leader (main thread's PID) return tgid; } monit-5.35.2/src/process/SystemInfo.c0000644000016400001720000000721715007061157014372 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_SYS_TIME_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" #include "SystemInfo.h" /** * Initialize and update the global SystemInfo structure * * @file */ /* ------------------------------------------------------------- Definitions */ bool SystemInfo_init(void) { memset(&System_Info, 0, sizeof(SystemInfo_T)); gettimeofday(&System_Info.collected, NULL); if (uname(&System_Info.uname) < 0) { Log_error("'%s' resource monitoring initialization error -- uname failed: %s\n", Run.system->name, STRERROR); return false; } System_Info.cpu.usage.user = -1.; System_Info.cpu.usage.system = -1.; System_Info.cpu.usage.iowait = -1.; return (init_systeminfo_sysdep()); } bool SystemInfo_update(void) { if (getloadavg_sysdep(System_Info.loadavg, 3) == -1) { Log_error("'%s' statistic error -- load average data collection failed\n", Run.system->name); goto error1; } if (! used_system_memory_sysdep(&System_Info)) { Log_error("'%s' statistic error -- memory usage data collection failed\n", Run.system->name); goto error2; } System_Info.memory.usage.percent = System_Info.memory.size > 0ULL ? (100. * (double)System_Info.memory.usage.bytes / (double)System_Info.memory.size) : 0.; System_Info.swap.usage.percent = System_Info.swap.size > 0ULL ? (100. * (double)System_Info.swap.usage.bytes / (double)System_Info.swap.size) : 0.; if (! used_system_cpu_sysdep(&System_Info)) { Log_error("'%s' statistic error -- cpu usage data collection failed\n", Run.system->name); goto error3; } if (! used_system_filedescriptors_sysdep(&System_Info)) { Log_error("'%s' statistic error -- filedescriptors usage data collection failed\n", Run.system->name); goto error4; } return true; error1: System_Info.loadavg[0] = 0; System_Info.loadavg[1] = 0; System_Info.loadavg[2] = 0; error2: System_Info.memory.usage.bytes = 0ULL; System_Info.memory.usage.percent = 0.; System_Info.swap.usage.bytes = 0ULL; System_Info.swap.usage.percent = 0.; error3: System_Info.cpu.usage.user = 0.; System_Info.cpu.usage.system = 0.; System_Info.cpu.usage.iowait = 0.; error4: System_Info.filedescriptors.allocated = 0LL; System_Info.filedescriptors.unused = 0LL; System_Info.filedescriptors.maximum = 0LL; return false; } monit-5.35.2/src/process/SystemInfo.h0000644000016400001720000000246015007061157014372 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef SystemInfo_h #define SystemInfo_h /** * Initialize the system information * @return true if succeeded otherwise false. */ bool SystemInfo_init(void); /** * Update system statistic * @return true if successful, otherwise false */ bool SystemInfo_update(void); #endif /* SystemInfo_h */ monit-5.35.2/src/process/sysdep_UNKNOWN.c0000644000016400001720000000513315007061157015013 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" /** * System dependent resource data collecting code for UNKNOWN systems * * @file */ int init_systeminfo_sysdep(void) { return false; } /** * THIS IS JUST A DUMMY!!! * * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0 */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { return 0; } /** * THIS IS JUST A DUMMY!!! * * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep (double *loadv, int nelem) { for (int i = 0; i < nelem; i++) loadv[i] = 0.0; return -1; } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { return false; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed (or not available) */ bool used_system_cpu_sysdep(SystemInfo_T *si) { return false; } bool used_system_filedescriptors_sysdep(SystemInfo_T *si) { return false; } bool available_statistics(SystemInfo_T *si) { return false; } pid_t Sysdep_getMainThread(pid_t pid) { return 0; } monit-5.35.2/src/process/sysdep_SOLARIS.c0000644000016400001720000003605315007061157014775 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_SYS_LOADAVG_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_PROCFS_H #include #endif #ifdef HAVE_GLOB_H #include #endif #ifdef HAVE_KSTAT_H #include #endif #ifdef HAVE_SYS_SWAP_H #include #endif #ifdef HAVE_SYS_SYSINFO_H #include #endif #ifdef HAVE_ZONE_H #include #endif #ifdef HAVE_SYS_VM_USAGE_H #include #endif #include "monit.h" #include "system/Time.h" #include "ProcessTree.h" #include "process_sysdep.h" /** * System dependent resource data collecting code for Solaris. * * @file */ static int page_size; static long old_cpu_user = 0; static long old_cpu_syst = 0; static long old_cpu_iowait = 0; static long old_total = 0; #define MAXSTRSIZE 80 bool init_systeminfo_sysdep(void) { System_Info.cpu.count = sysconf( _SC_NPROCESSORS_ONLN); page_size = getpagesize(); System_Info.memory.size = (unsigned long long)sysconf(_SC_PHYS_PAGES) * (unsigned long long)page_size; kstat_ctl_t *kctl = kstat_open(); if (kctl) { kstat_t *kstat = kstat_lookup(kctl, "unix", 0, "system_misc"); if (kstat) { if (kstat_read(kctl, kstat, 0) != -1) { kstat_named_t *knamed = kstat_data_lookup(kstat, "boot_time"); if (knamed) System_Info.booted = (unsigned long long)knamed->value.ul; } } kstat_close(kctl); } return true; } double timestruc_to_tseconds(timestruc_t t) { return t.tv_sec * 10 + t.tv_nsec / 100000000.0; } /** * Read all processes of the proc files system to initialize the process tree * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0 */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { assert(reference); /* Find all processes in the /proc directory */ glob_t globbuf; int rv = glob("/proc/[0-9]*", 0, NULL, &globbuf); if (rv != 0) { Log_error("system statistic error -- glob failed: %d (%s)\n", rv, STRERROR); return 0; } int treesize = globbuf.gl_pathc; /* Allocate the tree */ ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), treesize); char buf[4096]; for (int i = 0; i < treesize; i++) { pt[i].pid = atoi(globbuf.gl_pathv[i] + strlen("/proc/")); if (file_readProc(buf, sizeof(buf), "psinfo", pt[i].pid, NULL)) { psinfo_t *psinfo = (psinfo_t *)&buf; pt[i].ppid = psinfo->pr_ppid; pt[i].cred.uid = psinfo->pr_uid; pt[i].cred.euid = psinfo->pr_euid; pt[i].cred.gid = psinfo->pr_gid; pt[i].uptime = System_Info.time / 10. - psinfo->pr_start.tv_sec; pt[i].zombie = psinfo->pr_nlwp == 0 ? true : false; // If we don't have any light-weight processes (LWP) then we are definitely a zombie pt[i].memory.usage = (unsigned long long)psinfo->pr_rssize * 1024; if (pflags & ProcessEngine_CollectCommandLine) { pt[i].cmdline = Str_dup(psinfo->pr_psargs); if (STR_UNDEF(pt[i].cmdline)) { FREE(pt[i].cmdline); pt[i].cmdline = Str_dup(psinfo->pr_fname); } } if (file_readProc(buf, sizeof(buf), "status", pt[i].pid, NULL)) { pstatus_t *pstatus = (pstatus_t *)&buf; pt[i].cpu.time = timestruc_to_tseconds(pstatus->pr_utime) + timestruc_to_tseconds(pstatus->pr_stime); pt[i].threads.self = pstatus->pr_nlwp; } if (file_readProc(buf, sizeof(buf), "usage", pt[i].pid, NULL)) { struct prusage *usage = (struct prusage *)&buf; pt[i].read.bytes = -1; pt[i].read.bytesPhysical = -1; pt[i].read.operations = usage->pr_inblk; pt[i].write.bytes = -1; pt[i].write.bytesPhysical = -1; pt[i].write.operations = usage->pr_oublk; pt[i].read.time = pt[i].write.time = Time_milli(); } } } *reference = pt; /* Free globbing buffer */ globfree(&globbuf); return treesize; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep (double *loadv, int nelem) { return getloadavg(loadv, nelem); } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { int n, num; kstat_ctl_t *kctl; kstat_named_t *knamed; kstat_t *kstat; swaptbl_t *s; char *strtab; unsigned long long total = 0ULL; unsigned long long used = 0ULL; /* Memory */ kctl = kstat_open(); zoneid_t zoneid = getzoneid(); if (zoneid != GLOBAL_ZONEID) { /* Zone */ if ((kstat = kstat_lookup(kctl, "memory_cap", -1, NULL))) { /* Joyent SmartOS zone: reports wrong unix::system_pages:freemem in the zone - shows global zone freemem, switch to SmartOS specific memory_cap kstat, which is more effective then common getvmusage() */ if (kstat_read(kctl, kstat, NULL) == -1) { Log_error("system statistic error -- memory_cap usage data collection failed\n"); kstat_close(kctl); return false; } kstat_named_t *rss = kstat_data_lookup(kstat, "rss"); if (rss) si->memory.usage.bytes = (unsigned long long)rss->value.i64; } else { /* Solaris Zone */ size_t nres; vmusage_t result; if (getvmusage(VMUSAGE_ZONE, Run.polltime, &result, &nres) != 0) { Log_error("system statistic error -- getvmusage failed\n"); kstat_close(kctl); return false; } si->memory.usage.bytes = (unsigned long long)result.vmu_rss_all; } } else { kstat = kstat_lookup(kctl, "unix", 0, "system_pages"); if (kstat_read(kctl, kstat, 0) == -1) { Log_error("system statistic error -- memory usage data collection failed\n"); kstat_close(kctl); return false; } knamed = kstat_data_lookup(kstat, "freemem"); if (knamed) { unsigned long long freemem = (unsigned long long)knamed->value.ul * (unsigned long long)page_size, arcsize = 0ULL; kstat = kstat_lookup(kctl, "zfs", 0, "arcstats"); if (kstat_read(kctl, kstat, 0) != -1) { knamed = kstat_data_lookup(kstat, "size"); arcsize = (unsigned long long)knamed->value.ul; } si->memory.usage.bytes = System_Info.memory.size - freemem - arcsize; } } kstat_close(kctl); /* Swap */ again: if ((num = swapctl(SC_GETNSWP, 0)) == -1) { Log_error("system statistic error -- swap usage data collection failed: %s\n", STRERROR); return false; } if (num == 0) { DEBUG("system statistic -- no swap configured\n"); si->swap.size = 0ULL; return true; } s = (swaptbl_t *)CALLOC(num, sizeof(swapent_t) + sizeof(struct swaptable)); strtab = (char *)CALLOC(num + 1, MAXSTRSIZE); for (int i = 0; i < (num + 1); i++) s->swt_ent[i].ste_path = strtab + (i * MAXSTRSIZE); s->swt_n = num + 1; if ((n = swapctl(SC_LIST, s)) < 0) { Log_error("system statistic error -- swap usage data collection failed: %s\n", STRERROR); si->swap.size = 0ULL; FREE(s); FREE(strtab); return false; } if (n > num) { DEBUG("system statistic -- new swap added: deferring swap usage statistics to next cycle\n"); FREE(s); FREE(strtab); goto again; } for (int i = 0; i < n; i++) { if (! (s->swt_ent[i].ste_flags & ST_INDEL) && ! (s->swt_ent[i].ste_flags & ST_DOINGDEL)) { total += s->swt_ent[i].ste_pages; used += s->swt_ent[i].ste_pages - s->swt_ent[i].ste_free; } } FREE(s); FREE(strtab); si->swap.size = (unsigned long long)total * (unsigned long long)page_size; si->swap.usage.bytes = (unsigned long long)used * (unsigned long long)page_size; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed (or not available) */ bool used_system_cpu_sysdep(SystemInfo_T *si) { int ncpu = 0, ncpus; long cpu_user = 0, cpu_syst = 0, cpu_iowait = 0, total = 0, diff_total; kstat_ctl_t *kctl; kstat_named_t *knamed; kstat_t *kstat; kstat_t **cpu_ks; cpu_stat_t *cpu_stat; si->cpu.usage.user = si->cpu.usage.system = si->cpu.usage.iowait = 0; kctl = kstat_open(); kstat = kstat_lookup(kctl, "unix", 0, "system_misc"); if (kstat_read(kctl, kstat, 0) == -1) { Log_error("system statistic -- failed to lookup unix::system_misc kstat\n"); goto error; } if (NULL == (knamed = kstat_data_lookup(kstat, "ncpus"))) { Log_error("system statistic -- ncpus kstat lookup failed\n"); goto error; } if ((ncpus = knamed->value.ui32) == 0) { Log_error("system statistic -- ncpus is 0\n"); goto error; } cpu_ks = (kstat_t **)CALLOC(ncpus, sizeof(kstat_t *)); cpu_stat = (cpu_stat_t *)CALLOC(ncpus, sizeof(cpu_stat_t)); for (kstat = kctl->kc_chain; kstat; kstat = kstat->ks_next) { if (strncmp(kstat->ks_name, "cpu_stat", 8) == 0) { if (-1 == kstat_read(kctl, kstat, NULL)) { Log_error("system statistic -- failed to read cpu_stat kstat\n"); goto error2; } cpu_ks[ncpu] = kstat; if (++ncpu > ncpus) { Log_error("system statistic -- cpu count mismatch\n"); goto error2; } } } for (int i = 0; i < ncpu; i++) { if (-1 == kstat_read(kctl, cpu_ks[i], &cpu_stat[i])) { Log_error("system statistic -- failed to read cpu_stat kstat for cpu %d\n", i); goto error2; } cpu_user += cpu_stat[i].cpu_sysinfo.cpu[CPU_USER]; cpu_syst += cpu_stat[i].cpu_sysinfo.cpu[CPU_KERNEL]; cpu_iowait += cpu_stat[i].cpu_sysinfo.cpu[CPU_WAIT]; total += (cpu_stat[i].cpu_sysinfo.cpu[0] + cpu_stat[i].cpu_sysinfo.cpu[1] + cpu_stat[i].cpu_sysinfo.cpu[2] + cpu_stat[i].cpu_sysinfo.cpu[3]); } if (old_total == 0) { si->cpu.usage.user = si->cpu.usage.system = si->cpu.usage.iowait = -1.; } else if ((diff_total = total - old_total) > 0) { si->cpu.usage.user = (100. * (cpu_user - old_cpu_user)) / diff_total; si->cpu.usage.system = (100. * (cpu_syst - old_cpu_syst)) / diff_total; si->cpu.usage.iowait = (100. * (cpu_iowait - old_cpu_iowait)) / diff_total; } old_cpu_user = cpu_user; old_cpu_syst = cpu_syst; old_cpu_iowait = cpu_iowait; old_total = total; FREE(cpu_ks); FREE(cpu_stat); kstat_close(kctl); return true; error2: old_total = 0; FREE(cpu_ks); FREE(cpu_stat); error: kstat_close(kctl); return false; } bool used_system_filedescriptors_sysdep(__attribute__ ((unused)) SystemInfo_T *si) { // Not implemented return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuIOWait; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/process/sysdep_OPENBSD.c0000644000016400001720000002747315007061157014761 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_PROC_H #include #endif #ifdef HAVE_SYS_VMMETER_H #include #endif #ifdef HAVE_KVM_H #include #endif #ifdef HAVE_UVM_UVM_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_SYS_SCHED_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" /** * System dependent resource data collecting code for OpenBSD. * * @file */ /* ----------------------------------------------------------------- Private */ static int pagesize; static long total_old = 0; static long cpu_user_old = 0; static long cpu_nice_old = 0; static long cpu_syst_old = 0; static long cpu_intr_old = 0; static unsigned int maxslp; /* ------------------------------------------------------------------ Public */ bool init_systeminfo_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(System_Info.cpu.count); if (sysctl(mib, 2, &System_Info.cpu.count, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); return false; } long long physmem; mib[1] = HW_PHYSMEM64; len = sizeof(physmem); if (sysctl(mib, 2, &physmem, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get real memory amount: %s\n", STRERROR); return false; } System_Info.memory.size = (unsigned long long)physmem; mib[1] = HW_PAGESIZE; len = sizeof(pagesize); if (sysctl(mib, 2, &pagesize, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get memory page size: %s\n", STRERROR); return false; } struct timeval booted; mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; len = sizeof(booted); if (sysctl(mib, 2, &booted, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.boottime failed: %s\n", STRERROR); return false; } else { System_Info.booted = booted.tv_sec; } return true; } /** * Read all processes to initialize the information tree. * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0 */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { int treesize; char buf[_POSIX2_LINE_MAX]; size_t size = sizeof(maxslp); int mib_proc[6] = {CTL_KERN, KERN_PROC, KERN_PROC_PID | KERN_PROC_SHOW_THREADS | KERN_PROC_KTHREAD, 0, sizeof(struct kinfo_proc), 0}; static struct kinfo_proc *pinfo; static int mib_maxslp[] = {CTL_VM, VM_MAXSLP}; ProcessTree_T *pt; kvm_t *kvm_handle; if (sysctl(mib_maxslp, 2, &maxslp, &size, NULL, 0) < 0) { Log_error("system statistic error -- vm.maxslp failed\n"); return 0; } // Get the size of the process table if (sysctl(mib_proc, 6, NULL, &size, NULL, 0) == -1) { Log_error("system statistic error -- kern.proc #1 failed\n"); return 0; } // Add reserve for new processes which were created between calls of sysctl size *= 2; // Get the process table pinfo = CALLOC(1, size); mib_proc[5] = (int)(size / sizeof(struct kinfo_proc)); if (sysctl(mib_proc, 6, pinfo, &size, NULL, 0) == -1) { FREE(pinfo); Log_error("system statistic error -- kern.proc #2 failed\n"); return 0; } treesize = (int)(size / sizeof(struct kinfo_proc)); pt = CALLOC(sizeof(ProcessTree_T), treesize); unsigned long long now = Time_milli(); if (! (kvm_handle = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, buf))) { FREE(pinfo); FREE(pt); Log_error("system statistic error -- kvm_openfiles failed: %s\n", buf); return 0; } int count = 0; StringBuffer_T cmdline = NULL; if (pflags & ProcessEngine_CollectCommandLine) cmdline = StringBuffer_create(64); for (int i = 0; i < treesize; i++) { int index = count; if (pinfo[i].p_tid < 0) { count++; pt[index].pid = pinfo[i].p_pid; pt[index].ppid = pinfo[i].p_ppid; pt[index].cred.uid = pinfo[i].p_ruid; pt[index].cred.euid = pinfo[i].p_uid; pt[index].cred.gid = pinfo[i].p_rgid; pt[index].uptime = System_Info.time / 10. - pinfo[i].p_ustart_sec; pt[index].cpu.time = pinfo[i].p_rtime_sec * 10 + (double)pinfo[i].p_rtime_usec / 100000.; pt[index].memory.usage = (unsigned long long)pinfo[i].p_vm_rssize * (unsigned long long)pagesize; pt[index].zombie = pinfo[i].p_stat == SZOMB ? true : false; pt[index].read.bytes = -1; pt[index].read.bytesPhysical = -1; pt[index].read.operations = pinfo[i].p_uru_inblock; pt[index].write.bytes = -1; pt[index].write.bytesPhysical = -1; pt[index].write.operations = pinfo[i].p_uru_oublock; pt[index].read.time = pt[i].write.time = now; if (pflags & ProcessEngine_CollectCommandLine) { char **args = kvm_getargv(kvm_handle, &pinfo[i], 0); if (args) { StringBuffer_clear(cmdline); for (int j = 0; args[j]; j++) StringBuffer_append(cmdline, args[j + 1] ? "%s " : "%s", args[j]); if (StringBuffer_length(cmdline)) pt[index].cmdline = Str_dup(StringBuffer_toString(StringBuffer_trim(cmdline))); } if (STR_UNDEF(pt[index].cmdline)) { FREE(pt[index].cmdline); pt[index].cmdline = Str_dup(pinfo[i].p_comm); } } } else { pt[index].threads.self++; } } if (pflags & ProcessEngine_CollectCommandLine) StringBuffer_free(&cmdline); FREE(pinfo); kvm_close(kvm_handle); *reference = pt; return count; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep (double *loadv, int nelem) { return getloadavg(loadv, nelem); } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { struct uvmexp vm; int mib[2] = {CTL_VM, VM_UVMEXP}; size_t len = sizeof(struct uvmexp); if (sysctl(mib, 2, &vm, &len, NULL, 0) == -1) { si->swap.size = 0ULL; Log_error("system statistic error -- cannot get memory usage: %s\n", STRERROR); return false; } si->memory.usage.bytes = (unsigned long long)(vm.active + vm.wired) * (unsigned long long)pagesize; si->swap.size = (unsigned long long)vm.swpages * (unsigned long long)pagesize; si->swap.usage.bytes = (unsigned long long)vm.swpginuse * (unsigned long long)pagesize; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ bool used_system_cpu_sysdep(SystemInfo_T *si) { int mib[] = {CTL_KERN, KERN_CPTIME}; long cp_time[CPUSTATES]; long total_new = 0; long total; size_t len; len = sizeof(cp_time); if (sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get cpu time: %s\n", STRERROR); return false; } for (int i = 0; i < CPUSTATES; i++) total_new += cp_time[i]; total = total_new - total_old; total_old = total_new; si->cpu.usage.user = (total > 0) ? (100. * (double)(cp_time[CP_USER] - cpu_user_old) / total) : -1.; si->cpu.usage.nice = (total > 0) ? (100. * (double)(cp_time[CP_NICE] - cpu_nice_old) / total) : -1.; si->cpu.usage.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.hardirq = (total > 0) ? (100. * (double)(cp_time[CP_INTR] - cpu_intr_old) / total) : -1.; cpu_user_old = cp_time[CP_USER]; cpu_nice_old = cp_time[CP_NICE]; cpu_syst_old = cp_time[CP_SYS]; cpu_intr_old = cp_time[CP_INTR]; return true; } bool used_system_filedescriptors_sysdep(SystemInfo_T *si) { // Open files int mib[2] = {CTL_KERN, KERN_NFILES}; size_t len = sizeof(si->filedescriptors.allocated); if (sysctl(mib, 2, &si->filedescriptors.allocated, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.nfiles failed: %s\n", STRERROR); return false; } // Max files mib[1] = KERN_MAXFILES; len = sizeof(si->filedescriptors.maximum); if (sysctl(mib, 2, &si->filedescriptors.maximum, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.maxfiles failed: %s\n", STRERROR); return false; } return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuNice | Statistics_CpuHardIRQ | Statistics_FiledescriptorsPerSystem; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/process/sysdep_DRAGONFLY.c0000644000016400001720000002757115007061157015213 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_KINFO_H #include #endif #ifdef HAVE_KVM_H #include #endif #ifdef HAVE_PATHS_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_PROC_H #include #endif #ifdef HAVE_SYS_USER_H #include #endif #ifdef HAVE_SYS_VMMETER_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_SYS_DKSTAT_H #include #endif #include "monit.h" #include "ProcessTree.h" #include "process_sysdep.h" /** * System dependent resource gathering code for DragonFly. * * @file */ /* ----------------------------------------------------------------- Private */ static int pagesize; static long total_old = 0; static long cpu_user_old = 0; static long cpu_nice_old = 0; static long cpu_syst_old = 0; static long cpu_intr_old = 0; /* ------------------------------------------------------------------ Public */ bool init_systeminfo_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(System_Info.cpu.count); if (sysctl(mib, 2, &System_Info.cpu.count, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); return false; } mib[1] = HW_PHYSMEM; len = sizeof(System_Info.memory.size); if (sysctl(mib, 2, &System_Info.memory.size, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get real memory amount: %s\n", STRERROR); return false; } mib[1] = HW_PAGESIZE; len = sizeof(pagesize); if (sysctl(mib, 2, &pagesize, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get memory page size: %s\n", STRERROR); return false; } struct timeval booted; size_t size = sizeof(booted); if (sysctlbyname("kern.boottime", &booted, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.boottime failed: %s\n", STRERROR); return false; } else { System_Info.booted = booted.tv_sec; } return true; } /** * Read all processes to initialize the information tree. * @param reference reference of ProcessTree * @param pflags Process engine flags * @return treesize > 0 if succeeded otherwise 0. */ int init_processtree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { kvm_t *kvm_handle = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, prog); if (! kvm_handle) { Log_error("system statistic error -- cannot initialize kvm interface\n"); return 0; } int treesize; struct kinfo_proc *pinfo = kvm_getprocs(kvm_handle, KERN_PROC_ALL, 0, &treesize); if (! pinfo || (treesize < 1)) { Log_error("system statistic error -- cannot get process tree\n"); kvm_close(kvm_handle); return 0; } ProcessTree_T *pt = CALLOC(sizeof(ProcessTree_T), treesize); unsigned long long now = Time_milli(); StringBuffer_T cmdline = NULL; if (pflags & ProcessEngine_CollectCommandLine) cmdline = StringBuffer_create(64); for (int i = 0; i < treesize; i++) { pt[i].pid = pinfo[i].kp_pid; pt[i].ppid = pinfo[i].kp_ppid; pt[i].cred.uid = pinfo[i].kp_ruid; pt[i].cred.euid = pinfo[i].kp_uid; pt[i].cred.gid = pinfo[i].kp_rgid; pt[i].threads.self = pinfo[i].kp_nthreads; pt[i].uptime = System_Info.time / 10. - pinfo[i].kp_start.tv_sec; pt[i].cpu.time = (double)((pinfo[i].kp_lwp.kl_uticks + pinfo[i].kp_lwp.kl_sticks + pinfo[i].kp_lwp.kl_iticks) / 1000000.); pt[i].memory.usage = (unsigned long long)pinfo[i].kp_vm_rssize * (unsigned long long)pagesize; pt[i].read.bytes = -1; pt[i].read.bytesPhysical = -1; pt[i].read.operations = pinfo[i].kp_ru.ru_inblock; pt[i].read.time = now; pt[i].write.bytes = -1; pt[i].write.bytesPhysical = -1; pt[i].write.operations = pinfo[i].kp_ru.ru_oublock; pt[i].write.time = now; pt[i].zombie = pinfo[i].kp_stat == SZOMB ? true : false; if (pflags & ProcessEngine_CollectCommandLine) { char **args = kvm_getargv(kvm_handle, &pinfo[i], 0); if (args) { StringBuffer_clear(cmdline); for (int j = 0; args[j]; j++) StringBuffer_append(cmdline, args[j + 1] ? "%s " : "%s", args[j]); if (StringBuffer_length(cmdline)) pt[i].cmdline = Str_dup(StringBuffer_toString(StringBuffer_trim(cmdline))); } if (STR_UNDEF(pt[i].cmdline)) { FREE(pt[i].cmdline); pt[i].cmdline = Str_dup(pinfo[i].kp_comm); } } } if (pflags & ProcessEngine_CollectCommandLine) StringBuffer_free(&cmdline); *reference = pt; kvm_close(kvm_handle); return treesize; } /** * This routine returns 'nelem' double precision floats containing * the load averages in 'loadv'; at most 3 values will be returned. * @param loadv destination of the load averages * @param nelem number of averages * @return: 0 if successful, -1 if failed (and all load averages are 0). */ int getloadavg_sysdep(double *loadv, int nelem) { return getloadavg(loadv, nelem); } /** * This routine returns kbyte of real memory in use. * @return: true if successful, false if failed (or not available) */ bool used_system_memory_sysdep(SystemInfo_T *si) { /* Memory */ size_t len = sizeof(unsigned int); unsigned int active; if (sysctlbyname("vm.stats.vm.v_active_count", &active, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get for active memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { Log_error("system statistic error -- active memory usage statics error\n"); return false; } unsigned int wired; if (sysctlbyname("vm.stats.vm.v_wire_count", &wired, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get for wired memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { Log_error("system statistic error -- wired memory usage statics error\n"); return false; } si->memory.usage.bytes = (unsigned long long)(active + wired) * (unsigned long long)pagesize; /* Swap */ unsigned int used; if (sysctlbyname("vm.swap_anon_use", &used, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0; return false; } si->swap.usage.bytes = (unsigned long long)used * (unsigned long long)pagesize; if (sysctlbyname("vm.swap_cache_use", &used, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0; return false; } si->swap.usage.bytes += (unsigned long long)used * (unsigned long long)pagesize; unsigned int free; if (sysctlbyname("vm.swap_size", &free, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0; return false; } si->swap.size = (unsigned long long)free * (unsigned long long)pagesize + si->swap.usage.bytes; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ bool used_system_cpu_sysdep(SystemInfo_T *si) { int mib[2]; long cp_time[CPUSTATES]; long total_new = 0; long total; size_t len; len = sizeof(mib); if (sysctlnametomib("kern.cp_time", mib, &len) == -1) { Log_error("system statistic error -- cannot get cpu time handler: %s\n", STRERROR); return false; } len = sizeof(cp_time); if (sysctl(mib, 2, &cp_time, &len, NULL, 0) == -1) { Log_error("system statistic error -- cannot get cpu time: %s\n", STRERROR); return false; } for (int i = 0; i < CPUSTATES; i++) total_new += cp_time[i]; total = total_new - total_old; total_old = total_new; si->cpu.usage.user = (total > 0) ? (100. * (double)(cp_time[CP_USER] - cpu_user_old) / total) : -1.; si->cpu.usage.nice = (total > 0) ? (100. * (double)(cp_time[CP_NICE] - cpu_nice_old) / total) : -1.; si->cpu.usage.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.hardirq = (total > 0) ? (100. * (double)(cp_time[CP_INTR] - cpu_intr_old) / total) : -1.; cpu_user_old = cp_time[CP_USER]; cpu_nice_old = cp_time[CP_NICE]; cpu_syst_old = cp_time[CP_SYS]; cpu_intr_old = cp_time[CP_INTR]; return true; } bool used_system_filedescriptors_sysdep(SystemInfo_T *si) { // Open files size_t len = sizeof(si->filedescriptors.allocated); if (sysctlbyname("kern.openfiles", &si->filedescriptors.allocated, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.openfiles failed: %s\n", STRERROR); return false; } // Max files int mib[2] = {CTL_KERN, KERN_MAXFILES}; len = sizeof(si->filedescriptors.maximum); if (sysctl(mib, 2, &si->filedescriptors.maximum, &len, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl kern.maxfiles failed: %s\n", STRERROR); return false; } return true; } bool available_statistics(SystemInfo_T *si) { si->statisticsAvailable = Statistics_CpuUser | Statistics_CpuSystem | Statistics_CpuNice | Statistics_CpuHardIRQ | Statistics_FiledescriptorsPerSystem; return true; } pid_t Sysdep_getMainThread(pid_t pid) { return pid; } monit-5.35.2/src/md5.c0000644000016400001720000003352215007061157011277 00000000000000/* Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com * Sub-licensed with modifications under AGPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "md5.h" #include #include #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN # define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) #else # define BYTE_ORDER 0 #endif #define T_MASK ((md5_word_t)~0) #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) #define T3 0x242070db #define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) #define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) #define T6 0x4787c62a #define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) #define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) #define T9 0x698098d8 #define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) #define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) #define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) #define T13 0x6b901122 #define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) #define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) #define T16 0x49b40821 #define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) #define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) #define T19 0x265e5a51 #define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) #define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) #define T22 0x02441453 #define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) #define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) #define T25 0x21e1cde6 #define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) #define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) #define T28 0x455a14ed #define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) #define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) #define T31 0x676f02d9 #define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) #define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) #define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) #define T35 0x6d9d6122 #define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) #define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) #define T38 0x4bdecfa9 #define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) #define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) #define T41 0x289b7ec6 #define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) #define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) #define T44 0x04881d05 #define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) #define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) #define T47 0x1fa27cf8 #define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) #define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) #define T50 0x432aff97 #define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) #define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) #define T53 0x655b59c3 #define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) #define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) #define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) #define T57 0x6fa87e4f #define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) #define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) #define T60 0x4e0811a1 #define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) #define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) #define T63 0x2ad7d2bb #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) #if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 12 __attribute__((no_sanitize("unsigned-integer-overflow", "unsigned-shift-base"))) #elif defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 4 __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif static void md5_process(md5_context_t *pms, const md5_byte_t *data /*[64]*/) { md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], d = pms->abcd[3]; md5_word_t t; #if BYTE_ORDER > 0 /* Define storage only for big-endian CPUs. */ md5_word_t X[16]; #else /* Define storage for little-endian or both types of CPUs. */ md5_word_t xbuf[16]; const md5_word_t *X; #endif { #if BYTE_ORDER == 0 /* * Determine dynamically whether this is a big-endian or * little-endian machine, since we can use a more efficient * algorithm on the latter. */ static const int w = 1; if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ #endif #if BYTE_ORDER <= 0 /* little-endian */ { /* * On little-endian machines, we can process properly aligned * data without copying it. */ if (! ((uintptr_t)data & 3)) { /* data are properly aligned */ X = (const md5_word_t *)data; } else { /* not aligned */ memcpy(xbuf, data, 64); X = xbuf; } } #endif #if BYTE_ORDER == 0 else /* dynamic big-endian */ #endif #if BYTE_ORDER >= 0 /* big-endian */ { /* * On big-endian machines, we must arrange the bytes in the * right order. */ const md5_byte_t *xp = data; int i; # if BYTE_ORDER == 0 X = xbuf; /* (dynamic only) */ # else # define xbuf X /* (static only) */ # endif for (i = 0; i < 16; ++i, xp += 4) xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); } #endif } #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) /* Round 1. */ /* Let [abcd k s i] denote the operation a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + F(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 7, T1); SET(d, a, b, c, 1, 12, T2); SET(c, d, a, b, 2, 17, T3); SET(b, c, d, a, 3, 22, T4); SET(a, b, c, d, 4, 7, T5); SET(d, a, b, c, 5, 12, T6); SET(c, d, a, b, 6, 17, T7); SET(b, c, d, a, 7, 22, T8); SET(a, b, c, d, 8, 7, T9); SET(d, a, b, c, 9, 12, T10); SET(c, d, a, b, 10, 17, T11); SET(b, c, d, a, 11, 22, T12); SET(a, b, c, d, 12, 7, T13); SET(d, a, b, c, 13, 12, T14); SET(c, d, a, b, 14, 17, T15); SET(b, c, d, a, 15, 22, T16); #undef SET /* Round 2. */ /* Let [abcd k s i] denote the operation a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + G(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 1, 5, T17); SET(d, a, b, c, 6, 9, T18); SET(c, d, a, b, 11, 14, T19); SET(b, c, d, a, 0, 20, T20); SET(a, b, c, d, 5, 5, T21); SET(d, a, b, c, 10, 9, T22); SET(c, d, a, b, 15, 14, T23); SET(b, c, d, a, 4, 20, T24); SET(a, b, c, d, 9, 5, T25); SET(d, a, b, c, 14, 9, T26); SET(c, d, a, b, 3, 14, T27); SET(b, c, d, a, 8, 20, T28); SET(a, b, c, d, 13, 5, T29); SET(d, a, b, c, 2, 9, T30); SET(c, d, a, b, 7, 14, T31); SET(b, c, d, a, 12, 20, T32); #undef SET /* Round 3. */ /* Let [abcd k s t] denote the operation a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ #define H(x, y, z) ((x) ^ (y) ^ (z)) #define SET(a, b, c, d, k, s, Ti)\ t = a + H(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 5, 4, T33); SET(d, a, b, c, 8, 11, T34); SET(c, d, a, b, 11, 16, T35); SET(b, c, d, a, 14, 23, T36); SET(a, b, c, d, 1, 4, T37); SET(d, a, b, c, 4, 11, T38); SET(c, d, a, b, 7, 16, T39); SET(b, c, d, a, 10, 23, T40); SET(a, b, c, d, 13, 4, T41); SET(d, a, b, c, 0, 11, T42); SET(c, d, a, b, 3, 16, T43); SET(b, c, d, a, 6, 23, T44); SET(a, b, c, d, 9, 4, T45); SET(d, a, b, c, 12, 11, T46); SET(c, d, a, b, 15, 16, T47); SET(b, c, d, a, 2, 23, T48); #undef SET /* Round 4. */ /* Let [abcd k s t] denote the operation a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ #define I(x, y, z) ((y) ^ ((x) | ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + I(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 6, T49); SET(d, a, b, c, 7, 10, T50); SET(c, d, a, b, 14, 15, T51); SET(b, c, d, a, 5, 21, T52); SET(a, b, c, d, 12, 6, T53); SET(d, a, b, c, 3, 10, T54); SET(c, d, a, b, 10, 15, T55); SET(b, c, d, a, 1, 21, T56); SET(a, b, c, d, 8, 6, T57); SET(d, a, b, c, 15, 10, T58); SET(c, d, a, b, 6, 15, T59); SET(b, c, d, a, 13, 21, T60); SET(a, b, c, d, 4, 6, T61); SET(d, a, b, c, 11, 10, T62); SET(c, d, a, b, 2, 15, T63); SET(b, c, d, a, 9, 21, T64); #undef SET /* Then perform the following additions. (That is increment each of the four registers by the value it had before this block was started.) */ pms->abcd[0] += a; pms->abcd[1] += b; pms->abcd[2] += c; pms->abcd[3] += d; } void md5_init(md5_context_t *pms) { pms->count[0] = pms->count[1] = 0; pms->abcd[0] = 0x67452301; pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; pms->abcd[3] = 0x10325476; } void md5_append(md5_context_t *pms, const md5_byte_t *data, int nbytes) { const md5_byte_t *p = data; int left = nbytes; int offset = (pms->count[0] >> 3) & 63; md5_word_t nbits = (md5_word_t)(nbytes << 3); if (nbytes <= 0) return; /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; if (pms->count[0] < nbits) pms->count[1]++; /* Process an initial partial block. */ if (offset) { int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); memcpy(pms->buf + offset, p, copy); if (offset + copy < 64) return; p += copy; left -= copy; md5_process(pms, pms->buf); } /* Process full blocks. */ for (; left >= 64; p += 64, left -= 64) md5_process(pms, p); /* Process a final partial block. */ if (left) memcpy(pms->buf, p, left); } #if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 12 __attribute__((no_sanitize("unsigned-integer-overflow", "unsigned-shift-base"))) #elif defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 4 __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif void md5_finish(md5_context_t *pms, md5_byte_t digest[16]) { static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; md5_byte_t data[8]; /* Save the length before padding. */ for (int i = 0; i < 8; ++i) data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); /* Pad to 56 bytes mod 64. */ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); /* Append the length. */ md5_append(pms, data, 8); for (int i = 0; i < 16; ++i) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } monit-5.35.2/src/event.c0000644000016400001720000010037015007061157011727 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_DIRENT_H #include #endif #include "monit.h" #include "alert.h" #include "event.h" #include "state.h" #include "MMonit.h" #include "spawn.h" // libmonit #include "io/File.h" #include "system/Time.h" /** * Implementation of the event interface. * * @file */ /* ------------------------------------------------------------- Definitions */ EventTable_T Event_Table[] = { {Event_Action, "Action done", "Action done", "Action done", "Action done", State_None}, {Event_ByteIn, "Download bytes exceeded", "Download bytes ok", "Download bytes changed", "Download bytes not changed", State_None}, {Event_ByteOut, "Upload bytes exceeded", "Upload bytes ok", "Upload bytes changed", "Upload bytes not changed", State_None}, {Event_Checksum, "Checksum failed", "Checksum succeeded", "Checksum changed", "Checksum not changed", State_None}, {Event_Connection, "Connection failed", "Connection succeeded", "Connection changed", "Connection not changed", State_Changed}, {Event_Content, "Content failed", "Content succeeded", "Content match", "Content doesn't match", State_Changed}, {Event_Data, "Data access error", "Data access succeeded", "Data access changed", "Data access not changed", State_None}, {Event_Exec, "Execution failed", "Execution succeeded", "Execution changed", "Execution not changed", State_None}, {Event_FsFlag, "Filesystem flags failed", "Filesystem flags succeeded", "Filesystem flags changed", "Filesystem flags not changed", State_None}, {Event_Gid, "GID failed", "GID succeeded", "GID changed", "GID not changed", State_None}, {Event_Heartbeat, "Heartbeat failed", "Heartbeat succeeded", "Heartbeat changed", "Heartbeat not changed", State_None}, {Event_Icmp, "ICMP failed", "ICMP succeeded", "ICMP changed", "ICMP not changed", State_None}, {Event_Instance, "Monit instance failed", "Monit instance succeeded", "Monit instance changed", "Monit instance not changed", State_None}, {Event_Invalid, "Invalid type", "Type succeeded", "Type changed", "Type not changed", State_None}, {Event_Link, "Link down", "Link up", "Link changed", "Link not changed", State_None}, {Event_NonExist, "Does not exist", "Exists", "Existence changed", "Existence not changed", State_None}, {Event_PacketIn, "Download packets exceeded", "Download packets ok", "Download packets changed", "Download packets not changed", State_None}, {Event_PacketOut, "Upload packets exceeded", "Upload packets ok", "Upload packets changed", "Upload packets not changed", State_None}, {Event_Permission, "Permission failed", "Permission succeeded", "Permission changed", "Permission not changed", State_None}, {Event_Pid, "PID failed", "PID succeeded", "PID changed", "PID not changed", State_None}, {Event_PPid, "PPID failed", "PPID succeeded", "PPID changed", "PPID not changed", State_None}, {Event_Resource, "Resource limit matched", "Resource limit succeeded", "Resource limit changed", "Resource limit not changed", State_None}, {Event_Saturation, "Saturation exceeded", "Saturation ok", "Saturation changed", "Saturation not changed", State_None}, {Event_Size, "Size failed", "Size succeeded", "Size changed", "Size not changed", State_Changed}, {Event_Speed, "Speed failed", "Speed ok", "Speed changed", "Speed not changed", State_Changed}, {Event_Status, "Status failed", "Status succeeded", "Status changed", "Status not changed", State_None}, {Event_Timeout, "Timeout", "Timeout recovery", "Timeout changed", "Timeout not changed", State_None}, {Event_Timestamp, "Timestamp failed", "Timestamp succeeded", "Timestamp changed", "Timestamp not changed", State_Changed}, {Event_Uid, "UID failed", "UID succeeded", "UID changed", "UID not changed", State_None}, {Event_Uptime, "Uptime failed", "Uptime succeeded", "Uptime changed", "Uptime not changed", State_None}, {Event_Exist, "Does exist", "Exists not", "Existence changed", "Existence not changed", State_None}, /* Virtual events */ {Event_Null, "No Event", "No Event", "No Event", "No Event", State_None} }; /* ----------------------------------------------------------------- Private */ static void _saveState(long id, State_Type state) { EventTable_T *et = Event_Table; while ((*et).id) { if ((*et).id == id) { if ((*et).saveState & state) { State_dirty(); } break; } et++; } } /** * Return the actual event state based on event state bitmap and event ratio needed to trigger the state change * @param E An event object * @param S Actual posted state * @return The event state */ static bool _checkState(Event_T E, State_Type S) { assert(E); int count = 0; State_Type state = (S == State_Succeeded || S == State_ChangedNot) ? State_Succeeded : State_Failed; /* translate to 0/1 class */ /* Only failed/changed state condition can change the initial state */ if (! state && E->state == State_Init && ! (E->source->error & E->id)) return false; Action_T action = ! state ? E->action->succeeded : E->action->failed; /* Compare as many bits as cycles able to trigger the action */ for (int i = 0; i < action->cycles; i++) { /* Check the state of the particular cycle given by the bit position */ State_Type flag = (E->state_map >> i) & 0x1; /* Count occurrences of the posted state */ if (flag == state) count++; } /* the internal instance and action events are handled as changed any time since we need to deliver alert whenever it occurs */ if (E->id == Event_Instance || E->id == Event_Action || (count >= action->count && (S != E->state || S == State_Changed))) { memset(&(E->state_map), state, sizeof(E->state_map)); // Restart state map on state change, so we'll not flicker on multiple-failures condition (next state change requires full number of cycles to pass) return true; } return false; } /** * Add the partially handled event to the global queue * @param E An event object */ static void _queueAdd(Event_T E) { assert(E); assert(E->flag != Handler_Succeeded); if (! file_checkQueueDirectory(Run.eventlist_dir)) { Log_error("Aborting event - cannot access the event queue directory %s\n", Run.eventlist_dir); return; } if (! file_checkQueueLimit(Run.eventlist_dir, Run.eventlist_slots)) { Log_error("Aborting event - queue over quota\n"); return; } /* compose the file name of actual timestamp and service name */ char file_name[PATH_MAX]; snprintf(file_name, PATH_MAX, "%s/%lld_%lx", Run.eventlist_dir, (long long)Time_now(), (long unsigned)E->source->name); Log_info("Adding event to the queue file %s for later delivery\n", file_name); FILE *file = fopen(file_name, "w"); if (! file) { Log_error("Aborting event - cannot create event file %s -- %s\n", file_name, STRERROR); return; } bool rv; /* write event structure version */ int version = EVENT_VERSION; if (! (rv = file_writeQueue(file, &version, sizeof(int)))) goto error; /* write event structure */ if (! (rv = file_writeQueue(file, E, sizeof(*E)))) goto error; /* write source */ if (! (rv = file_writeQueue(file, E->source->name, strlen(E->source->name) + 1))) goto error; /* write message */ if (! (rv = file_writeQueue(file, E->message, E->message ? strlen(E->message) + 1 : 0))) goto error; /* write event action */ Action_Type action = Event_get_action(E); if (! (rv = file_writeQueue(file, &action, sizeof(Action_Type)))) goto error; error: fclose(file); if (! rv) { Log_error("Aborting event - unable to save event information to %s\n", file_name); if (unlink(file_name) < 0) Log_error("Failed to remove event file '%s' -- %s\n", file_name, STRERROR); } else { if (! (Run.flags & Run_HandlerInit) && E->flag & Handler_Alert) Run.handler_queue[Handler_Alert]++; if (! (Run.flags & Run_HandlerInit) && E->flag & Handler_Mmonit) Run.handler_queue[Handler_Mmonit]++; } } /** * Update the partially handled event in the global queue * @param E An event object * @param file_name File name */ static void _queueUpdate(Event_T E, const char *file_name) { int version = EVENT_VERSION; Action_Type action = Event_get_action(E); bool rv; assert(E); assert(E->flag != Handler_Succeeded); if (! file_checkQueueDirectory(Run.eventlist_dir)) { Log_error("Aborting event - cannot access the event queue directory %s\n", Run.eventlist_dir); return; } DEBUG("Updating event in the queue file %s for later delivery\n", file_name); FILE *file = fopen(file_name, "w"); if (! file) { Log_error("Aborting event - cannot open the event file %s -- %s\n", file_name, STRERROR); return; } /* write event structure version */ if (! (rv = file_writeQueue(file, &version, sizeof(int)))) goto error; /* write event structure */ if (! (rv = file_writeQueue(file, E, sizeof(*E)))) goto error; /* write source */ if (! (rv = file_writeQueue(file, E->source->name, strlen(E->source->name) + 1))) goto error; /* write message */ if (! (rv = file_writeQueue(file, E->message, E->message ? strlen(E->message) + 1 : 0))) goto error; /* write event action */ if (! (rv = file_writeQueue(file, &action, sizeof(Action_Type)))) goto error; error: fclose(file); if (! rv) { Log_error("Aborting event - unable to update event information in '%s'\n", file_name); if (unlink(file_name) < 0) Log_error("Failed to remove event file '%s' -- %s\n", file_name, STRERROR); } } static void _handleAction(Event_T E, Action_T A) { assert(E); assert(A); E->flag = Handler_Succeeded; if (A->id != Action_Ignored) { /* Alert and mmonit event notification are common actions */ E->flag |= MMonit_send(E); E->flag |= handle_alert(E); /* In the case that some subhandler failed, enqueue the event for partial reprocessing */ if (E->flag != Handler_Succeeded) { if (Run.eventlist_dir) _queueAdd(E); else Log_error("Aborting event\n"); } /* Action event is handled already. For Instance events we don't want actions like stop to be executed to prevent the disabling of system service monitoring */ if (A->id == Action_Alert || E->id == Event_Instance) { return; } else if (A->id == Action_Exec) { if (E->state_changed || (E->state && A->repeat && E->count % A->repeat == 0)) { Log_info("'%s' exec: '%s'\n", E->source->name, Util_commandDescription(A->exec, (char[STRLEN]){})); char spawn_error[STRLEN] = {"?"}; if (spawn(&(struct spawn_args_t){ .S = E->source, .cmd = A->exec, .E = E, .err = spawn_error, .errlen = STRLEN }) < 0) { Log_error("'%s' exec failed -- '%s'\n", E->source->name, spawn_error); } return; } } else { if (E->source->actionratelist && (A->id == Action_Start || A->id == Action_Restart)) { E->source->nstart++; State_dirty(); } if (E->source->mode == Monitor_Passive && (A->id == Action_Start || A->id == Action_Stop || A->id == Action_Restart)) return; // Warning: the control_service() on stop/unmonitor may free the list of events linked to this service, including this event => do not use event after this call: control_service(E->source->name, A->id); } } } static void _handleEvent(Service_T S, Event_T E) { assert(E); assert(E->action); assert(E->action->failed); assert(E->action->succeeded); /* We will handle only first succeeded event, recurrent succeeded events * or insufficient succeeded events during failed service state are * ignored. Failed events are handled each time. */ if (! E->state_changed && (E->state == State_Succeeded || E->state == State_ChangedNot || ((E->state_map & 0x1) ^ 0x1))) { DEBUG("'%s' %s\n", S->name, E->message); return; } if (E->message) { if (E->id == Event_Instance || E->id == Event_Action) { // Instance and action events are logged always with priority info Log_info("'%s' %s\n", S->name, E->message); } else if (E->state == State_Succeeded || E->state == State_ChangedNot) { if (E->state_map & 0x1) { // Failure, but didn't reach the error threshold yet Log_warning("'%s' %s\n", S->name, E->message); } else { // Success Log_info("'%s' %s\n", S->name, E->message); } } else if (E->state == State_Init) { if (E->state_map & 0x1) { // Log error which occur while the service is initializing as warnings, success is not logged in the initializing state Log_warning("'%s' %s\n", S->name, E->message); } return; } else { Log_error("'%s' %s\n", S->name, E->message); } } if (E->state == State_Failed || E->state == State_Changed) { if (E->id != Event_Instance && E->id != Event_Action) { // We are not interested in setting error flag for instance and action events S->error |= E->id; /* The error hint provides second dimension for error bitmap and differentiates between failed/changed event states (failed=0, changed=1) */ if (E->state == State_Changed) S->error_hint |= E->id; else S->error_hint &= ~E->id; } _handleAction(E, E->action->failed); } else { S->error &= ~E->id; _handleAction(E, E->action->succeeded); } } #if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 12 __attribute__((no_sanitize("unsigned-integer-overflow", "unsigned-shift-base"))) #elif defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 4 __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif static unsigned long long left_shift(unsigned long long v) { return v << 1; } /* ------------------------------------------------------------------ Public */ /** * Post a new Event * @param service The Service the event belongs to * @param id The event identification * @param state The event state * @param action Description of the event action * @param s Optional message describing the event */ void Event_post(Service_T service, long id, State_Type state, EventAction_T action, const char *s, ...) { assert(service); assert(action); assert(s); assert(state == State_Failed || state == State_Succeeded || state == State_Changed || state == State_ChangedNot); _saveState(id, state); va_list ap; va_start(ap, s); char *message = Str_vcat(s, ap); va_end(ap); Event_T e = service->eventlist; while (e) { if (e->action == action && e->id == id) { gettimeofday(&e->collected, NULL); /* Shift the existing event flags to the left and set the first bit based on actual state */ e->state_map = left_shift(e->state_map); e->state_map |= ((state == State_Succeeded || state == State_ChangedNot) ? 0 : 1); /* Update the message */ FREE(e->message); e->message = message; break; } e = e->next; } if (! e) { /* Only first failed/changed event can initialize the queue for given event type, thus succeeded events are ignored until first error. */ if (state == State_Succeeded || state == State_ChangedNot) { DEBUG("'%s' %s\n", service->name, message); FREE(message); return; } /* Initialize the event. The mandatory information is cloned so the event is as standalone as possible and may be saved * to the queue without the dependency on the original service, thus persistent and manageable across monit restarts */ NEW(e); e->id = id; gettimeofday(&e->collected, NULL); e->source = service; e->mode = service->mode; e->type = service->type; e->state = State_Init; e->state_map = 1; e->action = action; e->message = message; e->next = service->eventlist; service->eventlist = e; } e->state_changed = _checkState(e, state); /* In the case that the state changed, update it and reset the counter */ if (e->state_changed) { e->state = state; e->count = 1; } else { e->count++; } _handleEvent(service, e); } /** * Get a textual description of actual event type. * @param E An event object * @return A string describing the event type in clear text. If the * event type is not found NULL is returned. */ const char *Event_get_description(Event_T E) { assert(E); EventTable_T *et = Event_Table; while ((*et).id) { if (E->id == (*et).id) { switch (E->state) { case State_Succeeded: return (*et).description_succeeded; case State_Failed: return (*et).description_failed; case State_Init: return (*et).description_failed; case State_Changed: return (*et).description_changed; case State_ChangedNot: return (*et).description_changednot; default: break; } } et++; } return NULL; } /** * Get an event action id. * @param E An event object * @return An action id */ Action_Type Event_get_action(Event_T E) { assert(E); Action_T A = NULL; switch (E->state) { case State_Succeeded: case State_ChangedNot: A = E->action->succeeded; break; case State_Failed: case State_Changed: case State_Init: A = E->action->failed; break; default: Log_error("Invalid event state: %d\n", E->state); return Action_Ignored; } if (! A) return Action_Ignored; /* In the case of passive mode we replace the description of start, stop or restart action for alert action, because these actions are passive in this mode */ return (E->mode == Monitor_Passive && ((A->id == Action_Start) || (A->id == Action_Stop) || (A->id == Action_Restart))) ? Action_Alert : A->id; } /** * Get a textual description of actual event action. For instance if the * event type is positive Event_NonExist, the textual description of * failed state related action is "restart". Likewise if the event type is * negative Event_Checksumthe textual description of recovery related action * is "alert" and so on. * @param E An event object * @return A string describing the event type in clear text. If the * event type is not found NULL is returned. */ const char *Event_get_action_description(Event_T E) { assert(E); return Action_Names[Event_get_action(E)]; } /** * Reprocess the partially handled event queue */ void Event_queue_process(void) { /* return in the case that the eventqueue is not enabled or empty */ if (! Run.eventlist_dir || (! (Run.flags & Run_HandlerInit) && ! Run.handler_queue[Handler_Alert] && ! Run.handler_queue[Handler_Mmonit])) return; DIR *dir = opendir(Run.eventlist_dir); if (! dir) { if (errno != ENOENT) Log_error("Cannot open the directory %s -- %s\n", Run.eventlist_dir, STRERROR); return; } struct dirent *de = readdir(dir); if (de) DEBUG("Processing postponed events queue\n"); Action_T a; NEW(a); EventAction_T ea; NEW(ea); while (de) { int handlers_passed = 0; /* In the case that all handlers failed, skip the further processing in this cycle. Alert handler is currently defined anytime (either explicitly or localhost by default) */ if ( (Run.mmonits && FLAG(Run.handler_flag, Handler_Mmonit) && FLAG(Run.handler_flag, Handler_Alert)) || FLAG(Run.handler_flag, Handler_Alert)) break; char file_name[PATH_MAX]; snprintf(file_name, sizeof(file_name), "%s/%s", Run.eventlist_dir, de->d_name); if (File_isFile(file_name)) { DEBUG("Processing queued event '%s'\n", file_name); FILE *file = fopen(file_name, "r"); if (! file) { Log_error("Queued event processing failed - cannot open the file '%s' -- %s\n", file_name, STRERROR); goto error1; } size_t size; /* read event structure version */ int *version = file_readQueue(file, &size); if (! version) { DEBUG("Skipping file '%s' - not event queue data formatted\n", file_name); goto error2; } if (size != sizeof(int)) { Log_error("Aborting queued event %s - invalid size %lu\n", file_name, (unsigned long)size); goto error3; } if (*version != EVENT_VERSION) { Log_error("Aborting queued event %s - incompatible data format version %d\n", file_name, *version); goto error3; } /* read event structure */ Event_T e = file_readQueue(file, &size); if (! e) goto error3; if (size != sizeof(*e)) goto error4; /* read source */ char *service = file_readQueue(file, &size); if (! service) goto error4; if (! (e->source = Util_getService(service))) { Log_error("Aborting queued event '%s' - service %s not found in monit configuration\n", file_name, service); FREE(service); goto error4; } FREE(service); /* read message */ if (! (e->message = file_readQueue(file, &size))) goto error4; /* read event action */ Action_Type *action = file_readQueue(file, &size); if (! action) goto error5; if (size != sizeof(Action_Type)) goto error6; a->id = *action; switch (e->state) { case State_Succeeded: case State_ChangedNot: ea->succeeded = a; break; case State_Failed: case State_Changed: case State_Init: ea->failed = a; break; default: Log_error("Aborting queue event %s -- invalid state: %d\n", file_name, e->state); goto error6; } e->action = ea; /* Retry all remaining handlers */ /* alert */ if (e->flag & Handler_Alert) { if (Run.flags & Run_HandlerInit) Run.handler_queue[Handler_Alert]++; if ((Run.handler_flag & Handler_Alert) != Handler_Alert) { if (handle_alert(e) != Handler_Alert) { e->flag &= ~Handler_Alert; Run.handler_queue[Handler_Alert]--; handlers_passed++; } else { Log_error("Alert handler failed, retry scheduled for next cycle\n"); Run.handler_flag |= Handler_Alert; } } } /* mmonit */ if (e->flag & Handler_Mmonit) { if (Run.flags & Run_HandlerInit) Run.handler_queue[Handler_Mmonit]++; if ((Run.handler_flag & Handler_Mmonit) != Handler_Mmonit) { if (MMonit_send(e) != Handler_Mmonit) { e->flag &= ~Handler_Mmonit; Run.handler_queue[Handler_Mmonit]--; handlers_passed++; } else { Log_error("M/Monit handler failed, retry scheduled for next cycle\n"); Run.handler_flag |= Handler_Mmonit; } } } /* If no error persists, remove it from the queue */ if (e->flag == Handler_Succeeded) { DEBUG("Removing queued event %s\n", file_name); if (unlink(file_name) < 0) Log_error("Failed to remove queued event file '%s' -- %s\n", file_name, STRERROR); } else if (handlers_passed > 0) { DEBUG("Updating queued event %s (some handlers passed)\n", file_name); _queueUpdate(e, file_name); } error6: FREE(action); error5: FREE(e->message); error4: FREE(e); error3: FREE(version); error2: fclose(file); } error1: de = readdir(dir); } Run.flags &= ~Run_HandlerInit; closedir(dir); FREE(a); FREE(ea); } monit-5.35.2/src/l.l0000644000016400001720000011151415007061157011054 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ %option noyywrap %{ /* Turn off unreachable code warnings for the entire generated lexer */ #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunreachable-code" #endif /* * DESCRIPTION * * Lexical grammar for tokenizing the control file. * */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_GLOB_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #include "monit.h" #include "y.tab.h" // libmonit #include "util/Str.h" // we don't use yyinput => do not generate it #define YY_NO_INPUT #define MAX_STACK_DEPTH 1024 int buffer_stack_ptr = 0; struct buffer_stack_s { int lineno; char *currentfile; YY_BUFFER_STATE buffer; } buffer_stack[MAX_STACK_DEPTH]; int lineno = 1; int arglineno = 1; char *currentfile = NULL; char *argcurrentfile = NULL; char *argyytext = NULL; typedef enum { Proc_State, File_State, FileSys_State, Dir_State, Host_State, System_State, Fifo_State, Program_State, Net_State, None_State } Check_State; static Check_State check_state = None_State; /* Prototypes */ extern void yyerror(const char *,...); extern void yyerror2(const char *,...); extern void yywarning(const char *,...); extern void yywarning2(const char *,...); static void steplinenobycr(char *); static void save_arg(void); static void include_file(char *); static char *handle_quoted_string(char *); static void push_buffer_state(YY_BUFFER_STATE, const char*); static int pop_buffer_state(void); static URL_T create_URL(char *proto); %} ws [ \r\t]+ wws [ \r\t;,()]+ number [0-9]+ real [0-9]+([.][0-9]+)? str [^\000-\041@:{}"';(),%]+ address [^\000-\041<>{}\[\]]+ addrname [^\000-\037@<>{}\[\]]+ hostname {str}(\.{str})* dec-octet [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5] h16 [0-9A-Fa-f]{1,4} ipv4 {dec-octet}\.{dec-octet}\.{dec-octet}\.{dec-octet} ls32 {h16}:{h16}|{ipv4} ipv6 ({h16}:){6}{ls32}|::({h16}:){5}{ls32}|({h16})?::({h16}:){4}{ls32}|(({h16}:){0,1}{h16})?::({h16}:){3}{ls32}|(({h16}:){0,2}{h16})?::({h16}:){2}{ls32}|(({h16}:){0,3}{h16})?::{h16}:{ls32}|(({h16}:){0,4}{h16})?::{ls32}|(({h16}:){0,5}{h16})?::{h16}|(({h16}:){0,6}{h16})?:: greater ("more"|"greater"|"gt"|">"|"older") greaterorequal ("ge"|">=") less ("less"|"lt"|"<"|"newer") lessorequal ("le"|"<=") equal ("equal"|"eq"|"=="|"=") notequal ("notequal"|"ne"|"!=") loadavg1 load(avg)[ ]*(\([ ]*1[ ]*(m|min)?[ ]*\))? loadavg5 load(avg)[ ]*\([ ]*5[ ]*(m|min)?[ ]*\) loadavg15 load(avg)[ ]*\([ ]*15[ ]*(m|min)?[ ]*\) cpuuser cpu[ ]*(usage)*[ ]*\([ ]*(us|usr|user)?[ ]*\) cpusyst cpu[ ]*(usage)*[ ]*\([ ]*(sy|sys|system)?[ ]*\) cpuwait cpu[ ]*(usage)*[ ]*\([ ]*(wa|wait)?[ ]*\) cpunice cpu[ ]*(usage)*[ ]*\([ ]*nice[ ]*\) cpuhardirq cpu[ ]*(usage)*[ ]*\([ ]*hardirq[ ]*\) cpusoftirq cpu[ ]*(usage)*[ ]*\([ ]*softirq[ ]*\) cpusteal cpu[ ]*(usage)*[ ]*\([ ]*steal[ ]*\) cpuguest cpu[ ]*(usage)*[ ]*\([ ]*guest[ ]*\) cpuguestnice cpu[ ]*(usage)*[ ]*\([ ]*guestnice[ ]*\) startarg start{ws}?(program)?{ws}?([=]{ws}?)?["] stoparg stop{ws}?(program)?{ws}?([=]{ws}?)?["] restartarg restart{ws}?(program)?{ws}?([=]{ws}?)?["] execarg exec(ute)?{ws}?["] pathtokarg path{ws}?["] percent ("percent"|"%") byte ("byte"|"bytes"|"b")("/s")? kilobyte ("kilobyte"|"kilobytes"|"kb")("/s")? megabyte ("megabyte"|"megabytes"|"mb")("/s")? gigabyte ("gigabyte"|"gigabytes"|"gb")("/s")? millisecond ("millisecond"|"milliseconds"|"ms") second ("second"|"seconds"|"s") minute ("minute"|"minutes"|"m") hour ("hour"|"hours"|"h") day ("day"|"days") month ("month"|"months") atime ("atime"|"access time"|"access timestamp") ctime ("ctime"|"change time"|"change timestamp") mtime ("mtime"|"modification time"|"modification timestamp"|"modify time"|"modify timestamp") %x ARGUMENT_COND DEPEND_COND SERVICE_COND URL_COND ADDRESS_COND STRING_COND HOSTGROUP_COND EVERY_COND HTTP_HEADER_COND INCLUDE %% {wws} { /* Wide white space */ } (#.*)?\\?\n? { lineno++; } is {/* EMPTY */} as {/* EMPTY */} are {/* EMPTY */} for {/* EMPTY */} via {/* EMPTY */} on(ly)? {/* EMPTY */} with(in|out)? {/* EMPTY */} program(s)? {/* EMPTY */} and {/* EMPTY */} has {/* EMPTY */} using {/* EMPTY */} use {/* EMPTY */} the {/* EMPTY */} to {/* EMPTY */} sum {/* EMPTY */} than {/* EMPTY */} usage {/* EMPTY */} was {/* EMPTY */} times {/* EMPTY */} but {/* EMPTY */} of {/* EMPTY */} or {/* EMPTY */} does {/* EMPTY */} per {/* EMPTY */} in {/* EMPTY */} last {/* EMPTY */} rate {/* EMPTY */} capacity {/* EMPTY */} activity {/* EMPTY */} option(s)? {/* EMPTY */} ssl[ \t]+disable {/* EMPTY */} disable[ \t]+ssl {/* EMPTY */} {startarg} { BEGIN(ARGUMENT_COND); return START; } {stoparg} { BEGIN(ARGUMENT_COND); return STOP; } {restartarg} { BEGIN(ARGUMENT_COND); return RESTART; } {execarg} { BEGIN(ARGUMENT_COND); return EXEC; } {pathtokarg} { if (check_state == Program_State) { BEGIN(ARGUMENT_COND); // Parse Path for program as arguments return PATHTOK; } else { unput('"'); return PATHTOK; } } if { return IF; } then { return THEN; } failed { return FAILED; } tls { return SSLTOKEN; } ssl { return SSLTOKEN; } ssl[ \t]+enable { return SSLTOKEN; } enable[ ]+ssl { return SSLTOKEN; } enable { return ENABLE; } disable { return DISABLE; } verify { return VERIFY; } valid { return VALID; } certificate { return CERTIFICATE; } cacertificatefile { return CACERTIFICATEFILE; } cacertificatepath { return CACERTIFICATEPATH; } set { return SET; } daemon { return DAEMON; } delay { return DELAY; } terminal { return TERMINAL; } batch { return BATCH; } log { return LOGFILE; } logfile { return LOGFILE; } syslog { return SYSLOG; } facility { return FACILITY; } httpd { return HTTPD; } address { return ADDRESS; } interface { return INTERFACE; } link { return LINK; } packet(s)?("/s")? { return PACKET; } bytein { return BYTEIN; } byteout { return BYTEOUT; } packetin { return PACKETIN; } packetout { return PACKETOUT; } upload(ed)? { return UPLOAD; } download(ed)? { return DOWNLOAD; } up { return UP; } down { return DOWN; } saturation { return SATURATION; } speed { return SPEED; } total { return TOTAL; } clientpemfile { return CLIENTPEMFILE; } allowselfcertification { return ALLOWSELFCERTIFICATION; } selfsigned { return SELFSIGNED; } certmd5 { return CERTMD5; } pemfile { return PEMFILE; } pemchain { return PEMCHAIN; } pemkey { return PEMKEY; } rsakey { return RSAKEY; } init { return INIT; } allow { return ALLOW; } reject { return REJECTOPT; } read[-]?only { return READONLY; } disk { return DISK; } read { return READ; } write { return WRITE; } service[ ]?time { return SERVICETIME; } operation(s)?("/s")? { return OPERATION; } pidfile { return PIDFILE; } idfile { return IDFILE; } statefile { return STATEFILE; } path { return PATHTOK; } start { return START; } stop { return STOP; } port(number)? { return PORT; } unix(socket)? { return UNIXSOCKET; } ipv4 { return IPV4; } ipv6 { return IPV6; } type { return TYPE; } proto(col)? { return PROTOCOL; } tcp { return TCP; } tcpssl { return TCPSSL; } udp { return UDP; } alert { return ALERT; } noalert { return NOALERT; } mail-format { return MAILFORMAT; } resource { return RESOURCE; } restart(s)? { return RESTART; } cycle(s)? { return CYCLE; } timeout { return TIMEOUT; } retry { return RETRY; } checksum { return CHECKSUM; } mailserver { return MAILSERVER; } host { return HOST; } hostheader { return HOSTHEADER; } method { return METHOD; } get { return GET; } head { return HEAD; } status { return STATUS; } default { return DEFAULT; } http { return HTTP; } https { return HTTPS; } apache-status { return APACHESTATUS; } ftp { return FTP; } smtp { return SMTP; } smtps { return SMTPS; } postfix-policy { return POSTFIXPOLICY; } pop { return POP; } pops { return POPS; } imap { return IMAP; } imaps { return IMAPS; } clamav { return CLAMAV; } dns { return DNS; } mysql { return MYSQL; } mysqls { return MYSQLS; } nntp { return NNTP; } ntp3 { return NTP3; } ssh { return SSH; } redis { return REDIS; } mongodb { return MONGODB; } fail2ban { return FAIL2BAN; } sieve { return SIEVE; } spamassassin { return SPAMASSASSIN; } dwp { return DWP; } ldap2 { return LDAP2; } ldap3 { return LDAP3; } rdate { return RDATE; } lmtp { return LMTP; } rsync { return RSYNC; } tns { return TNS; } pgsql { return PGSQL; } websocket { return WEBSOCKET; } mqtt { return MQTT; } origin { return ORIGIN; } version { return VERSIONOPT; } sip { return SIP; } gps { return GPS; } radius { return RADIUS; } memcache { return MEMCACHE; } target { return TARGET; } maxforward { return MAXFORWARD; } mode { return MODE; } active { return ACTIVE; } passive { return PASSIVE; } manual { return MANUAL; } onreboot { return ONREBOOT; } nostart { return NOSTART; } laststate { return LASTSTATE; } uid { return UID; } euid { return EUID; } security { return SECURITY; } attribute(s)? { return ATTRIBUTE; } gid { return GID; } request { return REQUEST; } secret { return SECRET; } loglimit { return LOGLIMIT; } closelimit { return CLOSELIMIT; } dnslimit { return DNSLIMIT; } keepalivelimit { return KEEPALIVELIMIT; } replylimit { return REPLYLIMIT; } requestlimit { return REQUESTLIMIT; } startlimit { return STARTLIMIT; } waitlimit { return WAITLIMIT; } gracefullimit { return GRACEFULLIMIT; } cleanuplimit { return CLEANUPLIMIT; } mem(ory)? { return MEMORY; } swap { return SWAP; } total[ ]?mem(ory)? { return TOTALMEMORY; } core { return CORE; } cpu { return CPU; } total[ ]?cpu { return TOTALCPU; } child(ren)? { return CHILDREN; } thread(s)? { return THREADS; } time(stamp)? { return TIME; } changed { return CHANGED; } -sslv2 { return NOSSLV2; } -sslv3 { return NOSSLV3; } -tlsv1 { return NOTLSV1; } -tlsv11 { return NOTLSV11; } -tlsv12 { return NOTLSV12; } -tlsv13 { return NOTLSV13; } sslv2 { return SSLV2; } sslv3 { return SSLV3; } tlsv1 { return TLSV1; } tlsv11 { return TLSV11; } tlsv12 { return TLSV12; } tlsv13 { return TLSV13; } cipher(s)? { return CIPHER; } auto { return AUTO; } sslauto { return AUTO; } inode(s)? { return INODE; } space { return SPACE; } free { return TFREE; } perm(ission)? { return PERMISSION; } exec(ute)? { return EXEC; } size { return SIZE; } hardlink(s)? { return HARDLINK; } uptime { return UPTIME; } responsetime { return RESPONSETIME; } basedir { return BASEDIR; } slot(s)? { return SLOT; } eventqueue { return EVENTQUEUE; } match(ing)? { return MATCH; } not { return NOT; } ignore { return IGNORE; } connection { return CONNECTION; } unmonitor { return UNMONITOR; } action { return ACTION; } icmp { return ICMP; } ping { return PING; } ping4 { return PING4; } ping6 { return PING6; } echo { return ICMPECHO; } send { return SEND; } expect { return EXPECT; } expectbuffer { return EXPECTBUFFER; } limits { return LIMITS; } sendexpectbuffer { return SENDEXPECTBUFFER; } filecontentbuffer { return FILECONTENTBUFFER; } httpcontentbuffer { return HTTPCONTENTBUFFER; } programoutput { return PROGRAMOUTPUT; } networktimeout { return NETWORKTIMEOUT; } programtimeout { return PROGRAMTIMEOUT; } stoptimeout { return STOPTIMEOUT; } starttimeout { return STARTTIMEOUT; } restarttimeout { return RESTARTTIMEOUT; } exectimeout { return EXECTIMEOUT; } cleartext { return CLEARTEXT; } md5 { return MD5HASH; } sha1 { return SHA1HASH; } crypt { return CRYPT; } signature { return SIGNATURE; } nonexist(s)? { return NONEXIST; } exist(s)? { return EXIST; } invalid { return INVALID; } data { return DATA; } recovered { return RECOVERED; } passed { return PASSED; } succeeded { return SUCCEEDED; } else { return ELSE; } mmonit { return MMONIT; } url { return URL; } content { return CONTENT; } pid { return PID; } ppid { return PPID; } count { return COUNT; } repeat { return REPEAT; } reminder { return REMINDER; } instance { return INSTANCE; } hostname { return HOSTNAME; } username { return USERNAME; } password { return PASSWORD; } database { return DATABASE; } credentials { return CREDENTIALS; } register { return REGISTER; } fsflag(s)? { return FSFLAG; } fips { return FIPS; } filedescriptors { return FILEDESCRIPTORS; } {byte} { return BYTE; } {kilobyte} { return KILOBYTE; } {megabyte} { return MEGABYTE; } {gigabyte} { return GIGABYTE; } {loadavg1} { return LOADAVG1; } {loadavg5} { return LOADAVG5; } {loadavg15} { return LOADAVG15; } {cpuuser} { return CPUUSER; } {cpusyst} { return CPUSYSTEM; } {cpuwait} { return CPUWAIT; } {cpunice} { return CPUNICE; } {cpuhardirq} { return CPUHARDIRQ; } {cpusoftirq} { return CPUSOFTIRQ; } {cpusteal} { return CPUSTEAL; } {cpuguest} { return CPUGUEST; } {cpuguestnice} { return CPUGUESTNICE; } {greater} { return GREATER; } {greaterorequal} { return GREATEROREQUAL; } {less} { return LESS; } {lessorequal} { return LESSOREQUAL; } {equal} { return EQUAL; } {notequal} { return NOTEQUAL; } {millisecond} { return MILLISECOND; } {second} { return SECOND; } {minute} { return MINUTE; } {hour} { return HOUR; } {day} { return DAY; } {month} { return MONTH; } {atime} { return ATIME; } {ctime} { return CTIME; } {mtime} { return MTIME; } include { BEGIN(INCLUDE); } not[ ]+every { BEGIN(EVERY_COND); return NOTEVERY; } every { BEGIN(EVERY_COND); return EVERY; } depend(s)?[ \t]+(on[ \t]*)? { BEGIN(DEPEND_COND); return DEPENDS; } check[ \t]+(process[ \t])? { BEGIN(SERVICE_COND); check_state = Proc_State; return CHECKPROC; } check[ \t]+(program[ \t])? { BEGIN(SERVICE_COND); check_state = Program_State; return CHECKPROGRAM; } check[ \t]+device { /* Filesystem alias for backward compatibility */ BEGIN(SERVICE_COND); check_state = FileSys_State; return CHECKFILESYS; } check[ \t]+filesystem { BEGIN(SERVICE_COND); check_state = FileSys_State; return CHECKFILESYS; } check[ \t]+file { BEGIN(SERVICE_COND); check_state = File_State; return CHECKFILE; } check[ \t]+directory { BEGIN(SERVICE_COND); check_state = Dir_State; return CHECKDIR; } check[ \t]+host { BEGIN(SERVICE_COND); check_state = Host_State; return CHECKHOST; } check[ \t]+network { BEGIN(SERVICE_COND); check_state = Net_State; return CHECKNET; } check[ \t]+fifo { BEGIN(SERVICE_COND); check_state = Fifo_State; return CHECKFIFO; } check[ \t]+program { BEGIN(SERVICE_COND); check_state = Program_State; return CHECKPROGRAM; } check[ \t]+system { BEGIN(SERVICE_COND); check_state = System_State; return CHECKSYSTEM; } group[ \t]+ { BEGIN(STRING_COND); return GROUP; } "hostgroups"{ws} { BEGIN(HOSTGROUP_COND); return '['; } "http headers"{ws} { BEGIN(HTTP_HEADER_COND); return '['; } [a-zA-Z0-9]+"://" { yylval.url = create_URL(Str_ndup(yytext, strlen(yytext)-3)); BEGIN(URL_COND); } {number} { yylval.number = atoi(yytext); save_arg(); return NUMBER; } {real} { yylval.real = atof(yytext); save_arg(); return REAL; } {percent} { return PERCENT; } [a-zA-Z0-9]{str} { yylval.string = Str_dup(yytext); save_arg(); return STRING; } \"[/][^\"\n]*\" { yylval.string = handle_quoted_string(yytext); save_arg(); return PATH; } \'[/][^\'\n]*\' { yylval.string = handle_quoted_string(yytext); save_arg(); return PATH; } \"[^\"]*\" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } \'[^\']*\' { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } {str}[@]{str} { yylval.string = Str_dup(yytext); save_arg(); return MAILADDR; } [/]{str} { yylval.string = Str_dup(yytext); save_arg(); return PATH; } "/" { yylval.string = Str_dup(yytext); save_arg(); return PATH; } "from:"[ \t]* { yylval.address = Address_new(); BEGIN(ADDRESS_COND); return MAILFROM; } "reply-to:"[ \t]* { yylval.address = Address_new(); BEGIN(ADDRESS_COND); return MAILREPLYTO; } "subject:"[^}\n]* { char *p = yytext+strlen("subject:"); yylval.string = Str_trim(Str_dup(p)); save_arg(); return MAILSUBJECT; } "message:"[^}]* { char *p = yytext+strlen("message:"); steplinenobycr(yytext); yylval.string = Str_trim(Str_dup(p)); save_arg(); return MAILBODY; } {hostname} { yylval.string = Str_dup(yytext); save_arg(); return STRING; } {ipv4}[/]?[0-9]{0,2} { yylval.string = Str_dup(yytext); save_arg(); return STRING; } {ipv6}[/]?[0-9]{0,3} { yylval.string = Str_dup(yytext); save_arg(); return STRING; } [\"\'] { yyerror("unbalanced quotes"); } { {ws} ; [\n] { lineno++; } {str} { yylval.string = Str_dup(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } \"[^\000-\037\"\n]+\" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } \'[^\000-\037\"\n]+\' { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } [\"]|[\'] { yyerror("unbalanced quotes"); } } { {wws} ; {wws}?[\n]{wws}? { lineno++; } {str} { yylval.string = Str_dup(yytext); save_arg(); return SERVICENAME; } \"[^\000-\037\"\n]+\" { yylval.string = handle_quoted_string(yytext); save_arg(); return SERVICENAME; } \'[^\000-\037\"\n]+\' { yylval.string = handle_quoted_string(yytext); save_arg(); return SERVICENAME; } [ \r\n\t]+[^,] { steplinenobycr(yytext); unput(yytext[strlen(yytext)-1]); BEGIN(INITIAL); } } { {ws} ; [\n] { lineno++; } \" { BEGIN(INITIAL); } \'[^\']*\' { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } \' { yyerror("unbalanced quotes"); } [^ \t\n\"]+ { yylval.string = Str_dup(yytext); save_arg(); return STRING; } } { {ws}|[\n] { BEGIN(INITIAL); if (! yylval.url->hostname) yyerror("missing hostname in URL"); if (! yylval.url->path) yylval.url->path = Str_dup("/"); yylval.url->url = Str_cat("%s://[%s]:%d%s%s%s", yylval.url->protocol, /* possible credentials are hidden */ yylval.url->hostname, yylval.url->port, yylval.url->path, yylval.url->query ? "?" : "", yylval.url->query ? yylval.url->query : ""); save_arg(); return URLOBJECT; } [^:@ ]+/[:][^@: ]+[@] { yylval.url->user = Str_dup(yytext); } [:][^@ ]+[@] { yytext++; size_t length = strlen(yytext); if (length > 0) yylval.url->password = Str_ndup(yytext, length - 1); } ([a-zA-Z0-9\-]+)([.]([a-zA-Z0-9\-]+))* { yylval.url->hostname = Str_dup(yytext); } \[[0-9a-zA-Z.:%]+\] { yylval.url->hostname = Str_ndup(yytext + 1, yyleng - 2); yylval.url->ipv6 = true; } [:]{number} { yylval.url->port = atoi(++yytext); } [/][^?#\r\n ]* { yylval.url->path = Util_urlEncode(yytext, false); } [?][^#\r\n ]* { yylval.url->query = Util_urlEncode(++yytext, false); } [#][^\r\n ]* { /* EMPTY - reference is ignored */ } } { [}\n] { if (yytext[0] == '}') yyless(0); BEGIN(INITIAL); if (! yylval.address->address) yyerror("missing address"); save_arg(); return ADDRESSOBJECT; } {address} { yylval.address->address = Str_dup(yytext); } {addrname} { char *name = Str_unquote(Str_dup(yytext)); if (name) { if (*name) yylval.address->name = name; else // Empty quoted string FREE(name); } } [<>:\[\]] { // Ignore } . { BEGIN(INITIAL); yyerror("invalid mail format"); } } { {str} { yylval.string = Str_dup(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } \"{str}\" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } \'{str}\' { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } [\"\'] { yyerror("unbalanced quotes"); } } { {wws} ; "[" ; [\n] { lineno++; } ([^\r\n\[\] \t,]+) { yylval.string = Str_dup(yytext); save_arg(); return HOSTGROUPNAME; } (({ws}?["][^"]+["])|({ws}?['][^']+['])) { yylval.string = Str_cat("%s", Str_unquote(yytext + 1)); save_arg(); return HOSTGROUPNAME; } "]" { BEGIN(INITIAL); save_arg(); return ']'; } . { BEGIN(INITIAL); yyerror("invalid hostgroup list format"); } } { {ws} ; {number} { yylval.number = atoi(yytext); BEGIN(INITIAL); save_arg(); return NUMBER; } ['"]{ws}?[0-9,*-]+{ws}[0-9,*-]+{ws}[0-9,*-]+{ws}[0-9,*-]+{ws}[0-9,*-]+{ws}?['"] { // A minimal syntax check of the cron format string; 5 fields separated with white-space yylval.string = Str_dup(Str_unquote(yytext)); BEGIN(INITIAL); save_arg(); return TIMESPEC; } cycle(s)? { BEGIN(INITIAL); return CYCLE; } . { BEGIN(INITIAL); yyerror("invalid every format"); } } { {wws} ; "[" ; [\n] { lineno++; } ([^\t\r\n,\[\]:]+)/[:] { // name/: save_arg(); } [:](({ws}?["][^"]+["])|({ws}?['][^']+['])|([^\r\n\],:]+)) { // : value yylval.string = Str_cat("%s:%s", Str_trim(argyytext), Str_unquote(yytext + 1)); save_arg(); return HTTPHEADER; } "]" { BEGIN(INITIAL); save_arg(); return ']'; } . { BEGIN(INITIAL); yyerror("invalid HTTP header list format"); } } . { check_state = None_State; return yytext[0]; } [ \t]* /* eat the whitespace */ \"[^\"\r\n]+\" { /* got the include file name with double quotes */ char *temp = Str_dup(yytext); Str_unquote(temp); include_file(temp); FREE(temp); BEGIN(INITIAL); } \'[^\'\r\n]+\' { /* got the include file name with single quotes*/ char *temp = Str_dup(yytext); Str_unquote(temp); include_file(temp); FREE(temp); BEGIN(INITIAL); } [^ \t\r\n]+ { /* got the include file name without quotes*/ char *temp = Str_dup(yytext); include_file(temp); FREE(temp); BEGIN(INITIAL); } <> { BEGIN(INITIAL); check_state = None_State; if (! pop_buffer_state()) yyterminate(); } %% /* * Do lineno++ for every occurrence of '\n' in a string. This is * necessary whenever a yytext has an unknown number of CRs. */ static void steplinenobycr(char *string) { char *pos = string; while (*pos) if ('\n' == *pos++) { lineno++; } } static char *handle_quoted_string(char *string) { char *buf = Str_dup(string); Str_unquote(buf); if (! Util_handleEscapes(buf)) yyerror("unbalanced escape sequence"); return buf; } static void _include(const char *path) { if (Str_cmp(Run.files.control, path) == 0) { yywarning("Include loop detected when trying to include %s", path); return; } for (int i = 0; i < buffer_stack_ptr; i++) { if (Str_cmp(buffer_stack[i].currentfile, path) == 0) { yywarning("Include loop detected when trying to include %s", path); return; } } FILE *_yyin = fopen(path, "r"); if (! _yyin) yyerror("Cannot include file '%s' -- %s", path, STRERROR); else push_buffer_state(yy_create_buffer(_yyin, YY_BUF_SIZE), path); } static void include_file(char *pattern) { glob_t globbuf; errno = 0; if (glob(pattern, GLOB_MARK, NULL, &globbuf) == 0) { for (size_t i = 0; i < globbuf.gl_pathc; i++) { size_t filename_length = strlen(globbuf.gl_pathv[i]); if ((filename_length == 0) || (globbuf.gl_pathv[i][filename_length - 1] == '~' ) || (globbuf.gl_pathv[i][filename_length - 1] == '/')) continue; // skip subdirectories and file backup copies _include(globbuf.gl_pathv[i]); } globfree(&globbuf); } else if (errno != 0) { yywarning("Include failed -- %s", STRERROR); } // else no include files found -- silently ignore } static void push_buffer_state(YY_BUFFER_STATE buffer, const char *filename) { if (buffer_stack_ptr >= MAX_STACK_DEPTH) { yyerror("include files limit reached"); exit( 1 ); } buffer_stack[buffer_stack_ptr].lineno = lineno; buffer_stack[buffer_stack_ptr].currentfile = currentfile; buffer_stack[buffer_stack_ptr].buffer = YY_CURRENT_BUFFER; buffer_stack_ptr++; lineno = 1; currentfile = Str_dup(filename); yy_switch_to_buffer(buffer); BEGIN(INITIAL); } static int pop_buffer_state(void) { if ( --buffer_stack_ptr < 0 ) { return 0; } else { fclose(yyin); lineno = buffer_stack[buffer_stack_ptr].lineno; FREE(currentfile); currentfile = buffer_stack[buffer_stack_ptr].currentfile; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(buffer_stack[buffer_stack_ptr].buffer); } return 1; } static void save_arg(void) { arglineno = lineno; argcurrentfile = currentfile; FREE(argyytext); argyytext = Str_dup(yytext); } static URL_T create_URL(char *proto) { URL_T url; assert(proto); NEW(url); url->protocol = proto; if (IS(url->protocol, "https")) { url->port = 443; #ifndef HAVE_OPENSSL yyerror("HTTPS protocol not supported -- SSL support disabled" ); #endif } else if (IS(url->protocol, "http")) { url->port = 80; } else { yyerror("URL protocol not supported -- "); } return url; } // Turn back on unreachable code warnings #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic pop #endif monit-5.35.2/src/p.y0000644000016400001720000063361315007061157011106 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ %{ /* Turn off unreachable code warnings for the entire generated parser */ #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunreachable-code" #endif /* * DESCRIPTION * Simple context-free grammar for parsing the control file. * */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_PWD_H #include #endif #ifdef HAVE_GRP_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_TIME_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ASM_PARAM_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_SYSLOG_H #include #endif #ifdef HAVE_NETINET_IN_SYSTM_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_NETINET_IP_H #include #endif #ifdef HAVE_NETINET_IP_ICMP_H #include #endif #ifdef HAVE_REGEX_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_OPENSSL #include #endif #include "monit.h" #include "protocol.h" #include "engine.h" #include "alert.h" #include "device.h" #include "processor.h" #include "md5.h" #include "sha1.h" #include "checksum.h" #include "ProcessTree.h" #include "process_sysdep.h" // libmonit #include "system/Time.h" #include "io/File.h" #include "util/Str.h" #include "thread/Thread.h" /* ------------------------------------------------------------- Definitions */ struct precedence_t { bool daemon; bool logfile; bool pidfile; bool idfile; bool statefile; }; struct rate_t { unsigned int count; unsigned int cycles; }; /* yacc interface */ void yyerror(const char *,...) __attribute__((format (printf, 1, 2))); void yyerror2(const char *,...) __attribute__((format (printf, 1, 2))); void yywarning(const char *,...) __attribute__((format (printf, 1, 2))); void yywarning2(const char *,...) __attribute__((format (printf, 1, 2))); /* lexer interface */ int yylex(void); extern FILE *yyin; extern int lineno; extern int arglineno; extern char *yytext; extern char *argyytext; extern char *currentfile; extern char *argcurrentfile; extern int buffer_stack_ptr; /* Local variables */ static int cfg_errflag = 0; static Service_T tail = NULL; static Service_T current = NULL; static Request_T urlrequest = NULL; static command_t command = NULL; static command_t command1 = NULL; static command_t command2 = NULL; static Service_T depend_list = NULL; static struct Uid_T uidset = {}; static struct Gid_T gidset = {}; static struct Pid_T pidset = {}; static struct Pid_T ppidset = {}; static struct FsFlag_T fsflagset = {}; static struct NonExist_T nonexistset = {}; static struct Exist_T existset = {}; static struct Status_T statusset = {}; static struct Perm_T permset = {}; static struct Size_T sizeset = {}; static struct NLink_T nlinkset = {}; static struct Uptime_T uptimeset = {}; static struct ResponseTime_T responsetimeset = {}; static struct LinkStatus_T linkstatusset = {}; static struct LinkSpeed_T linkspeedset = {}; static struct LinkSaturation_T linksaturationset = {}; static struct Bandwidth_T bandwidthset = {}; static struct Match_T matchset = {}; static struct Icmp_T icmpset = {}; static struct Mail_T mailset = {}; static struct SslOptions_T sslset = {}; static struct Port_T portset = {}; static struct MailServer_T mailserverset = {}; static struct Mmonit_T mmonitset = {}; static struct FileSystem_T filesystemset = {}; static struct Resource_T resourceset = {}; static struct Checksum_T checksumset = {}; static struct Timestamp_T timestampset = {}; static struct ActionRate_T actionrateset = {}; static struct precedence_t ihp = {false, false, false, false, false}; static struct rate_t rate = {1, 1}; static struct rate_t rate1 = {1, 1}; static struct rate_t rate2 = {1, 1}; static char * htpasswd_file = NULL; static unsigned int repeat = 0; static unsigned int repeat1 = 0; static unsigned int repeat2 = 0; static unsigned int timeout = 0; static Digest_Type digesttype = Digest_Cleartext; #define BITMAP_MAX (sizeof(long long) * 8) /* -------------------------------------------------------------- Prototypes */ static void preparse(void); static void postparse(void); static bool _parseOutgoingAddress(char *ip, Outgoing_T *outgoing); static void addmail(char *, Mail_T, Mail_T *); static Service_T createservice(Service_Type, char *, char *, State_Type (*)(Service_T)); static void addservice(Service_T); static void adddependant(char *); static void addservicegroup(char *); static void addhostgroup(char *name); static void addport(Port_T *, Port_T); static void addhttpheader(Port_T, char *); static void addresource(Resource_T); static void addtimestamp(Timestamp_T); static void addactionrate(ActionRate_T); static void addsize(Size_T); static void addnlink(NLink_T); static void adduptime(Uptime_T); static void addpid(Pid_T); static void addppid(Pid_T); static void addfsflag(FsFlag_T); static void addnonexist(NonExist_T); static void addexist(Exist_T); static void addlinkstatus(Service_T, LinkStatus_T); static void addlinkspeed(Service_T, LinkSpeed_T); static void addlinksaturation(Service_T, LinkSaturation_T); static void addbandwidth(Bandwidth_T *, Bandwidth_T); static void addfilesystem(FileSystem_T); static void addicmp(Icmp_T); static void addgeneric(Port_T, char*, char*); static void addcommand(int, unsigned); static void addargument(char *); static void addmmonit(Mmonit_T); static void addmailserver(MailServer_T); static bool addcredentials(char *, char *, Digest_Type, bool); #ifdef HAVE_LIBPAM static void addpamauth(char *, int); #endif static void addhtpasswdentry(char *, char *, Digest_Type); static uid_t get_uid(char *, uid_t); static gid_t get_gid(char *, gid_t); static void addchecksum(Checksum_T); static void addperm(Perm_T); static void addmatch(Match_T, int, int); static void addmatchpath(Match_T, Action_Type); static void addoutputchange(bool, Action_Type, Action_Type); static void addstatus(Status_T); static Uid_T adduid(Uid_T); static Gid_T addgid(Gid_T); static void addeuid(uid_t); static void addegid(gid_t); static void addeventaction(EventAction_T *, Action_Type, Action_Type); static void prepare_urlrequest(URL_T U); static void seturlrequest(int, char *); static void setlogfile(char *); static void setpidfile(char *); static void setidfile(char *); static void setstatefile(char *); static void reset_sslset(void); static void reset_mailset(void); static void reset_mailserverset(void); static void reset_mmonitset(void); static void reset_portset(void); static void reset_resourceset(void); static void reset_timestampset(void); static void reset_actionrateset(void); static void reset_sizeset(void); static void reset_nlinkset(void); static void reset_uptimeset(void); static void reset_responsetimeset(void); static void reset_pidset(void); static void reset_ppidset(void); static void reset_fsflagset(void); static void reset_nonexistset(void); static void reset_existset(void); static void reset_linkstatusset(void); static void reset_linkspeedset(void); static void reset_linksaturationset(void); static void reset_bandwidthset(void); static void reset_checksumset(void); static void reset_permset(void); static void reset_uidset(void); static void reset_gidset(void); static void reset_statusset(void); static void reset_filesystemset(void); static void reset_icmpset(void); static void reset_rateset(struct rate_t *); static void check_name(char *); static int check_perm(int); static void check_exec(char *); static int cleanup_hash_string(char *); static void check_depend(void); static void setsyslog(char *); static command_t copycommand(command_t); static int verifyMaxForward(int); static void _setPEM(char **store, char *path, const char *description, bool isFile); static void _setSSLOptions(SslOptions_T options); #ifdef HAVE_OPENSSL static void _setSSLVersion(short version); #endif static void _unsetSSLVersion(short version); static void addsecurityattribute(char *, Action_Type, Action_Type); static void addfiledescriptors(Operator_Type, bool, long long, float, Action_Type, Action_Type); static void _sanityCheckEveryStatement(Service_T s); %} %union { URL_T url; Address_T address; float real; int number; int64_t number64; char *string; } %token IF ELSE THEN FAILED %token SET LOGFILE FACILITY DAEMON SYSLOG MAILSERVER HTTPD ALLOW REJECTOPT ADDRESS INIT TERMINAL BATCH %token READONLY CLEARTEXT MD5HASH SHA1HASH CRYPT DELAY %token PEMFILE PEMKEY PEMCHAIN ENABLE DISABLE SSLTOKEN CIPHER CLIENTPEMFILE ALLOWSELFCERTIFICATION SELFSIGNED VERIFY CERTIFICATE CACERTIFICATEFILE CACERTIFICATEPATH VALID %token INTERFACE LINK PACKET BYTEIN BYTEOUT PACKETIN PACKETOUT SPEED SATURATION UPLOAD DOWNLOAD TOTAL UP DOWN %token IDFILE STATEFILE SEND EXPECT CYCLE COUNT REMINDER REPEAT %token LIMITS SENDEXPECTBUFFER EXPECTBUFFER FILECONTENTBUFFER HTTPCONTENTBUFFER PROGRAMOUTPUT NETWORKTIMEOUT PROGRAMTIMEOUT STARTTIMEOUT STOPTIMEOUT RESTARTTIMEOUT EXECTIMEOUT %token PIDFILE START STOP PATHTOK RSAKEY %token HOST HOSTNAME PORT IPV4 IPV6 TYPE UDP TCP TCPSSL PROTOCOL CONNECTION %token ALERT NOALERT MAILFORMAT UNIXSOCKET SIGNATURE %token TIMEOUT RETRY RESTART CHECKSUM EVERY NOTEVERY %token DEFAULT HTTP HTTPS APACHESTATUS FTP SMTP SMTPS POP POPS IMAP IMAPS CLAMAV NNTP NTP3 MYSQL MYSQLS DNS WEBSOCKET MQTT %token SSH DWP LDAP2 LDAP3 RDATE RSYNC TNS PGSQL POSTFIXPOLICY SIP LMTP GPS RADIUS MEMCACHE REDIS MONGODB SIEVE SPAMASSASSIN FAIL2BAN %token STRING PATH MAILADDR MAILFROM MAILREPLYTO MAILSUBJECT %token MAILBODY SERVICENAME STRINGNAME HOSTGROUPNAME %token NUMBER PERCENT LOGLIMIT CLOSELIMIT DNSLIMIT KEEPALIVELIMIT %token REPLYLIMIT REQUESTLIMIT STARTLIMIT WAITLIMIT GRACEFULLIMIT %token CLEANUPLIMIT %token REAL %token CHECKPROC CHECKFILESYS CHECKFILE CHECKDIR CHECKHOST CHECKSYSTEM CHECKFIFO CHECKPROGRAM CHECKNET %token THREADS CHILDREN METHOD GET HEAD STATUS ORIGIN VERSIONOPT READ WRITE OPERATION SERVICETIME DISK %token RESOURCE MEMORY TOTALMEMORY LOADAVG1 LOADAVG5 LOADAVG15 SWAP %token MODE ACTIVE PASSIVE MANUAL ONREBOOT NOSTART LASTSTATE %token CORE CPU TOTALCPU CPUUSER CPUSYSTEM CPUWAIT CPUNICE CPUHARDIRQ CPUSOFTIRQ CPUSTEAL CPUGUEST CPUGUESTNICE %token GROUP REQUEST DEPENDS BASEDIR SLOT EVENTQUEUE SECRET HOSTHEADER %token UID EUID GID MMONIT INSTANCE USERNAME PASSWORD DATABASE %token TIME ATIME CTIME MTIME CHANGED MILLISECOND SECOND MINUTE HOUR DAY MONTH %token SSLV2 SSLV3 TLSV1 TLSV11 TLSV12 TLSV13 CERTMD5 AUTO %token NOSSLV2 NOSSLV3 NOTLSV1 NOTLSV11 NOTLSV12 NOTLSV13 %token BYTE KILOBYTE MEGABYTE GIGABYTE %token INODE SPACE TFREE PERMISSION SIZE MATCH NOT IGNORE ACTION UPTIME RESPONSETIME %token EXEC UNMONITOR PING PING4 PING6 ICMP ICMPECHO NONEXIST EXIST INVALID DATA RECOVERED PASSED SUCCEEDED %token URL CONTENT PID PPID FSFLAG %token REGISTER CREDENTIALS %token URLOBJECT %token
ADDRESSOBJECT %token TARGET TIMESPEC HTTPHEADER %token MAXFORWARD %token FIPS %token SECURITY ATTRIBUTE %token FILEDESCRIPTORS %token HARDLINK %left GREATER GREATEROREQUAL LESS LESSOREQUAL EQUAL NOTEQUAL %% cfgfile : /* EMPTY */ | statement_list ; statement_list : statement | statement_list statement ; statement : setalert | setssl | setdaemon | setterminal | setlog | seteventqueue | setmmonits | setmailservers | setmailformat | sethttpd | setpid | setidfile | setstatefile | setexpectbuffer | setinit | setlimits | setonreboot | setfips | checkproc optproclist | checkfile optfilelist | checkfilesys optfilesyslist | checkdir optdirlist | checkhost opthostlist | checksystem optsystemlist | checkfifo optfifolist | checkprogram optprogramlist | checknet optnetlist ; optproclist : /* EMPTY */ | optproclist optproc ; optproc : start | stop | restart | exist | pid | ppid | uid | euid | secattr | filedescriptorsprocess | filedescriptorsprocesstotal | gid | uptime | connection | connectionurl | connectionunix | actionrate | alert | every | mode | onreboot | group | depend | resourceprocess ; optfilelist : /* EMPTY */ | optfilelist optfile ; optfile : start | stop | restart | exist | timestamp | actionrate | every | alert | permission | uid | gid | checksum | size | hardlink | match | mode | onreboot | group | depend ; optfilesyslist : /* EMPTY */ | optfilesyslist optfilesys ; optfilesys : start | stop | restart | exist | actionrate | every | alert | permission | uid | gid | mode | onreboot | group | depend | inode | space | read | write | servicetime | fsflag ; optdirlist : /* EMPTY */ | optdirlist optdir ; optdir : start | stop | restart | exist | timestamp | actionrate | every | alert | permission | uid | gid | hardlink | mode | onreboot | group | depend ; opthostlist : /* EMPTY */ | opthostlist opthost ; opthost : start | stop | restart | connection | connectionurl | icmp | actionrate | alert | every | mode | onreboot | group | depend ; optnetlist : /* EMPTY */ | optnetlist optnet ; optnet : start | stop | restart | linkstatus | linkspeed | linksaturation | upload | download | actionrate | every | mode | onreboot | alert | group | depend ; optsystemlist : /* EMPTY */ | optsystemlist optsystem ; optsystem : start | stop | restart | actionrate | alert | every | mode | onreboot | group | depend | resourcesystem | uptime | filedescriptorssystem ; optfifolist : /* EMPTY */ | optfifolist optfifo ; optfifo : start | stop | restart | exist | timestamp | actionrate | every | alert | permission | uid | gid | hardlink | mode | onreboot | group | depend ; optprogramlist : /* EMPTY */ | optprogramlist optprogram ; optprogram : start | stop | restart | actionrate | alert | every | mode | onreboot | group | depend | statusvalue | programmatch ; setalert : SET alertmail formatlist reminder { mailset.events = Event_All; addmail($2, &mailset, &Run.maillist); } | SET alertmail '{' eventoptionlist '}' formatlist reminder { addmail($2, &mailset, &Run.maillist); } | SET alertmail NOT '{' eventoptionlist '}' formatlist reminder { mailset.events = ~mailset.events; addmail($2, &mailset, &Run.maillist); } ; setdaemon : SET DAEMON NUMBER startdelay { if (! (Run.flags & Run_Daemon) || ihp.daemon) { int one_year = 31556952; ihp.daemon = true; Run.flags |= Run_Daemon; if (($3 <= 0) || ($3 > one_year)) { yyerror2("Invalid Poll time seconds."); } Run.polltime = $3; Run.startdelay = $4; } } ; setterminal : SET TERMINAL BATCH { Run.flags |= Run_Batch; } ; startdelay : /* EMPTY */ { $$ = 0; } | START DELAY NUMBER { $$ = $3; } ; setinit : SET INIT { Run.flags |= Run_Foreground; } ; setonreboot : SET ONREBOOT START { Run.onreboot = Onreboot_Start; } | SET ONREBOOT NOSTART { Run.onreboot = Onreboot_Nostart; } | SET ONREBOOT LASTSTATE { Run.onreboot = Onreboot_Laststate; } ; setexpectbuffer : SET EXPECTBUFFER NUMBER unit { // Note: deprecated (replaced by "set limits" statement's "sendExpectBuffer" option) Run.limits.sendExpectBuffer = $3 * $4; } ; setlimits : SET LIMITS '{' limitlist '}' ; limitlist : /* EMPTY */ | limitlist limit ; limit : SENDEXPECTBUFFER ':' NUMBER unit { if ($3 <= 0) { yyerror2("The sendExpectBuffer value must be > 0"); } else { long long value = $3 * $4; if (value > INT_MAX) yyerror2("The sendExpectBuffer value must be <= %d", INT_MAX); else Run.limits.sendExpectBuffer = $3 * $4; } } | FILECONTENTBUFFER ':' NUMBER unit { if ($3 <= 0) { yyerror2("The fileContentBuffer value must be > 0"); } else { Run.limits.fileContentBuffer = $3 * $4; } } | HTTPCONTENTBUFFER ':' NUMBER unit { if ($3 <= 0) { yyerror2("The httpContentBuffer value must be > 0"); } else { long long value = $3 * $4; if (value > INT_MAX) yyerror2("The httpContentBuffer value must be <= %d", INT_MAX); else Run.limits.httpContentBuffer = $3 * $4; } } | PROGRAMOUTPUT ':' NUMBER unit { if ($3 <= 0) { yyerror2("The programOutput value must be > 0"); } else { long long value = $3 * $4; if (value > INT_MAX) yyerror2("The programOutput value must be <= %d", INT_MAX); else Run.limits.programOutput = $3 * $4; } } | NETWORKTIMEOUT ':' NUMBER MILLISECOND { if ($3 <= 0) yyerror2("The networkTimeout value must be > 0"); else Run.limits.networkTimeout = $3; } | NETWORKTIMEOUT ':' NUMBER SECOND { if ($3 <= 0) yyerror2("The networkTimeout value must be > 0"); else Run.limits.networkTimeout = $3 * 1000; } | PROGRAMTIMEOUT ':' NUMBER MILLISECOND { if ($3 <= 0) yyerror2("The programTimeout value must be > 0"); else Run.limits.programTimeout = $3; } | PROGRAMTIMEOUT ':' NUMBER SECOND { if ($3 <= 0) yyerror2("The programTimeout value must be > 0"); else Run.limits.programTimeout = $3 * 1000; } | STOPTIMEOUT ':' NUMBER MILLISECOND { if ($3 <= 0) yyerror2("The stopTimeout value must be > 0"); else Run.limits.stopTimeout = $3; } | STOPTIMEOUT ':' NUMBER SECOND { if ($3 <= 0) yyerror2("The stopTimeout value must be > 0"); else Run.limits.stopTimeout = $3 * 1000; } | STARTTIMEOUT ':' NUMBER MILLISECOND { if ($3 <= 0) yyerror2("The startTimeout value must be > 0"); else Run.limits.startTimeout = $3; } | STARTTIMEOUT ':' NUMBER SECOND { if ($3 <= 0) yyerror2("The startTimeout value must be > 0"); else Run.limits.startTimeout = $3 * 1000; } | RESTARTTIMEOUT ':' NUMBER MILLISECOND { if ($3 <= 0) yyerror2("The restartTimeout value must be > 0"); else Run.limits.restartTimeout = $3; } | RESTARTTIMEOUT ':' NUMBER SECOND { if ($3 <= 0) yyerror2("The restartTimeout value must be > 0"); else Run.limits.restartTimeout = $3 * 1000; } | EXECTIMEOUT ':' NUMBER MILLISECOND { if ($3 <= 0) yyerror2("The execTimeout value must be > 0"); else Run.limits.execTimeout = $3; } | EXECTIMEOUT ':' NUMBER SECOND { if ($3 <= 0) yyerror2("The execTimeout value must be > 0"); else Run.limits.execTimeout = $3 * 1000; } ; setfips : SET FIPS { Run.flags |= Run_FipsEnabled; } ; setlog : SET LOGFILE PATH { if (! Run.files.log || ihp.logfile) { ihp.logfile = true; setlogfile($3); Run.flags &= ~Run_UseSyslog; Run.flags |= Run_Log; } else { FREE($3); } } | SET LOGFILE SYSLOG { setsyslog(NULL); } | SET LOGFILE SYSLOG FACILITY STRING { setsyslog($5); FREE($5); } ; seteventqueue : SET EVENTQUEUE BASEDIR PATH { Run.eventlist_dir = $4; } | SET EVENTQUEUE BASEDIR PATH SLOT NUMBER { Run.eventlist_dir = $4; Run.eventlist_slots = $6; } | SET EVENTQUEUE SLOT NUMBER { Run.eventlist_dir = Str_dup(MYEVENTLISTBASE); Run.eventlist_slots = $4; } ; setidfile : SET IDFILE PATH { if (! Run.files.id || ihp.idfile) { ihp.idfile = true; setidfile($3); } else { FREE($3); } } ; setstatefile : SET STATEFILE PATH { if (! Run.files.state || ihp.statefile) { ihp.statefile = true; setstatefile($3); } else { FREE($3); } } ; setpid : SET PIDFILE PATH { if (! Run.files.pid || ihp.pidfile) { ihp.pidfile = true; setpidfile($3); } else { FREE($3); } } ; setmmonits : SET MMONIT mmonitlist ; mmonitlist : mmonit credentials | mmonitlist mmonit credentials ; mmonit : URLOBJECT mmonitoptlist { mmonitset.url = $1; addmmonit(&mmonitset); } ; mmonitoptlist : /* EMPTY */ | mmonitoptlist mmonitopt ; mmonitopt : TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else mmonitset.timeout = $2 * 1000; // net timeout is in milliseconds internally } | ssl | sslchecksum | sslversion | certmd5 | '[' hostgrouplist ']' ; credentials : /* EMPTY */ | REGISTER CREDENTIALS { Run.flags &= ~Run_MmonitCredentials; } ; setssl : SET SSLTOKEN '{' ssloptionlist '}' { _setSSLOptions(&(Run.ssl)); } ; ssl : SSLTOKEN { sslset.flags = SSL_Enabled; } | SSLTOKEN '{' ssloptionlist '}' ; ssloptionlist : /* EMPTY */ | ssloptionlist ssloption ; ssloption : VERIFY ':' ENABLE { sslset.flags = SSL_Enabled; sslset.verify = true; } | VERIFY ':' DISABLE { sslset.flags = SSL_Enabled; sslset.verify = false; } | SELFSIGNED ':' ALLOW { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = true; } | SELFSIGNED ':' REJECTOPT { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = false; } | VERSIONOPT ':' sslversionlist { sslset.flags = SSL_Enabled; } | CIPHER ':' STRING { FREE(sslset.ciphers); sslset.ciphers = $3; } | PEMFILE ':' PATH { _setPEM(&(sslset.pemfile), $3, "SSL server PEM file", true); } | PEMCHAIN ':' PATH { _setPEM(&(sslset.pemchain), $3, "SSL certificate chain PEM file", true); } | PEMKEY ':' PATH { _setPEM(&(sslset.pemkey), $3, "SSL server private key PEM file", true); } | CLIENTPEMFILE ':' PATH { _setPEM(&(sslset.clientpemfile), $3, "SSL client PEM file", true); } | CACERTIFICATEFILE ':' PATH { _setPEM(&(sslset.CACertificateFile), $3, "SSL CA certificates file", true); } | CACERTIFICATEPATH ':' PATH { _setPEM(&(sslset.CACertificatePath), $3, "SSL CA certificates directory", false); } ; sslexpire : CERTIFICATE VALID expireoperator NUMBER DAY { sslset.flags = SSL_Enabled; portset.target.net.ssl.certificate.minimumDays = $4; } ; expireoperator : /* EMPTY */ | GREATER ; sslchecksum : CERTIFICATE CHECKSUM checksumoperator STRING { sslset.flags = SSL_Enabled; sslset.checksum = $4; switch (cleanup_hash_string(sslset.checksum)) { case 32: sslset.checksumType = Hash_Md5; break; case 40: sslset.checksumType = Hash_Sha1; break; default: yyerror2("Unknown checksum type: [%s] is not MD5 nor SHA1", sslset.checksum); } } | CERTIFICATE CHECKSUM MD5HASH checksumoperator STRING { sslset.flags = SSL_Enabled; sslset.checksum = $5; if (cleanup_hash_string(sslset.checksum) != 32) yyerror2("Unknown checksum type: [%s] is not MD5", sslset.checksum); sslset.checksumType = Hash_Md5; } | CERTIFICATE CHECKSUM SHA1HASH checksumoperator STRING { sslset.flags = SSL_Enabled; sslset.checksum = $5; if (cleanup_hash_string(sslset.checksum) != 40) yyerror2("Unknown checksum type: [%s] is not SHA1", sslset.checksum); sslset.checksumType = Hash_Sha1; } ; checksumoperator : /* EMPTY */ | EQUAL ; sslversionlist : /* EMPTY */ | sslversionlist sslversion ; sslversion : SSLV2 { #if defined OPENSSL_NO_SSL2 || ! defined HAVE_SSLV2 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support SSL version 2"); #else _setSSLVersion(SSL_V2); #endif } | NOSSLV2 { _unsetSSLVersion(SSL_V2); } | SSLV3 { #if defined OPENSSL_NO_SSL3 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support SSL version 3"); #else _setSSLVersion(SSL_V3); #endif } | NOSSLV3 { _unsetSSLVersion(SSL_V3); } | TLSV1 { #if defined OPENSSL_NO_TLS1_METHOD || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.0"); #else _setSSLVersion(SSL_TLSV1); #endif } | NOTLSV1 { _unsetSSLVersion(SSL_TLSV1); } | TLSV11 { #if defined OPENSSL_NO_TLS1_1_METHOD || ! defined HAVE_TLSV1_1 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.1"); #else _setSSLVersion(SSL_TLSV11); #endif } | NOTLSV11 { _unsetSSLVersion(SSL_TLSV11); } | TLSV12 { #if defined OPENSSL_NO_TLS1_2_METHOD || ! defined HAVE_TLSV1_2 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.2"); #else _setSSLVersion(SSL_TLSV12); #endif } | NOTLSV12 { _unsetSSLVersion(SSL_TLSV12); } | TLSV13 { #if defined OPENSSL_NO_TLS1_3_METHOD || ! defined HAVE_TLSV1_3 || ! defined HAVE_OPENSSL yyerror("Your SSL Library does not support TLS version 1.3"); #else _setSSLVersion(SSL_TLSV13); #endif } | NOTLSV13 { _unsetSSLVersion(SSL_TLSV13); } | AUTO { // Enable just TLS 1.2 and 1.3 by default #if ! defined OPENSSL_NO_TLS1_2_METHOD && defined HAVE_TLSV1_2 && defined HAVE_OPENSSL _setSSLVersion(SSL_TLSV12); #endif #if ! defined OPENSSL_NO_TLS1_3_METHOD && defined HAVE_TLSV1_3 && defined HAVE_OPENSSL _setSSLVersion(SSL_TLSV13); #endif } ; certmd5 : CERTMD5 STRING { // Backward compatibility sslset.flags = SSL_Enabled; sslset.checksum = $2; if (cleanup_hash_string(sslset.checksum) != 32) yyerror2("Unknown checksum type: [%s] is not MD5", sslset.checksum); sslset.checksumType = Hash_Md5; } ; setmailservers : SET MAILSERVER mailserverlist nettimeout hostname { Run.mailserver_timeout = $4; Run.mail_hostname = $5; } ; setmailformat : SET MAILFORMAT '{' formatoptionlist '}' { if (mailset.from) { Run.MailFormat.from = mailset.from; } else { Run.MailFormat.from = Address_new(); Run.MailFormat.from->address = Str_dup(ALERT_FROM); } if (mailset.replyto) Run.MailFormat.replyto = mailset.replyto; Run.MailFormat.subject = mailset.subject ? mailset.subject : Str_dup(ALERT_SUBJECT); Run.MailFormat.message = mailset.message ? mailset.message : Str_dup(ALERT_MESSAGE); reset_mailset(); } ; mailserverlist : mailserver | mailserverlist mailserver ; mailserver : STRING mailserveroptlist { /* Restore the current text overridden by lookahead */ FREE(argyytext); argyytext = Str_dup($1); mailserverset.host = $1; mailserverset.port = PORT_SMTP; addmailserver(&mailserverset); } | STRING PORT NUMBER mailserveroptlist { /* Restore the current text overridden by lookahead */ FREE(argyytext); argyytext = Str_dup($1); mailserverset.host = $1; mailserverset.port = $3; addmailserver(&mailserverset); } ; mailserveroptlist : /* EMPTY */ | mailserveroptlist mailserveropt ; mailserveropt : username { mailserverset.username = $1; } | password { mailserverset.password = $1; } | ssl | sslchecksum | sslversion | certmd5 ; sethttpd : SET HTTPD httpdlist { if (sslset.flags & SSL_Enabled) { #ifdef HAVE_OPENSSL if (sslset.pemfile) { if (sslset.pemchain || sslset.pemkey) { yyerror("SSL server option pemfile and pemchain|pemkey are mutually exclusive"); } else if (! file_checkStat(sslset.pemfile, "SSL server PEM file", S_IRWXU | S_IRGRP | S_IXGRP)) { yyerror("SSL server PEM file permissions check failed"); } else { _setSSLOptions(&(Run.httpd.socket.net.ssl)); } } else if (sslset.pemchain && sslset.pemkey) { if (! file_checkStat(sslset.pemkey, "SSL server private key PEM file", S_IRWXU | S_IRGRP | S_IXGRP)) { yyerror("SSL server private key PEM file permissions check failed"); } else { _setSSLOptions(&(Run.httpd.socket.net.ssl)); } } else { yyerror("SSL server PEM file is required (please use ssl pemfile option)"); } #else yyerror("SSL is not supported"); #endif } } ; httpdlist : /* EMPTY */ | httpdlist httpdoption ; httpdoption : ssl | pemfile | clientpemfile | allowselfcert | signature | bindaddress | allow | httpdport | httpdsocket ; /* deprecated by "ssl" options since monit 5.21 (kept for backward compatibility) */ pemfile : PEMFILE PATH { _setPEM(&(sslset.pemfile), $2, "SSL server PEM file", true); } ; /* deprecated by "ssl" options since monit 5.21 (kept for backward compatibility) */ clientpemfile : CLIENTPEMFILE PATH { _setPEM(&(sslset.clientpemfile), $2, "SSL client PEM file", true); } ; /* deprecated by "ssl" options since monit 5.21 (kept for backward compatibility) */ allowselfcert : ALLOWSELFCERTIFICATION { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = true; } ; httpdport : PORT NUMBER readonly { Run.httpd.flags |= Httpd_Net; Run.httpd.socket.net.port = $2; Run.httpd.socket.net.readonly = $3; } ; httpdsocket : UNIXSOCKET PATH httpdsocketoptionlist { Run.httpd.flags |= Httpd_Unix; Run.httpd.socket.unix.path = $2; } ; httpdsocketoptionlist : /* EMPTY */ | httpdsocketoptionlist httpdsocketoption ; httpdsocketoption : UID STRING { Run.httpd.flags |= Httpd_UnixUid; Run.httpd.socket.unix.uid = get_uid($2, 0); FREE($2); } | GID STRING { Run.httpd.flags |= Httpd_UnixGid; Run.httpd.socket.unix.gid = get_gid($2, 0); FREE($2); } | UID NUMBER { Run.httpd.flags |= Httpd_UnixUid; Run.httpd.socket.unix.uid = get_uid(NULL, $2); } | GID NUMBER { Run.httpd.flags |= Httpd_UnixGid; Run.httpd.socket.unix.gid = get_gid(NULL, $2); } | PERMISSION NUMBER { Run.httpd.flags |= Httpd_UnixPermission; Run.httpd.socket.unix.permission = check_perm($2); } | READONLY { Run.httpd.socket.unix.readonly = true; } ; sigenable : SIGNATURE ENABLE | ENABLE SIGNATURE ; sigdisable : SIGNATURE DISABLE | DISABLE SIGNATURE ; signature : sigenable { Run.httpd.flags |= Httpd_Signature; } | sigdisable { Run.httpd.flags &= ~Httpd_Signature; } ; bindaddress : ADDRESS STRING { if (Run.httpd.socket.net.address) { yywarning2("The 'address' option can be specified only once, the last value will be used\n"); FREE(Run.httpd.socket.net.address); } Run.httpd.socket.net.address = $2; } ; allow : ALLOW STRING':'STRING readonly { addcredentials($2, $4, Digest_Cleartext, $5); } | ALLOW '@'STRING readonly { #ifdef HAVE_LIBPAM addpamauth($3, $4); #else yyerror("PAM is not supported"); FREE($3); #endif } | ALLOW PATH { addhtpasswdentry($2, NULL, Digest_Cleartext); FREE($2); } | ALLOW CLEARTEXT PATH { addhtpasswdentry($3, NULL, Digest_Cleartext); FREE($3); } | ALLOW MD5HASH PATH { addhtpasswdentry($3, NULL, Digest_Md5); FREE($3); } | ALLOW CRYPT PATH { addhtpasswdentry($3, NULL, Digest_Crypt); FREE($3); } | ALLOW PATH { htpasswd_file = $2; digesttype = Digest_Cleartext; } allowuserlist { FREE(htpasswd_file); } | ALLOW CLEARTEXT PATH { htpasswd_file = $3; digesttype = Digest_Cleartext; } allowuserlist { FREE(htpasswd_file); } | ALLOW MD5HASH PATH { htpasswd_file = $3; digesttype = Digest_Md5; } allowuserlist { FREE(htpasswd_file); } | ALLOW CRYPT PATH { htpasswd_file = $3; digesttype = Digest_Crypt; } allowuserlist { FREE(htpasswd_file); } | ALLOW STRING { if (! Engine_addAllow($2)) yywarning2("invalid allow option: %s", $2); FREE($2); } ; allowuserlist : allowuser | allowuserlist allowuser ; allowuser : STRING { addhtpasswdentry(htpasswd_file, $1, digesttype); FREE($1); } ; readonly : /* EMPTY */ { $$ = false; } | READONLY { $$ = true; } ; checkproc : CHECKPROC SERVICENAME PIDFILE PATH { createservice(Service_Process, $2, $4, check_process); } | CHECKPROC SERVICENAME PATHTOK PATH { createservice(Service_Process, $2, $4, check_process); } | CHECKPROC SERVICENAME MATCH STRING { createservice(Service_Process, $2, $4, check_process); matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = Str_dup($4); addmatch(&matchset, Action_Ignored, 0); } | CHECKPROC SERVICENAME MATCH PATH { createservice(Service_Process, $2, $4, check_process); matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = Str_dup($4); addmatch(&matchset, Action_Ignored, 0); } ; checkfile : CHECKFILE SERVICENAME PATHTOK PATH { createservice(Service_File, $2, $4, check_file); } ; checkfilesys : CHECKFILESYS SERVICENAME PATHTOK PATH { createservice(Service_Filesystem, $2, $4, check_filesystem); } | CHECKFILESYS SERVICENAME PATHTOK STRING { createservice(Service_Filesystem, $2, $4, check_filesystem); } ; checkdir : CHECKDIR SERVICENAME PATHTOK PATH { createservice(Service_Directory, $2, $4, check_directory); } ; checkhost : CHECKHOST SERVICENAME ADDRESS STRING { createservice(Service_Host, $2, $4, check_remote_host); } ; checknet : CHECKNET SERVICENAME ADDRESS STRING { if (Link_isGetByAddressSupported()) { createservice(Service_Net, $2, $4, check_net); current->inf.net->stats = Link_createForAddress($4); } else { yyerror("Network monitoring by IP address is not supported on this platform, please use 'check network with interface ' instead"); } } | CHECKNET SERVICENAME INTERFACE STRING { createservice(Service_Net, $2, $4, check_net); current->inf.net->stats = Link_createForInterface($4); } ; checksystem : CHECKSYSTEM SERVICENAME { char *servicename = $2; if (Str_sub(servicename, "$HOST")) { char hostname[STRLEN]; if (gethostname(hostname, sizeof(hostname))) { Log_error("System hostname error -- %s\n", STRERROR); cfg_errflag++; } else { Util_replaceString(&servicename, "$HOST", hostname); } } Run.system = createservice(Service_System, servicename, NULL, check_system); // The name given in the 'check system' statement overrides system hostname } ; checkfifo : CHECKFIFO SERVICENAME PATHTOK PATH { createservice(Service_Fifo, $2, $4, check_fifo); } ; checkprogram : CHECKPROGRAM SERVICENAME PATHTOK argumentlist programtimeout { createservice(Service_Program, $2, NULL, check_program); current->program->timeout = $5; current->program->lastOutput = StringBuffer_create(64); current->program->inprogressOutput = StringBuffer_create(64); } | CHECKPROGRAM SERVICENAME PATHTOK argumentlist useroptionlist programtimeout { createservice(Service_Program, $2, NULL, check_program); current->program->timeout = $6; current->program->lastOutput = StringBuffer_create(64); current->program->inprogressOutput = StringBuffer_create(64); } ; start : START argumentlist starttimeout { addcommand(START, $3); } | START argumentlist useroptionlist starttimeout { addcommand(START, $4); } ; stop : STOP argumentlist stoptimeout { addcommand(STOP, $3); } | STOP argumentlist useroptionlist stoptimeout { addcommand(STOP, $4); } ; restart : RESTART argumentlist restarttimeout { addcommand(RESTART, $3); } | RESTART argumentlist useroptionlist restarttimeout { addcommand(RESTART, $4); } ; argumentlist : argument | argumentlist argument ; useroptionlist : useroption | useroptionlist useroption ; argument : STRING { addargument($1); } | PATH { addargument($1); } ; useroption : UID STRING { addeuid(get_uid($2, 0)); FREE($2); } | GID STRING { addegid(get_gid($2, 0)); FREE($2); } | UID NUMBER { addeuid(get_uid(NULL, $2)); } | GID NUMBER { addegid(get_gid(NULL, $2)); } ; username : USERNAME MAILADDR { $$ = $2; } | USERNAME STRING { $$ = $2; } ; password : PASSWORD STRING { $$ = $2; } ; database : DATABASE STRING { $$ = $2; } ; hostname : /* EMPTY */ { $$ = NULL; } | HOSTNAME STRING { $$ = $2; } ; connection : IF FAILED host port connectionoptlist rate1 THEN action1 recovery_success { /* This is a workaround to support content match without having to create an URL object. 'urloption' creates the Request_T object we need minus the URL object, but with enough information to perform content test. TODO: Parser is in need of refactoring */ portset.url_request = urlrequest; portset.check_invers = false; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, $8, $9); addport(&(current->portlist), &portset); } | IF SUCCEEDED host port connectionoptlist rate1 THEN action1 recovery_failure { portset.url_request = urlrequest; portset.check_invers = true; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, $8, $9); addport(&(current->portlist), &portset); } ; connectionoptlist : /* EMPTY */ | connectionoptlist connectionopt ; connectionopt : ip | type | protocol | sendexpect | urloption | connectiontimeout | responsetime | outgoing | retry | ssl | sslchecksum | sslexpire ; connectionurl : IF FAILED URL URLOBJECT connectionurloptlist rate1 THEN action1 recovery_success { portset.check_invers = false; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; prepare_urlrequest($4); addeventaction(&(portset).action, $8, $9); addport(&(current->portlist), &portset); } | IF SUCCEEDED URL URLOBJECT connectionurloptlist rate1 THEN action1 recovery_failure { portset.check_invers = true; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; prepare_urlrequest($4); addeventaction(&(portset).action, $8, $9); addport(&(current->portlist), &portset); } ; connectionurloptlist : /* EMPTY */ | connectionurloptlist connectionurlopt ; connectionurlopt : urloption | connectiontimeout | retry | ssl | sslchecksum | sslexpire ; connectionunix : IF FAILED unixsocket connectionuxoptlist rate1 THEN action1 recovery_success { portset.check_invers = false; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, $7, $8); addport(&(current->socketlist), &portset); } | IF SUCCEEDED unixsocket connectionuxoptlist rate1 THEN action1 recovery_failure { portset.check_invers = true; portset.responsetime.operator = responsetimeset.operator; portset.responsetime.limit = responsetimeset.limit; addeventaction(&(portset).action, $7, $8); addport(&(current->socketlist), &portset); } ; connectionuxoptlist : /* EMPTY */ | connectionuxoptlist connectionuxopt ; connectionuxopt : type | protocol | sendexpect | connectiontimeout | responsetime | retry ; icmp : IF FAILED ICMP icmptype icmpoptlist rate1 THEN action1 recovery_success { icmpset.family = Socket_Ip; icmpset.check_invers = false; icmpset.type = $4; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $8, $9); addicmp(&icmpset); } | IF FAILED PING icmpoptlist rate1 THEN action1 recovery_success { icmpset.family = Socket_Ip; icmpset.check_invers = false; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF FAILED PING4 icmpoptlist rate1 THEN action1 recovery_success { icmpset.family = Socket_Ip4; icmpset.check_invers = false; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF FAILED PING6 icmpoptlist rate1 THEN action1 recovery_success { icmpset.family = Socket_Ip6; icmpset.check_invers = false; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF SUCCEEDED ICMP icmptype icmpoptlist rate1 THEN action1 recovery_failure { icmpset.family = Socket_Ip; icmpset.check_invers = true; icmpset.type = $4; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $8, $9); addicmp(&icmpset); } | IF SUCCEEDED PING icmpoptlist rate1 THEN action1 recovery_failure { icmpset.family = Socket_Ip; icmpset.check_invers = true; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF SUCCEEDED PING4 icmpoptlist rate1 THEN action1 recovery_failure { icmpset.family = Socket_Ip4; icmpset.check_invers = true; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF SUCCEEDED PING6 icmpoptlist rate1 THEN action1 recovery_failure { icmpset.family = Socket_Ip6; icmpset.check_invers = true; icmpset.responsetime.operator = responsetimeset.operator; icmpset.responsetime.limit = responsetimeset.limit; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } ; icmpoptlist : /* EMPTY */ | icmpoptlist icmpopt ; icmpopt : icmpcount | icmpsize | icmptimeout | icmpoutgoing | responsetime ; host : /* EMPTY */ { portset.hostname = Str_dup(current->type == Service_Host ? current->path : LOCALHOST); } | HOST STRING { portset.hostname = $2; } ; port : PORT NUMBER { portset.target.net.port = $2; } ; unixsocket : UNIXSOCKET PATH { portset.family = Socket_Unix; portset.target.unix.pathname = $2; } ; ip : IPV4 { portset.family = Socket_Ip4; } | IPV6 { portset.family = Socket_Ip6; } ; type : TYPE TCP { portset.type = Socket_Tcp; } | TYPE TCPSSL typeoptlist { // The typelist is kept for backward compatibility (replaced by ssloptionlist) portset.type = Socket_Tcp; sslset.flags = SSL_Enabled; } | TYPE UDP { portset.type = Socket_Udp; } ; typeoptlist : /* EMPTY */ | typeoptlist typeopt ; typeopt : sslversion | certmd5 ; outgoing : ADDRESS STRING { _parseOutgoingAddress($2, &(portset.outgoing)); } ; protocol : PROTOCOL APACHESTATUS apache_stat_list { portset.protocol = Protocol_get(Protocol_APACHESTATUS); } | PROTOCOL CLAMAV { portset.protocol = Protocol_get(Protocol_CLAMAV); } | PROTOCOL DEFAULT { portset.protocol = Protocol_get(Protocol_DEFAULT); } | PROTOCOL DNS { portset.protocol = Protocol_get(Protocol_DNS); } | PROTOCOL DWP { portset.protocol = Protocol_get(Protocol_DWP); } | PROTOCOL FAIL2BAN { portset.protocol = Protocol_get(Protocol_FAIL2BAN); } | PROTOCOL FTP { portset.protocol = Protocol_get(Protocol_FTP); } | PROTOCOL GPS { portset.protocol = Protocol_get(Protocol_GPS); } | PROTOCOL HTTP httplist { portset.protocol = Protocol_get(Protocol_HTTP); } | PROTOCOL HTTPS httplist { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_HTTP); } | PROTOCOL IMAP { portset.protocol = Protocol_get(Protocol_IMAP); } | PROTOCOL IMAPS { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_IMAP); } | PROTOCOL LDAP2 { portset.protocol = Protocol_get(Protocol_LDAP2); } | PROTOCOL LDAP3 { portset.protocol = Protocol_get(Protocol_LDAP3); } | PROTOCOL LMTP { portset.protocol = Protocol_get(Protocol_LMTP); } | PROTOCOL MEMCACHE { portset.protocol = Protocol_get(Protocol_MEMCACHE); } | PROTOCOL MONGODB { portset.protocol = Protocol_get(Protocol_MONGODB); } | PROTOCOL MQTT mqttlist { portset.protocol = Protocol_get(Protocol_MQTT); } | PROTOCOL MYSQL mysqllist { portset.protocol = Protocol_get(Protocol_MYSQL); } | PROTOCOL MYSQLS mysqllist { sslset.flags = SSL_StartTLS; portset.protocol = Protocol_get(Protocol_MYSQL); } | PROTOCOL NNTP { portset.protocol = Protocol_get(Protocol_NNTP); } | PROTOCOL NTP3 { portset.protocol = Protocol_get(Protocol_NTP3); portset.type = Socket_Udp; } | PROTOCOL PGSQL postgresqllist { portset.protocol = Protocol_get(Protocol_PGSQL); } | PROTOCOL POP { portset.protocol = Protocol_get(Protocol_POP); } | PROTOCOL POPS { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_POP); } | PROTOCOL POSTFIXPOLICY { portset.protocol = Protocol_get(Protocol_POSTFIXPOLICY); } | PROTOCOL RADIUS radiuslist { portset.protocol = Protocol_get(Protocol_RADIUS); } | PROTOCOL RDATE { portset.protocol = Protocol_get(Protocol_RDATE); } | PROTOCOL REDIS { portset.protocol = Protocol_get(Protocol_REDIS); } | PROTOCOL RSYNC { portset.protocol = Protocol_get(Protocol_RSYNC); } | PROTOCOL SIEVE { portset.protocol = Protocol_get(Protocol_SIEVE); } | PROTOCOL SIP siplist { portset.protocol = Protocol_get(Protocol_SIP); } | PROTOCOL SMTP smtplist { portset.protocol = Protocol_get(Protocol_SMTP); } | PROTOCOL SMTPS smtplist { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_SMTP); } | PROTOCOL SPAMASSASSIN { portset.protocol = Protocol_get(Protocol_SPAMASSASSIN); } | PROTOCOL SSH { portset.protocol = Protocol_get(Protocol_SSH); } | PROTOCOL TNS { portset.protocol = Protocol_get(Protocol_TNS); } | PROTOCOL WEBSOCKET websocketlist { portset.protocol = Protocol_get(Protocol_WEBSOCKET); } ; sendexpect : SEND STRING { if (portset.protocol->check == check_default || portset.protocol->check == check_generic) { portset.protocol = Protocol_get(Protocol_GENERIC); addgeneric(&portset, $2, NULL); } else { yyerror("The SEND statement is not allowed in the %s protocol context", portset.protocol->name); } } | EXPECT STRING { if (portset.protocol->check == check_default || portset.protocol->check == check_generic) { portset.protocol = Protocol_get(Protocol_GENERIC); addgeneric(&portset, NULL, $2); } else { yyerror("The EXPECT statement is not allowed in the %s protocol context", portset.protocol->name); } } ; websocketlist : websocket | websocketlist websocket ; websocket : ORIGIN STRING { portset.parameters.websocket.origin = $2; } | REQUEST PATH { portset.parameters.websocket.request = $2; } | HOST STRING { portset.parameters.websocket.host = $2; } | VERSIONOPT NUMBER { portset.parameters.websocket.version = $2; } ; smtplist : /* EMPTY */ | smtplist smtp ; smtp : username { portset.parameters.smtp.username = $1; } | password { portset.parameters.smtp.password = $1; } ; mqttlist : /* EMPTY */ | mqttlist mqtt ; mqtt : username { portset.parameters.mqtt.username = $1; } | password { portset.parameters.mqtt.password = $1; } ; mysqllist : /* EMPTY */ | mysqllist mysql ; mysql : username { portset.parameters.mysql.username = $1; } | password { portset.parameters.mysql.password = $1; } | RSAKEY CHECKSUM checksumoperator STRING { portset.parameters.mysql.rsaChecksum = $4; switch (cleanup_hash_string(portset.parameters.mysql.rsaChecksum)) { case 32: portset.parameters.mysql.rsaChecksumType = Hash_Md5; break; case 40: portset.parameters.mysql.rsaChecksumType = Hash_Sha1; break; default: yyerror2("Unknown checksum type: [%s] is not MD5 nor SHA1", portset.parameters.mysql.rsaChecksum); } } | RSAKEY CHECKSUM MD5HASH checksumoperator STRING { portset.parameters.mysql.rsaChecksum = $5; if (cleanup_hash_string(portset.parameters.mysql.rsaChecksum) != 32) yyerror2("Unknown checksum type: [%s] is not MD5", portset.parameters.mysql.rsaChecksum); portset.parameters.mysql.rsaChecksumType = Hash_Md5; } | RSAKEY CHECKSUM SHA1HASH checksumoperator STRING { portset.parameters.mysql.rsaChecksum = $5; if (cleanup_hash_string(portset.parameters.mysql.rsaChecksum) != 40) yyerror2("Unknown checksum type: [%s] is not SHA1", portset.parameters.mysql.rsaChecksum); portset.parameters.mysql.rsaChecksumType = Hash_Sha1; } ; postgresqllist : /* EMPTY */ | postgresqllist postgresql ; postgresql : username { portset.parameters.postgresql.username = $1; } | password { portset.parameters.postgresql.password = $1; } | database { portset.parameters.postgresql.database = $1; } ; target : TARGET MAILADDR { $$ = $2; } | TARGET STRING { $$ = $2; } ; maxforward : MAXFORWARD NUMBER { $$ = verifyMaxForward($2); } ; siplist : /* EMPTY */ | siplist sip ; sip : target { portset.parameters.sip.target = $1; } | maxforward { portset.parameters.sip.maxforward = $1; } ; httplist : /* EMPTY */ | httplist http ; http : username { portset.parameters.http.username = $1; } | password { portset.parameters.http.password = $1; } | request | responsesum | status | method | hostheader | '[' httpheaderlist ']' ; status : STATUS operator NUMBER { if ($3 < 0) { yyerror2("The status value must be greater or equal to 0"); } portset.parameters.http.operator = $2; portset.parameters.http.status = $3; portset.parameters.http.hasStatus = true; } ; method : METHOD GET { portset.parameters.http.method = Http_Get; } | METHOD HEAD { portset.parameters.http.method = Http_Head; } ; request : REQUEST PATH { portset.parameters.http.request = Util_urlEncode($2, false); FREE($2); } | REQUEST STRING { portset.parameters.http.request = Util_urlEncode($2, false); FREE($2); } ; responsesum : CHECKSUM STRING { portset.parameters.http.checksum = $2; } ; hostheader : HOSTHEADER STRING { addhttpheader(&portset, Str_cat("Host:%s", $2)); FREE($2); } ; httpheaderlist : /* EMPTY */ | httpheaderlist HTTPHEADER { addhttpheader(&portset, $2); } ; secret : SECRET STRING { $$ = $2; } ; radiuslist : /* EMPTY */ | radiuslist radius ; radius : secret { portset.parameters.radius.secret = $1; } ; apache_stat_list: apache_stat | apache_stat_list apache_stat ; apache_stat : username { portset.parameters.apachestatus.username = $1; } | password { portset.parameters.apachestatus.password = $1; } | PATHTOK PATH { portset.parameters.apachestatus.path = $2; } | LOGLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.loglimitOP = $2; portset.parameters.apachestatus.loglimit = $3; } | CLOSELIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.closelimitOP = $2; portset.parameters.apachestatus.closelimit = $3; } | DNSLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.dnslimitOP = $2; portset.parameters.apachestatus.dnslimit = $3; } | KEEPALIVELIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.keepalivelimitOP = $2; portset.parameters.apachestatus.keepalivelimit = $3; } | REPLYLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.replylimitOP = $2; portset.parameters.apachestatus.replylimit = $3; } | REQUESTLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.requestlimitOP = $2; portset.parameters.apachestatus.requestlimit = $3; } | STARTLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.startlimitOP = $2; portset.parameters.apachestatus.startlimit = $3; } | WAITLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.waitlimitOP = $2; portset.parameters.apachestatus.waitlimit = $3; } | GRACEFULLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.gracefullimitOP = $2; portset.parameters.apachestatus.gracefullimit = $3; } | CLEANUPLIMIT operator NUMBER PERCENT { portset.parameters.apachestatus.cleanuplimitOP = $2; portset.parameters.apachestatus.cleanuplimit = $3; } ; exist : IF NOT EXIST rate1 THEN action1 recovery_success { addeventaction(&(nonexistset).action, $6, $7); addnonexist(&nonexistset); } | IF EXIST rate1 THEN action1 recovery_success { addeventaction(&(existset).action, $5, $6); addexist(&existset); } ; pid : IF CHANGED PID rate1 THEN action1 { addeventaction(&(pidset).action, $6, Action_Ignored); addpid(&pidset); } ; ppid : IF CHANGED PPID rate1 THEN action1 { addeventaction(&(ppidset).action, $6, Action_Ignored); addppid(&ppidset); } ; uptime : IF UPTIME operator NUMBER time rate1 THEN action1 recovery_success { uptimeset.operator = $3; uptimeset.uptime = ((unsigned long long)$4 * $5); addeventaction(&(uptimeset).action, $8, $9); adduptime(&uptimeset); } ; responsetime : RESPONSETIME operator NUMBER MILLISECOND { responsetimeset.operator = $2; responsetimeset.limit = $3; } | RESPONSETIME operator NUMBER SECOND { responsetimeset.operator = $2; responsetimeset.limit = $3 * 1000; } ; icmpcount : COUNT NUMBER { icmpset.count = $2; } ; icmpsize : SIZE NUMBER { icmpset.size = $2; if (icmpset.size < 8) { yyerror2("The minimum ping size is 8 bytes"); } else if (icmpset.size > 1492) { yyerror2("The maximum ping size is 1492 bytes"); } } ; icmptimeout : TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else icmpset.timeout = $2 * 1000; // timeout is in milliseconds internally } ; icmpoutgoing : ADDRESS STRING { _parseOutgoingAddress($2, &(icmpset.outgoing)); } ; stoptimeout : /* EMPTY */ { $$ = Run.limits.stopTimeout; } | TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else $$ = $2 * 1000; // milliseconds internally } ; starttimeout : /* EMPTY */ { $$ = Run.limits.startTimeout; } | TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else $$ = $2 * 1000; // milliseconds internally } ; restarttimeout : /* EMPTY */ { $$ = Run.limits.restartTimeout; } | TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else $$ = $2 * 1000; // milliseconds internally } ; programtimeout : /* EMPTY */ { $$ = Run.limits.programTimeout; } | TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else $$ = $2 * 1000; // milliseconds internally } ; nettimeout : /* EMPTY */ { $$ = Run.limits.networkTimeout; } | TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else $$ = $2 * 1000; // net timeout is in milliseconds internally } ; connectiontimeout : TIMEOUT NUMBER SECOND { if ($2 <= 0) yyerror2("The timeout value must be > 0"); else portset.timeout = $2 * 1000; // timeout is in milliseconds internally } ; retry : RETRY NUMBER { portset.retry = $2; } ; actionrate : IF NUMBER RESTART NUMBER CYCLE THEN action1 { actionrateset.count = $2; actionrateset.cycle = $4; addeventaction(&(actionrateset).action, $7, Action_Alert); addactionrate(&actionrateset); } | IF NUMBER RESTART NUMBER CYCLE THEN TIMEOUT { actionrateset.count = $2; actionrateset.cycle = $4; addeventaction(&(actionrateset).action, Action_Unmonitor, Action_Alert); addactionrate(&actionrateset); } ; urloption : CONTENT urloperator STRING { seturlrequest($2, $3); FREE($3); } ; urloperator : EQUAL { $$ = Operator_Equal; } | NOTEQUAL { $$ = Operator_NotEqual; } ; alert : alertmail formatlist reminder { mailset.events = Event_All; addmail($1, &mailset, ¤t->maillist); } | alertmail '{' eventoptionlist '}' formatlist reminder { addmail($1, &mailset, ¤t->maillist); } | alertmail NOT '{' eventoptionlist '}' formatlist reminder { mailset.events = ~mailset.events; addmail($1, &mailset, ¤t->maillist); } | noalertmail { addmail($1, &mailset, ¤t->maillist); } ; alertmail : ALERT MAILADDR { $$ = $2; } ; noalertmail : NOALERT MAILADDR { $$ = $2; } ; eventoptionlist : eventoption | eventoptionlist eventoption ; eventoption : ACTION { mailset.events |= Event_Action; } | BYTEIN { mailset.events |= Event_ByteIn; } | BYTEOUT { mailset.events |= Event_ByteOut; } | CHECKSUM { mailset.events |= Event_Checksum; } | CONNECTION { mailset.events |= Event_Connection; } | CONTENT { mailset.events |= Event_Content; } | DATA { mailset.events |= Event_Data; } | EXEC { mailset.events |= Event_Exec; } | EXIST { mailset.events |= Event_Exist; } | FSFLAG { mailset.events |= Event_FsFlag; } | GID { mailset.events |= Event_Gid; } | ICMP { mailset.events |= Event_Icmp; } | INSTANCE { mailset.events |= Event_Instance; } | INVALID { mailset.events |= Event_Invalid; } | LINK { mailset.events |= Event_Link; } | NONEXIST { mailset.events |= Event_NonExist; } | PACKETIN { mailset.events |= Event_PacketIn; } | PACKETOUT { mailset.events |= Event_PacketOut; } | PERMISSION { mailset.events |= Event_Permission; } | PID { mailset.events |= Event_Pid; } | PPID { mailset.events |= Event_PPid; } | RESOURCE { mailset.events |= Event_Resource; } | SATURATION { mailset.events |= Event_Saturation; } | SIZE { mailset.events |= Event_Size; } | SPEED { mailset.events |= Event_Speed; } | STATUS { mailset.events |= Event_Status; } | TIMEOUT { mailset.events |= Event_Timeout; } | TIME { mailset.events |= Event_Timestamp; } | UID { mailset.events |= Event_Uid; } | UPTIME { mailset.events |= Event_Uptime; } ; formatlist : /* EMPTY */ | MAILFORMAT '{' formatoptionlist '}' ; formatoptionlist: formatoption | formatoptionlist formatoption ; formatoption : MAILFROM ADDRESSOBJECT { mailset.from = $
1; } | MAILREPLYTO ADDRESSOBJECT { mailset.replyto = $
1; } | MAILSUBJECT { mailset.subject = $1; } | MAILBODY { mailset.message = $1; } ; every : EVERY NUMBER CYCLE { _sanityCheckEveryStatement(current); current->every.type = Every_SkipCycles; current->every.spec.cycle.counter = current->every.spec.cycle.number = $2; } | EVERY TIMESPEC { _sanityCheckEveryStatement(current); if (Time_incron($2, Time_now()) < 0) yyerror2("Invalid cron specification"); current->every.type = Every_Cron; current->every.spec.cron = $2; } | NOTEVERY TIMESPEC { _sanityCheckEveryStatement(current); if (Time_incron($2, Time_now()) < 0) yyerror2("Invalid cron specification"); current->every.type = Every_NotInCron; current->every.spec.cron = $2; } ; mode : MODE ACTIVE { current->mode = Monitor_Active; } | MODE PASSIVE { current->mode = Monitor_Passive; } | MODE MANUAL { // Deprecated since monit 5.18 current->onreboot = Onreboot_Laststate; } ; onreboot : ONREBOOT START { current->onreboot = Onreboot_Start; } | ONREBOOT NOSTART { current->onreboot = Onreboot_Nostart; current->monitor = Monitor_Not; } | ONREBOOT LASTSTATE { current->onreboot = Onreboot_Laststate; } ; group : GROUP STRINGNAME { addservicegroup($2); FREE($2); } ; hostgrouplist : /* EMPTY */ | hostgrouplist HOSTGROUPNAME { addhostgroup($2); } ; depend : DEPENDS dependlist ; dependlist : dependant | dependlist dependant ; dependant : SERVICENAME { adddependant($1); } ; statusvalue : IF STATUS operator NUMBER rate1 THEN action1 recovery_success { statusset.initialized = true; statusset.operator = $3; statusset.return_value = $4; addeventaction(&(statusset).action, $7, $8); addstatus(&statusset); } | IF CHANGED STATUS rate1 THEN action1 { statusset.initialized = false; statusset.operator = Operator_Changed; statusset.return_value = 0; addeventaction(&(statusset).action, $6, Action_Ignored); addstatus(&statusset); } ; resourceprocess : IF resourceprocesslist rate1 THEN action1 recovery_success { addeventaction(&(resourceset).action, $5, $6); addresource(&resourceset); } ; resourceprocesslist : resourceprocessopt | resourceprocesslist resourceprocessopt ; resourceprocessopt : resourcecpuproc | resourcememproc | resourcethreads | resourcechild | resourceload | resourceread | resourcewrite ; resourcesystem : IF resourcesystemlist rate1 THEN action1 recovery_success { addeventaction(&(resourceset).action, $5, $6); addresource(&resourceset); } ; resourcesystemlist : resourcesystemopt | resourcesystemlist resourcesystemopt ; resourcesystemopt : resourceload | resourcemem | resourceswap | resourcecpu ; resourcecpuproc : CPU operator value PERCENT { resourceset.resource_id = Resource_CpuPercent; resourceset.operator = $2; resourceset.limit = $3; } | TOTALCPU operator value PERCENT { resourceset.resource_id = Resource_CpuPercentTotal; resourceset.operator = $2; resourceset.limit = $3; } ; resourcecpu : resourcecpuid operator value PERCENT { resourceset.resource_id = $1; resourceset.operator = $2; resourceset.limit = $3; } ; resourcecpuid : CPUUSER { if (System_Info.statisticsAvailable & Statistics_CpuUser) $$ = Resource_CpuUser; else yywarning2("The CPU user usage statistics is not available on this system\n"); } | CPUSYSTEM { if (System_Info.statisticsAvailable & Statistics_CpuSystem) $$ = Resource_CpuSystem; else yywarning2("The CPU system usage statistics is not available on this system\n"); } | CPUWAIT { if (System_Info.statisticsAvailable & Statistics_CpuIOWait) $$ = Resource_CpuWait; else yywarning2("The CPU I/O wait usage statistics is not available on this system\n"); } | CPUNICE { if (System_Info.statisticsAvailable & Statistics_CpuNice) $$ = Resource_CpuNice; else yywarning2("The CPU nice usage statistics is not available on this system\n"); } | CPUHARDIRQ { if (System_Info.statisticsAvailable & Statistics_CpuHardIRQ) $$ = Resource_CpuHardIRQ; else yywarning2("The CPU hardware IRQ usage statistics is not available on this system\n"); } | CPUSOFTIRQ { if (System_Info.statisticsAvailable & Statistics_CpuSoftIRQ) $$ = Resource_CpuSoftIRQ; else yywarning2("The CPU software IRQ usage statistics is not available on this system\n"); } | CPUSTEAL { if (System_Info.statisticsAvailable & Statistics_CpuSteal) $$ = Resource_CpuSteal; else yywarning2("The CPU steal usage statistics is not available on this system\n"); } | CPUGUEST { if (System_Info.statisticsAvailable & Statistics_CpuGuest) $$ = Resource_CpuGuest; else yywarning2("The CPU guest usage statistics is not available on this system\n"); } | CPUGUESTNICE { if (System_Info.statisticsAvailable & Statistics_CpuGuestNice) $$ = Resource_CpuGuestNice; else yywarning2("The CPU guest nice usage statistics is not available on this system\n"); } | CPU { $$ = Resource_CpuPercent; } ; resourcemem : MEMORY operator value unit { resourceset.resource_id = Resource_MemoryKbyte; resourceset.operator = $2; resourceset.limit = $3 * $4; } | MEMORY operator value PERCENT { resourceset.resource_id = Resource_MemoryPercent; resourceset.operator = $2; resourceset.limit = $3; } ; resourcememproc : MEMORY operator value unit { resourceset.resource_id = Resource_MemoryKbyte; resourceset.operator = $2; resourceset.limit = $3 * $4; } | MEMORY operator value PERCENT { resourceset.resource_id = Resource_MemoryPercent; resourceset.operator = $2; resourceset.limit = $3; } | TOTALMEMORY operator value unit { resourceset.resource_id = Resource_MemoryKbyteTotal; resourceset.operator = $2; resourceset.limit = $3 * $4; } | TOTALMEMORY operator value PERCENT { resourceset.resource_id = Resource_MemoryPercentTotal; resourceset.operator = $2; resourceset.limit = $3; } ; resourceswap : SWAP operator value unit { resourceset.resource_id = Resource_SwapKbyte; resourceset.operator = $2; resourceset.limit = $3 * $4; } | SWAP operator value PERCENT { resourceset.resource_id = Resource_SwapPercent; resourceset.operator = $2; resourceset.limit = $3; } ; resourcethreads : THREADS operator NUMBER { resourceset.resource_id = Resource_Threads; resourceset.operator = $2; resourceset.limit = $3; } ; resourcechild : CHILDREN operator NUMBER { resourceset.resource_id = Resource_Children; resourceset.operator = $2; resourceset.limit = $3; } ; resourceload : resourceloadavg coremultiplier operator value { switch ($1) { case Resource_LoadAverage1m: resourceset.resource_id = $2 > 1 ? Resource_LoadAveragePerCore1m : $1; break; case Resource_LoadAverage5m: resourceset.resource_id = $2 > 1 ? Resource_LoadAveragePerCore5m : $1; break; case Resource_LoadAverage15m: resourceset.resource_id = $2 > 1 ? Resource_LoadAveragePerCore15m : $1; break; default: resourceset.resource_id = $1; break; } resourceset.operator = $3; resourceset.limit = $4; } ; resourceloadavg : LOADAVG1 { $$ = Resource_LoadAverage1m; } | LOADAVG5 { $$ = Resource_LoadAverage5m; } | LOADAVG15 { $$ = Resource_LoadAverage15m; } ; coremultiplier : /* EMPTY */ { $$ = 1; } | CORE { $$ = System_Info.cpu.count; } ; resourceread : READ operator value unit currenttime { resourceset.resource_id = Resource_ReadBytes; resourceset.operator = $2; resourceset.limit = $3 * $4; } | DISK READ operator value unit currenttime { resourceset.resource_id = Resource_ReadBytesPhysical; resourceset.operator = $3; resourceset.limit = $4 * $5; } | DISK READ operator NUMBER OPERATION { resourceset.resource_id = Resource_ReadOperations; resourceset.operator = $3; resourceset.limit = $4; } ; resourcewrite : WRITE operator value unit currenttime { resourceset.resource_id = Resource_WriteBytes; resourceset.operator = $2; resourceset.limit = $3 * $4; } | DISK WRITE operator value unit currenttime { resourceset.resource_id = Resource_WriteBytesPhysical; resourceset.operator = $3; resourceset.limit = $4 * $5; } | DISK WRITE operator NUMBER OPERATION { resourceset.resource_id = Resource_WriteOperations; resourceset.operator = $3; resourceset.limit = $4; } ; value : REAL { $$ = $1; } | NUMBER { $$ = (float) $1; } ; timestamptype : TIME { $$ = Timestamp_Default; } | ATIME { $$ = Timestamp_Access; } | CTIME { $$ = Timestamp_Change; } | MTIME { $$ = Timestamp_Modification; } ; timestamp : IF timestamptype operator NUMBER time rate1 THEN action1 recovery_success { timestampset.type = $2; timestampset.operator = $3; timestampset.time = ($4 * $5); addeventaction(&(timestampset).action, $8, $9); addtimestamp(×tampset); } | IF CHANGED timestamptype rate1 THEN action1 { timestampset.type = $3; timestampset.test_changes = true; addeventaction(&(timestampset).action, $6, Action_Ignored); addtimestamp(×tampset); } ; operator : /* EMPTY */ { $$ = Operator_Equal; } | GREATER { $$ = Operator_Greater; } | GREATEROREQUAL { $$ = Operator_GreaterOrEqual; } | LESS { $$ = Operator_Less; } | LESSOREQUAL { $$ = Operator_LessOrEqual; } | EQUAL { $$ = Operator_Equal; } | NOTEQUAL { $$ = Operator_NotEqual; } | CHANGED { $$ = Operator_Changed; } ; time : /* EMPTY */ { $$ = Time_Second; } | SECOND { $$ = Time_Second; } | MINUTE { $$ = Time_Minute; } | HOUR { $$ = Time_Hour; } | DAY { $$ = Time_Day; } | MONTH { $$ = Time_Month; } ; totaltime : MINUTE { $$ = Time_Minute; } | HOUR { $$ = Time_Hour; } | DAY { $$ = Time_Day; } currenttime : /* EMPTY */ { $$ = Time_Second; } | SECOND { $$ = Time_Second; } // Add timeout to the test action exec command exectimeout : /* EMPTY */ { timeout = Run.limits.execTimeout; } | TIMEOUT NUMBER SECOND { if ($3 < 0) { yyerror2("The timeout must be greater or equal to 0"); } timeout = $2 * 1000; // milliseconds internally } ; repeat : /* EMPTY */ { repeat = 0; } | REPEAT EVERY CYCLE { repeat = 1; } | REPEAT EVERY NUMBER CYCLE { if ($3 < 0) { yyerror2("The number of repeat cycles must be greater or equal to 0"); } repeat = $3; } ; action : ALERT { $$ = Action_Alert; } | EXEC argumentlist exectimeout repeat { $$ = Action_Exec; } | EXEC argumentlist useroptionlist exectimeout repeat { $$ = Action_Exec; } | IGNORE { $$ = Action_Ignored; } | RESTART { $$ = Action_Restart; } | START { $$ = Action_Start; } | STOP { $$ = Action_Stop; } | UNMONITOR { $$ = Action_Unmonitor; } ; action1 : action { $$ = $1; if ($1 == Action_Exec && command) { repeat1 = repeat; repeat = 0; command->timeout = timeout; timeout = 0; command1 = command; command = NULL; } } ; action2 : action { $$ = $1; if ($1 == Action_Exec && command) { repeat2 = repeat; repeat = 0; command->timeout = timeout; timeout = 0; command2 = command; command = NULL; } } ; rateXcycles : NUMBER CYCLE { if ($1 < 1 || (unsigned long)$1 > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %zu", BITMAP_MAX); } else { rate.count = $1; rate.cycles = $1; } } ; rateXYcycles : NUMBER NUMBER CYCLE { if ($2 < 1 || (unsigned long)$2 > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %zu", BITMAP_MAX); } else if ($1 < 1 || $1 > $2) { yyerror2("The number of events must be between 1 and less then poll cycles"); } else { rate.count = $1; rate.cycles = $2; } } ; rate1 : /* EMPTY */ | rateXcycles { rate1.count = rate.count; rate1.cycles = rate.cycles; reset_rateset(&rate); } | rateXYcycles { rate1.count = rate.count; rate1.cycles = rate.cycles; reset_rateset(&rate); } ; rate2 : /* EMPTY */ | rateXcycles { rate2.count = rate.count; rate2.cycles = rate.cycles; reset_rateset(&rate); } | rateXYcycles { rate2.count = rate.count; rate2.cycles = rate.cycles; reset_rateset(&rate); } ; recovery_success : /* EMPTY */ { $$ = Action_Alert; } | ELSE action2 { $$ = $2; } | ELSE IF RECOVERED rate2 THEN action2 { $$ = $6; } | ELSE IF PASSED rate2 THEN action2 { $$ = $6; } | ELSE IF SUCCEEDED rate2 THEN action2 { $$ = $6; } ; recovery_failure : /* EMPTY */ { $$ = Action_Alert; } | ELSE action2 { $$ = $2; } | ELSE IF FAILED rate2 THEN action2 { $$ = $6; } ; checksum : IF FAILED hashtype CHECKSUM rate1 THEN action1 recovery_success { addeventaction(&(checksumset).action, $7, $8); addchecksum(&checksumset); } | IF FAILED hashtype CHECKSUM EXPECT STRING rate1 THEN action1 recovery_success { snprintf(checksumset.hash, sizeof(checksumset.hash), "%s", $6); FREE($6); addeventaction(&(checksumset).action, $9, $10); addchecksum(&checksumset); } | IF CHANGED hashtype CHECKSUM rate1 THEN action1 { checksumset.test_changes = true; addeventaction(&(checksumset).action, $7, Action_Ignored); addchecksum(&checksumset); } ; hashtype : /* EMPTY */ { checksumset.type = Hash_Unknown; } | MD5HASH { checksumset.type = Hash_Md5; } | SHA1HASH { checksumset.type = Hash_Sha1; } ; inode : IF INODE operator NUMBER rate1 THEN action1 recovery_success { filesystemset.resource = Resource_Inode; filesystemset.operator = $3; filesystemset.limit_absolute = $4; addeventaction(&(filesystemset).action, $7, $8); addfilesystem(&filesystemset); } | IF INODE operator value PERCENT rate1 THEN action1 recovery_success { filesystemset.resource = Resource_Inode; filesystemset.operator = $3; filesystemset.limit_percent = $4; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } | IF INODE TFREE operator NUMBER rate1 THEN action1 recovery_success { filesystemset.resource = Resource_InodeFree; filesystemset.operator = $4; filesystemset.limit_absolute = $5; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } | IF INODE TFREE operator value PERCENT rate1 THEN action1 recovery_success { filesystemset.resource = Resource_InodeFree; filesystemset.operator = $4; filesystemset.limit_percent = $5; addeventaction(&(filesystemset).action, $9, $10); addfilesystem(&filesystemset); } ; space : IF SPACE operator value unit rate1 THEN action1 recovery_success { filesystemset.resource = Resource_Space; filesystemset.operator = $3; filesystemset.limit_absolute = $4 * $5; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } | IF SPACE operator value PERCENT rate1 THEN action1 recovery_success { filesystemset.resource = Resource_Space; filesystemset.operator = $3; filesystemset.limit_percent = $4; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } | IF SPACE TFREE operator value unit rate1 THEN action1 recovery_success { filesystemset.resource = Resource_SpaceFree; filesystemset.operator = $4; filesystemset.limit_absolute = $5 * $6; addeventaction(&(filesystemset).action, $9, $10); addfilesystem(&filesystemset); } | IF SPACE TFREE operator value PERCENT rate1 THEN action1 recovery_success { filesystemset.resource = Resource_SpaceFree; filesystemset.operator = $4; filesystemset.limit_percent = $5; addeventaction(&(filesystemset).action, $9, $10); addfilesystem(&filesystemset); } ; read : IF READ operator value unit currenttime rate1 THEN action1 recovery_success { filesystemset.resource = Resource_ReadBytes; filesystemset.operator = $3; filesystemset.limit_absolute = $4 * $5; addeventaction(&(filesystemset).action, $9, $10); addfilesystem(&filesystemset); } | IF READ operator NUMBER OPERATION rate1 THEN action1 recovery_success { filesystemset.resource = Resource_ReadOperations; filesystemset.operator = $3; filesystemset.limit_absolute = $4; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } ; write : IF WRITE operator value unit currenttime rate1 THEN action1 recovery_success { filesystemset.resource = Resource_WriteBytes; filesystemset.operator = $3; filesystemset.limit_absolute = $4 * $5; addeventaction(&(filesystemset).action, $9, $10); addfilesystem(&filesystemset); } | IF WRITE operator NUMBER OPERATION rate1 THEN action1 recovery_success { filesystemset.resource = Resource_WriteOperations; filesystemset.operator = $3; filesystemset.limit_absolute = $4; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } ; servicetime : IF SERVICETIME operator NUMBER MILLISECOND rate1 THEN action1 recovery_success { filesystemset.resource = Resource_ServiceTime; filesystemset.operator = $3; filesystemset.limit_absolute = $4; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } | IF SERVICETIME operator value SECOND rate1 THEN action1 recovery_success { filesystemset.resource = Resource_ServiceTime; filesystemset.operator = $3; filesystemset.limit_absolute = $4 * 1000; addeventaction(&(filesystemset).action, $8, $9); addfilesystem(&filesystemset); } ; fsflag : IF CHANGED FSFLAG rate1 THEN action1 { addeventaction(&(fsflagset).action, $6, Action_Ignored); addfsflag(&fsflagset); } ; unit : /* empty */ { $$ = Unit_Byte; } | BYTE { $$ = Unit_Byte; } | KILOBYTE { $$ = Unit_Kilobyte; } | MEGABYTE { $$ = Unit_Megabyte; } | GIGABYTE { $$ = Unit_Gigabyte; } ; permission : IF FAILED PERMISSION NUMBER rate1 THEN action1 recovery_success { permset.perm = check_perm($4); addeventaction(&(permset).action, $7, $8); addperm(&permset); } | IF CHANGED PERMISSION rate1 THEN action1 recovery_success { permset.test_changes = true; addeventaction(&(permset).action, $6, Action_Ignored); addperm(&permset); } ; programmatch : IF CONTENT urloperator STRING rate1 THEN action1 { matchset.not = $3 == Operator_Equal ? false : true; matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = $4; addmatch(&matchset, $7, 0); } | IF CONTENT CHANGED rate1 THEN action1 recovery_success { addoutputchange(false, $6, $7); } | IF CONTENT NOT CHANGED rate1 THEN action1 recovery_success { addoutputchange(true, $7, $8); } ; match : IF CONTENT urloperator PATH rate1 THEN action1 { matchset.not = $3 == Operator_Equal ? false : true; matchset.ignore = false; matchset.match_path = $4; matchset.match_string = NULL; addmatchpath(&matchset, $7); FREE($4); } | IF CONTENT urloperator STRING rate1 THEN action1 { matchset.not = $3 == Operator_Equal ? false : true; matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = $4; addmatch(&matchset, $7, 0); } | IGNORE CONTENT urloperator PATH { matchset.not = $3 == Operator_Equal ? false : true; matchset.ignore = true; matchset.match_path = $4; matchset.match_string = NULL; addmatchpath(&matchset, Action_Ignored); FREE($4); } | IGNORE CONTENT urloperator STRING { matchset.not = $3 == Operator_Equal ? false : true; matchset.ignore = true; matchset.match_path = NULL; matchset.match_string = $4; addmatch(&matchset, Action_Ignored, 0); } /* The below MATCH statement is deprecated (replaced by CONTENT) */ | IF matchflagnot MATCH PATH rate1 THEN action1 { matchset.ignore = false; matchset.match_path = $4; matchset.match_string = NULL; addmatchpath(&matchset, $7); FREE($4); } | IF matchflagnot MATCH STRING rate1 THEN action1 { matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = $4; addmatch(&matchset, $7, 0); } | IGNORE matchflagnot MATCH PATH { matchset.ignore = true; matchset.match_path = $4; matchset.match_string = NULL; addmatchpath(&matchset, Action_Ignored); FREE($4); } | IGNORE matchflagnot MATCH STRING { matchset.ignore = true; matchset.match_path = NULL; matchset.match_string = $4; addmatch(&matchset, Action_Ignored, 0); } ; matchflagnot : /* EMPTY */ { matchset.not = false; } | NOT { matchset.not = true; } ; size : IF SIZE operator NUMBER unit rate1 THEN action1 recovery_success { sizeset.operator = $3; sizeset.size = ((unsigned long long)$4 * $5); addeventaction(&(sizeset).action, $8, $9); addsize(&sizeset); } | IF CHANGED SIZE rate1 THEN action1 { sizeset.test_changes = true; addeventaction(&(sizeset).action, $6, Action_Ignored); addsize(&sizeset); } ; hardlink : IF HARDLINK operator NUMBER rate1 THEN action1 recovery_success { nlinkset.operator = $3; nlinkset.nlink = ((unsigned long long)$4); addeventaction(&(nlinkset).action, $7, $8); addnlink(&nlinkset); } | IF CHANGED HARDLINK rate1 THEN action1 { nlinkset.test_changes = true; addeventaction(&(nlinkset).action, $6, Action_Ignored); addnlink(&nlinkset); } ; uid : IF FAILED UID STRING rate1 THEN action1 recovery_success { uidset.uid = get_uid($4, 0); addeventaction(&(uidset).action, $7, $8); current->uid = adduid(&uidset); FREE($4); } | IF FAILED UID NUMBER rate1 THEN action1 recovery_success { uidset.uid = get_uid(NULL, $4); addeventaction(&(uidset).action, $7, $8); current->uid = adduid(&uidset); } ; euid : IF FAILED EUID STRING rate1 THEN action1 recovery_success { uidset.uid = get_uid($4, 0); addeventaction(&(uidset).action, $7, $8); current->euid = adduid(&uidset); FREE($4); } | IF FAILED EUID NUMBER rate1 THEN action1 recovery_success { uidset.uid = get_uid(NULL, $4); addeventaction(&(uidset).action, $7, $8); current->euid = adduid(&uidset); } ; secattr : IF FAILED SECURITY ATTRIBUTE STRING rate1 THEN action1 recovery_success { addsecurityattribute($5, $8, $9); } | IF FAILED SECURITY ATTRIBUTE PATH rate1 THEN action1 recovery_success { addsecurityattribute($5, $8, $9); } ; filedescriptorssystem : IF FILEDESCRIPTORS operator NUMBER rate1 THEN action1 recovery_success { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem) addfiledescriptors($3, false, (long long)$4, -1., $7, $8); else yywarning("The per-system filedescriptors statistics is not available on this system\n"); } | IF FILEDESCRIPTORS operator value PERCENT rate1 THEN action1 recovery_success { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem) addfiledescriptors($3, false, -1LL, $4, $8, $9); else yywarning("The per-system filedescriptors statistics is not available on this system\n"); } ; filedescriptorsprocess : IF FILEDESCRIPTORS operator NUMBER rate1 THEN action1 recovery_success { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcess) addfiledescriptors($3, false, (long long)$4, -1., $7, $8); else yywarning("The per-process filedescriptors statistics is not available on this system\n"); } | IF FILEDESCRIPTORS operator value PERCENT rate1 THEN action1 recovery_success { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcessMax) addfiledescriptors($3, false, -1LL, $4, $8, $9); else yywarning("The per-process filedescriptors maximum is not exposed on this system, so we cannot compute usage %%, please use the test with absolute value\n"); } ; filedescriptorsprocesstotal : IF TOTAL FILEDESCRIPTORS operator NUMBER rate1 THEN action1 recovery_success { if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerProcess) addfiledescriptors($4, true, (long long)$5, -1., $8, $9); else yywarning("The per-process filedescriptors statistics is not available on this system\n"); } ; gid : IF FAILED GID STRING rate1 THEN action1 recovery_success { gidset.gid = get_gid($4, 0); addeventaction(&(gidset).action, $7, $8); current->gid = addgid(&gidset); FREE($4); } | IF FAILED GID NUMBER rate1 THEN action1 recovery_success { gidset.gid = get_gid(NULL, $4); addeventaction(&(gidset).action, $7, $8); current->gid = addgid(&gidset); } ; linkstatus : IF FAILED LINK rate1 THEN action1 recovery_success { /* Deprecated */ addeventaction(&(linkstatusset).action, $6, $7); addlinkstatus(current, &linkstatusset); } | IF LINK DOWN rate1 THEN action1 recovery_success { linkstatusset.check_invers = false; addeventaction(&(linkstatusset).action, $6, $7); addlinkstatus(current, &linkstatusset); } | IF LINK UP rate1 THEN action1 recovery_failure { linkstatusset.check_invers = true; addeventaction(&(linkstatusset).action, $6, $7); addlinkstatus(current, &linkstatusset); } ; linkspeed : IF CHANGED LINK rate1 THEN action1 recovery_success { addeventaction(&(linkspeedset).action, $6, $7); addlinkspeed(current, &linkspeedset); } linksaturation : IF SATURATION operator NUMBER PERCENT rate1 THEN action1 recovery_success { linksaturationset.operator = $3; linksaturationset.limit = (unsigned long long)$4; addeventaction(&(linksaturationset).action, $8, $9); addlinksaturation(current, &linksaturationset); } ; upload : IF UPLOAD operator NUMBER unit currenttime rate1 THEN action1 recovery_success { bandwidthset.operator = $3; bandwidthset.limit = ((unsigned long long)$4 * $5); bandwidthset.rangecount = 1; bandwidthset.range = $6; addeventaction(&(bandwidthset).action, $9, $10); addbandwidth(&(current->uploadbyteslist), &bandwidthset); } | IF TOTAL UPLOAD operator NUMBER unit totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = ((unsigned long long)$5 * $6); bandwidthset.rangecount = 1; bandwidthset.range = $7; addeventaction(&(bandwidthset).action, $10, $11); addbandwidth(&(current->uploadbyteslist), &bandwidthset); } | IF TOTAL UPLOAD operator NUMBER unit NUMBER totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = ((unsigned long long)$5 * $6); bandwidthset.rangecount = $7; bandwidthset.range = $8; addeventaction(&(bandwidthset).action, $11, $12); addbandwidth(&(current->uploadbyteslist), &bandwidthset); } | IF UPLOAD operator NUMBER PACKET currenttime rate1 THEN action1 recovery_success { bandwidthset.operator = $3; bandwidthset.limit = (unsigned long long)$4; bandwidthset.rangecount = 1; bandwidthset.range = $6; addeventaction(&(bandwidthset).action, $9, $10); addbandwidth(&(current->uploadpacketslist), &bandwidthset); } | IF TOTAL UPLOAD operator NUMBER PACKET totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = (unsigned long long)$5; bandwidthset.rangecount = 1; bandwidthset.range = $7; addeventaction(&(bandwidthset).action, $10, $11); addbandwidth(&(current->uploadpacketslist), &bandwidthset); } | IF TOTAL UPLOAD operator NUMBER PACKET NUMBER totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = (unsigned long long)$5; bandwidthset.rangecount = $7; bandwidthset.range = $8; addeventaction(&(bandwidthset).action, $11, $12); addbandwidth(&(current->uploadpacketslist), &bandwidthset); } ; download : IF DOWNLOAD operator NUMBER unit currenttime rate1 THEN action1 recovery_success { bandwidthset.operator = $3; bandwidthset.limit = ((unsigned long long)$4 * $5); bandwidthset.rangecount = 1; bandwidthset.range = $6; addeventaction(&(bandwidthset).action, $9, $10); addbandwidth(&(current->downloadbyteslist), &bandwidthset); } | IF TOTAL DOWNLOAD operator NUMBER unit totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = ((unsigned long long)$5 * $6); bandwidthset.rangecount = 1; bandwidthset.range = $7; addeventaction(&(bandwidthset).action, $10, $11); addbandwidth(&(current->downloadbyteslist), &bandwidthset); } | IF TOTAL DOWNLOAD operator NUMBER unit NUMBER totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = ((unsigned long long)$5 * $6); bandwidthset.rangecount = $7; bandwidthset.range = $8; addeventaction(&(bandwidthset).action, $11, $12); addbandwidth(&(current->downloadbyteslist), &bandwidthset); } | IF DOWNLOAD operator NUMBER PACKET currenttime rate1 THEN action1 recovery_success { bandwidthset.operator = $3; bandwidthset.limit = (unsigned long long)$4; bandwidthset.rangecount = 1; bandwidthset.range = $6; addeventaction(&(bandwidthset).action, $9, $10); addbandwidth(&(current->downloadpacketslist), &bandwidthset); } | IF TOTAL DOWNLOAD operator NUMBER PACKET totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = (unsigned long long)$5; bandwidthset.rangecount = 1; bandwidthset.range = $7; addeventaction(&(bandwidthset).action, $10, $11); addbandwidth(&(current->downloadpacketslist), &bandwidthset); } | IF TOTAL DOWNLOAD operator NUMBER PACKET NUMBER totaltime rate1 THEN action1 recovery_success { bandwidthset.operator = $4; bandwidthset.limit = (unsigned long long)$5; bandwidthset.rangecount = $7; bandwidthset.range = $8; addeventaction(&(bandwidthset).action, $11, $12); addbandwidth(&(current->downloadpacketslist), &bandwidthset); } ; icmptype : TYPE ICMPECHO { $$ = ICMP_ECHO; } ; reminder : /* EMPTY */ { mailset.reminder = 0; } | REMINDER NUMBER { mailset.reminder = $2; } | REMINDER NUMBER CYCLE { mailset.reminder = $2; } ; %% /* -------------------------------------------------------- Parser interface */ /** * Syntactic error routine * * This routine is automatically called by the lexer! */ void yyerror(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_error("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext); cfg_errflag++; FREE(msg); } /** * Syntactical warning routine */ void yywarning(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_warning("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext); FREE(msg); } /** * Argument error routine */ void yyerror2(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_error("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext); cfg_errflag++; FREE(msg); } /** * Argument warning routine */ void yywarning2(const char *s, ...) { assert(s); char *msg = NULL; va_list ap; va_start(ap, s); msg = Str_vcat(s, ap); va_end(ap); Log_warning("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext); FREE(msg); } /* * The Parser hook - start parsing the control file * Returns true if parsing succeeded, otherwise false */ bool parse(char *controlfile) { assert(controlfile); if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) { Log_error("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR); return false; } currentfile = Str_dup(controlfile); available_statistics(&System_Info); /* * Creation of the global service list is synchronized */ LOCK(Run.mutex) { preparse(); yyparse(); fclose(yyin); postparse(); } END_LOCK; FREE(currentfile); if (argyytext != NULL) FREE(argyytext); /* * Secure check the monitrc file. The run control file must have the * same uid as the REAL uid of this process, it must have permissions * no greater than 700 and it must not be a symbolic link. */ if (! file_checkStat(controlfile, "control file", S_IRUSR|S_IWUSR|S_IXUSR)) return false; return cfg_errflag == 0; } /* ----------------------------------------------------------------- Private */ /** * Initialize objects used by the parser. */ static void preparse(void) { Service_List = tail = current = NULL; /* Set instance incarnation ID */ time(&Run.incarnation); /* Reset lexer */ buffer_stack_ptr = 0; lineno = 1; arglineno = 1; argcurrentfile = NULL; argyytext = NULL; /* Reset parser */ Run.limits.sendExpectBuffer = LIMIT_SENDEXPECTBUFFER; Run.limits.fileContentBuffer = LIMIT_FILECONTENTBUFFER; Run.limits.httpContentBuffer = LIMIT_HTTPCONTENTBUFFER; Run.limits.programOutput = LIMIT_PROGRAMOUTPUT; Run.limits.networkTimeout = LIMIT_NETWORKTIMEOUT; Run.limits.programTimeout = LIMIT_PROGRAMTIMEOUT; Run.limits.stopTimeout = LIMIT_STOPTIMEOUT; Run.limits.startTimeout = LIMIT_STARTTIMEOUT; Run.limits.restartTimeout = LIMIT_RESTARTTIMEOUT; Run.limits.execTimeout = LIMIT_EXECTIMEOUT; Run.onreboot = Onreboot_Start; Run.mmonitcredentials = NULL; Run.httpd.flags = Httpd_Disabled | Httpd_Signature; Run.httpd.credentials = NULL; memset(&(Run.httpd.socket), 0, sizeof(Run.httpd.socket)); Run.mailserver_timeout = SMTP_TIMEOUT; Run.eventlist_dir = NULL; Run.eventlist_slots = -1; Run.system = NULL; Run.mmonits = NULL; Run.maillist = NULL; Run.mailservers = NULL; Run.MailFormat.from = NULL; Run.MailFormat.replyto = NULL; Run.MailFormat.subject = NULL; Run.MailFormat.message = NULL; depend_list = NULL; Run.flags |= Run_HandlerInit | Run_MmonitCredentials; for (int i = 0; i <= Handler_Max; i++) Run.handler_queue[i] = 0; /* * Initialize objects */ reset_uidset(); reset_gidset(); reset_statusset(); reset_sizeset(); reset_nlinkset(); reset_mailset(); reset_sslset(); reset_mailserverset(); reset_mmonitset(); reset_responsetimeset(); reset_portset(); reset_permset(); reset_icmpset(); reset_linkstatusset(); reset_linkspeedset(); reset_linksaturationset(); reset_bandwidthset(); reset_rateset(&rate); reset_rateset(&rate1); reset_rateset(&rate2); reset_filesystemset(); reset_resourceset(); reset_checksumset(); reset_timestampset(); reset_actionrateset(); } /* * Check that values are reasonable after parsing */ static void postparse(void) { if (cfg_errflag) return; /* If defined - add the last service to the service list */ if (current) { addservice(current); current = NULL; } /* Check that we do not start monit in daemon mode without having a poll time */ if (Run.polltime <= 0 && ((Run.flags & Run_Daemon) || (Run.flags & Run_Foreground))) { Log_error("Poll time is invalid or not defined. Please define poll time in the control file\nas a number (> 0) or use the -d option when starting monit\n"); cfg_errflag++; } if (Run.files.log) Run.flags |= Run_Log; /* Add the default general system service if not specified explicitly: service name default to hostname */ if (! Run.system) { char hostname[STRLEN]; if (gethostname(hostname, sizeof(hostname))) { Log_error("Cannot get system hostname -- please add 'check system '\n"); cfg_errflag++; } if (Util_existService(hostname)) { Log_error("'check system' not defined in control file, failed to add automatic configuration (service name %s is used already) -- please add 'check system ' manually\n", hostname); cfg_errflag++; } Run.system = createservice(Service_System, Str_dup(hostname), NULL, check_system); addservice(Run.system); } addeventaction(&(Run.system->action_MONIT_START), Action_Start, Action_Ignored); addeventaction(&(Run.system->action_MONIT_STOP), Action_Stop, Action_Ignored); if (Run.mmonits) { if (Run.httpd.flags & Httpd_Net) { if (Run.flags & Run_MmonitCredentials) { Auth_T c; for (c = Run.httpd.credentials; c; c = c->next) { if (c->digesttype == Digest_Cleartext && ! c->is_readonly) { Run.mmonitcredentials = c; break; } } if (! Run.mmonitcredentials) Log_warning("M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n"); } } else if (Run.httpd.flags & Httpd_Unix) { Log_warning("M/Monit enabled but Monit httpd is using unix socket -- please change 'set httpd' statement to use TCP port in order to be able to manage services on Monit\n"); } else { Log_warning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n"); } } /* Check the sanity of any dependency graph */ check_depend(); #if defined HAVE_OPENSSL && defined OPENSSL_FIPS Ssl_setFipsMode(Run.flags & Run_FipsEnabled); #endif Processor_setHttpPostLimit(); } static bool _parseOutgoingAddress(char *ip, Outgoing_T *outgoing) { struct addrinfo *result, hints = {.ai_flags = AI_NUMERICHOST}; int status = getaddrinfo(ip, NULL, &hints, &result); if (status == 0) { outgoing->ip = ip; outgoing->addrlen = result->ai_addrlen; memcpy(&(outgoing->addr), result->ai_addr, result->ai_addrlen); freeaddrinfo(result); return true; } else { yyerror2("IP address parsing failed for %s -- %s", ip, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); } return false; } /* * Create a new service object and add any current objects to the * service list. */ static Service_T createservice(Service_Type type, char *name, char *value, State_Type (*check)(Service_T s)) { assert(name); check_name(name); if (current) addservice(current); NEW(current); current->type = type; switch (type) { case Service_Directory: NEW(current->inf.directory); break; case Service_Fifo: NEW(current->inf.fifo); break; case Service_File: NEW(current->inf.file); break; case Service_Filesystem: NEW(current->inf.filesystem); break; case Service_Net: NEW(current->inf.net); break; case Service_Process: NEW(current->inf.process); break; default: break; } Util_resetInfo(current); if (type == Service_Program) { NEW(current->program); current->program->args = command; command = NULL; current->program->timeout = Run.limits.programTimeout; } /* Set default values */ current->onrebootRestored = false; current->mode = Monitor_Active; current->monitor = Monitor_Init; current->onreboot = Run.onreboot; current->name = name; current->name_urlescaped = Util_urlEncode(name, false); current->name_htmlescaped = escapeHTML(StringBuffer_create(16), name); current->check = check; current->path = value; /* Initialize general event handlers */ addeventaction(&(current)->action_DATA, Action_Alert, Action_Alert); addeventaction(&(current)->action_EXEC, Action_Alert, Action_Alert); addeventaction(&(current)->action_INVALID, Action_Restart, Action_Alert); /* Initialize internal event handlers */ addeventaction(&(current)->action_ACTION, Action_Alert, Action_Ignored); gettimeofday(¤t->collected, NULL); return current; } /* * Add a service object to the Service_List */ static void addservice(Service_T s) { assert(s); // Test sanity check switch (s->type) { case Service_Host: // Verify that a remote service has a port or an icmp list if (! s->portlist && ! s->icmplist) { Log_error("'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", s->name); cfg_errflag++; } break; case Service_Program: // Verify that a program test has a status test if (! s->statuslist && ! s->matchlist && ! s->outputchangelist) { Log_error("'check program %s' is incomplete: Please add a 'status' or 'content' test\n", s->name); cfg_errflag++; } char program[PATH_MAX]; strncpy(program, s->program->args->arg[0], sizeof(program) - 1); // Require that the program exist before creating the Command object if (File_isExecutable(program)) { s->program->C = Command_new(program, NULL); for (int i = 1; i < s->program->args->length; i++) { Command_appendArgument(s->program->C, s->program->args->arg[i]); snprintf(program + strlen(program), sizeof(program) - strlen(program) - 1, " %s", s->program->args->arg[i]); } s->path = Str_dup(program); if (s->program->args->has_uid) Command_setUid(s->program->C, s->program->args->uid); if (s->program->args->has_gid) Command_setGid(s->program->C, s->program->args->gid); // Set environment Command_setEnv(s->program->C, "MONIT_SERVICE", s->name); } else { Log_error("A 'check program' statement requires the program to exist '%s'\n", program); cfg_errflag++; } break; case Service_Net: if (! s->linkstatuslist) { // Add link status test if not defined addeventaction(&(linkstatusset).action, Action_Alert, Action_Alert); addlinkstatus(s, &linkstatusset); } break; case Service_Filesystem: if (! s->nonexistlist && ! s->existlist) { // Add non-existence test if not defined addeventaction(&(nonexistset).action, Action_Restart, Action_Alert); addnonexist(&nonexistset); } if (! s->fsflaglist) { // Add filesystem flags change test if not defined addeventaction(&(fsflagset).action, Action_Alert, Action_Ignored); addfsflag(&fsflagset); } break; case Service_Directory: case Service_Fifo: case Service_File: case Service_Process: if (! s->nonexistlist && ! s->existlist) { // Add existence test if not defined addeventaction(&(nonexistset).action, Action_Restart, Action_Alert); addnonexist(&nonexistset); } break; default: break; } // No "every" statement was used, monitor each cycle if (s->every.type == Every_Initializing) s->every.type = Every_Cycle; /* Add the service to the end of the service list */ if (tail != NULL) { tail->next = s; tail->next_conf = s; } else { Service_List = s; Service_List_Conf = s; } tail = s; } /* * Add entry to service group list */ static void addservicegroup(char *name) { ServiceGroup_T g; assert(name); /* Check if service group with the same name is defined already */ for (g = Service_Group_List; g; g = g->next) if (IS(g->name, name)) break; if (! g) { NEW(g); g->name = Str_dup(name); g->members = List_new(); g->next = Service_Group_List; Service_Group_List = g; } List_append(g->members, current); } /* * Add entry to M/Monit hostgroup membership list */ static void addhostgroup(char *name) { if (! mmonitset.hostgroups) mmonitset.hostgroups = List_new(); List_append(mmonitset.hostgroups, name); } /* * Add a dependant entry to the current service dependant list */ static void adddependant(char *dependant) { Dependant_T d; assert(dependant); NEW(d); if (current->dependantlist) d->next = current->dependantlist; d->dependant = dependant; d->dependant_urlescaped = Util_urlEncode(dependant, false); d->dependant_htmlescaped = escapeHTML(StringBuffer_create(16), dependant); current->dependantlist = d; } /* * Add the given mailaddress with the appropriate alert notification * values and mail attributes to the given mailinglist. */ static void addmail(char *mailto, Mail_T f, Mail_T *l) { Mail_T m; assert(mailto); NEW(m); m->to = mailto; m->from = f->from; m->replyto = f->replyto; m->subject = f->subject; m->message = f->message; m->events = f->events; m->reminder = f->reminder; m->next = *l; *l = m; reset_mailset(); } /* * Add the given portset to the current service's portlist */ static void addport(Port_T *list, Port_T port) { assert(port); if (port->protocol->check == check_radius && port->type != Socket_Udp) yyerror("Radius protocol test supports UDP only"); Port_T p; NEW(p); p->is_available = Connection_Init; p->check_invers = port->check_invers; p->type = port->type; p->socket = port->socket; p->family = port->family; p->action = port->action; p->timeout = port->timeout; p->retry = port->retry; p->protocol = port->protocol; p->hostname = port->hostname; p->url_request = port->url_request; p->outgoing = port->outgoing; if (p->family == Socket_Unix) { p->target.unix.pathname = port->target.unix.pathname; } else { p->target.net.port = port->target.net.port; if (sslset.flags) { #ifdef HAVE_OPENSSL p->target.net.ssl.certificate.minimumDays = port->target.net.ssl.certificate.minimumDays; if (sslset.flags && (p->target.net.port == 25 || p->target.net.port == 143 || p->target.net.port == 587)) sslset.flags = SSL_StartTLS; _setSSLOptions(&(p->target.net.ssl.options)); #else yyerror("SSL check cannot be activated -- Monit was not built with SSL support"); #endif } } memcpy(&p->parameters, &port->parameters, sizeof(port->parameters)); if (p->protocol->check == check_http) { if (p->parameters.http.checksum) { cleanup_hash_string(p->parameters.http.checksum); if (strlen(p->parameters.http.checksum) == 32) p->parameters.http.hashtype = Hash_Md5; else if (strlen(p->parameters.http.checksum) == 40) p->parameters.http.hashtype = Hash_Sha1; else yyerror2("invalid checksum [%s]", p->parameters.http.checksum); } else { p->parameters.http.hashtype = Hash_Unknown; } if (! p->parameters.http.method) { p->parameters.http.method = Http_Get; } else if (p->parameters.http.method == Http_Head) { // Sanity check: if content or checksum test is used, the method Http_Head is not allowed, as we need the content if ((p->url_request && p->url_request->regex) || p->parameters.http.checksum) { yyerror2("if response content or checksum test is enabled, the HEAD method is not allowed"); } } } else if (p->protocol->check == check_mysql) { if (p->parameters.mysql.rsaChecksum) { if (! p->parameters.mysql.username) yyerror2("the rsakey checksum test requires credentials to be defined"); if (p->target.net.ssl.options.flags != SSL_Disabled) yyerror2("the rsakey checksum test can be used just with unsecured mysql protocol"); } } p->responsetime.limit = responsetimeset.limit; p->responsetime.current = responsetimeset.current; p->responsetime.operator = responsetimeset.operator; p->next = *list; *list = p; reset_sslset(); reset_responsetimeset(); reset_portset(); } static void addhttpheader(Port_T port, char *header) { if (! port->parameters.http.headers) { port->parameters.http.headers = List_new(); } if (Str_startsWith(header, "Connection:") && ! Str_sub(header, "close")) { yywarning("We don't recommend setting the Connection header. Monit will always close the connection even if 'keep-alive' is set\n"); } List_append(port->parameters.http.headers, header); } /* * Add a new resource object to the current service resource list */ static void addresource(Resource_T rr) { assert(rr); if (Run.flags & Run_ProcessEngineEnabled) { Resource_T r; NEW(r); r->resource_id = rr->resource_id; r->limit = rr->limit; r->action = rr->action; r->operator = rr->operator; r->next = current->resourcelist; current->resourcelist = r; } else { yywarning("Cannot activate service check. The process status engine was disabled. On certain systems you must run monit as root to utilize this feature)\n"); } reset_resourceset(); } /* * Add a new file object to the current service timestamp list */ static void addtimestamp(Timestamp_T ts) { assert(ts); Timestamp_T t; NEW(t); t->type = ts->type; t->operator = ts->operator; t->time = ts->time; t->action = ts->action; t->test_changes = ts->test_changes; t->next = current->timestamplist; current->timestamplist = t; reset_timestampset(); } /* * Add a new object to the current service actionrate list */ static void addactionrate(ActionRate_T ar) { ActionRate_T a; assert(ar); if (ar->count > ar->cycle) yyerror2("The number of restarts must be less than poll cycles"); if (ar->count <= 0 || ar->cycle <= 0) yyerror2("Zero or negative values not allowed in a action rate statement"); NEW(a); a->count = ar->count; a->cycle = ar->cycle; a->action = ar->action; a->next = current->actionratelist; current->actionratelist = a; reset_actionrateset(); } /* * Add a new Size object to the current service size list */ static void addsize(Size_T ss) { Size_T s; struct stat buf; assert(ss); NEW(s); s->operator = ss->operator; s->size = ss->size; s->action = ss->action; s->test_changes = ss->test_changes; /* Get the initial size for future comparison, if the file exists */ if (s->test_changes) { s->initialized = ! stat(current->path, &buf); if (s->initialized) s->size = (unsigned long long)buf.st_size; } s->next = current->sizelist; current->sizelist = s; reset_sizeset(); } /* * Add a new NLink object to the current service nlink list */ static void addnlink(NLink_T ss) { NLink_T s; struct stat buf; assert(ss); NEW(s); s->operator = ss->operator; s->nlink = ss->nlink; s->action = ss->action; s->test_changes = ss->test_changes; /* Get the initial size for future comparison */ if (s->test_changes) { s->initialized = ! stat(current->path, &buf); if (s->initialized) s->nlink = (unsigned long long)buf.st_nlink; } s->next = current->nlinklist; current->nlinklist = s; reset_nlinkset(); } /* * Add a new Uptime object to the current service uptime list */ static void adduptime(Uptime_T uu) { Uptime_T u; assert(uu); NEW(u); u->operator = uu->operator; u->uptime = uu->uptime; u->action = uu->action; u->next = current->uptimelist; current->uptimelist = u; reset_uptimeset(); } /* * Add a new Pid object to the current service pid list */ static void addpid(Pid_T pp) { assert(pp); Pid_T p; NEW(p); p->action = pp->action; p->next = current->pidlist; current->pidlist = p; reset_pidset(); } /* * Add a new PPid object to the current service ppid list */ static void addppid(Pid_T pp) { assert(pp); Pid_T p; NEW(p); p->action = pp->action; p->next = current->ppidlist; current->ppidlist = p; reset_ppidset(); } /* * Add a new Fsflag object to the current service fsflag list */ static void addfsflag(FsFlag_T ff) { assert(ff); FsFlag_T f; NEW(f); f->action = ff->action; f->next = current->fsflaglist; current->fsflaglist = f; reset_fsflagset(); } /* * Add a new Nonexist object to the current service list */ static void addnonexist(NonExist_T ff) { assert(ff); NonExist_T f; NEW(f); f->action = ff->action; f->next = current->nonexistlist; current->nonexistlist = f; reset_nonexistset(); } static void addexist(Exist_T rule) { assert(rule); Exist_T r; NEW(r); r->action = rule->action; r->next = current->existlist; current->existlist = r; reset_existset(); } /* * Set Checksum object in the current service */ static void addchecksum(Checksum_T cs) { assert(cs); cs->initialized = true; if (STR_UNDEF(cs->hash)) { if (cs->type == Hash_Unknown) cs->type = Hash_Default; if (! (Checksum_getChecksum(current->path, cs->type, cs->hash, sizeof(cs->hash)))) { /* If the file doesn't exist, set dummy value */ snprintf(cs->hash, sizeof(cs->hash), cs->type == Hash_Md5 ? "00000000000000000000000000000000" : "0000000000000000000000000000000000000000"); cs->initialized = false; yywarning2("Cannot compute a checksum for file %s", current->path); } } int len = cleanup_hash_string(cs->hash); if (cs->type == Hash_Unknown) { if (len == 32) { cs->type = Hash_Md5; } else if (len == 40) { cs->type = Hash_Sha1; } else { yyerror2("Unknown checksum type [%s] for file %s", cs->hash, current->path); reset_checksumset(); return; } } else if ((cs->type == Hash_Md5 && len != 32) || (cs->type == Hash_Sha1 && len != 40)) { yyerror2("Invalid checksum [%s] for file %s", cs->hash, current->path); reset_checksumset(); return; } Checksum_T c; NEW(c); c->type = cs->type; c->test_changes = cs->test_changes; c->initialized = cs->initialized; c->action = cs->action; snprintf(c->hash, sizeof(c->hash), "%s", cs->hash); current->checksum = c; reset_checksumset(); } /* * Set Perm object in the current service */ static void addperm(Perm_T ps) { assert(ps); Perm_T p; NEW(p); p->action = ps->action; p->test_changes = ps->test_changes; if (p->test_changes) { if (! File_exist(current->path)) DEBUG("The path '%s' used in the PERMISSION statement refer to a non-existing object\n", current->path); else if ((p->perm = File_mod(current->path)) < 0) yyerror2("Cannot get the timestamp for '%s'", current->path); else p->perm &= 07777; } else { p->perm = ps->perm; } current->perm = p; reset_permset(); } static void addlinkstatus(Service_T s, LinkStatus_T L) { assert(L); LinkStatus_T l; // Sanity check: we don't support link up/down tests mix for (l = s->linkstatuslist; l; l = l->next) { if (l->check_invers != L->check_invers) yyerror2("Mixing link up and down tests is not supported"); } if (L->check_invers) s->inverseStatus = true; NEW(l); l->check_invers = L->check_invers; l->action = L->action; l->next = s->linkstatuslist; s->linkstatuslist = l; reset_linkstatusset(); } static void addlinkspeed(Service_T s, LinkSpeed_T L) { assert(L); LinkSpeed_T l; NEW(l); l->action = L->action; l->next = s->linkspeedlist; s->linkspeedlist = l; reset_linkspeedset(); } static void addlinksaturation(Service_T s, LinkSaturation_T L) { assert(L); LinkSaturation_T l; NEW(l); l->operator = L->operator; l->limit = L->limit; l->action = L->action; l->next = s->linksaturationlist; s->linksaturationlist = l; reset_linksaturationset(); } /* * Return Bandwidth object */ static void addbandwidth(Bandwidth_T *list, Bandwidth_T b) { assert(list); assert(b); if (b->rangecount * b->range > 24 * Time_Hour) { yyerror2("Maximum range for total test is 24 hours"); } else if (b->range == Time_Minute && b->rangecount > 60) { yyerror2("Maximum value for [minute(s)] unit is 60"); } else if (b->range == Time_Hour && b->rangecount > 24) { yyerror2("Maximum value for [hour(s)] unit is 24"); } else if (b->range == Time_Day && b->rangecount > 1) { yyerror2("Maximum value for [day(s)] unit is 1"); } else { if (b->range == Time_Day) { // translate last day -> last 24 hours b->rangecount = 24; b->range = Time_Hour; } Bandwidth_T bandwidth; NEW(bandwidth); bandwidth->operator = b->operator; bandwidth->limit = b->limit; bandwidth->rangecount = b->rangecount; bandwidth->range = b->range; bandwidth->action = b->action; bandwidth->next = *list; *list = bandwidth; } reset_bandwidthset(); } static void appendmatch(Match_T *list, Match_T item) { if (*list) { /* Find the end of the list (keep the same patterns order as in the config file) */ Match_T last; for (last = *list; last->next; last = last->next) ; last->next = item; } else { *list = item; } } /* * Set Match object in the current service */ static void addmatch(Match_T ms, int actionnumber, int linenumber) { Match_T m; assert(ms); NEW(m); NEW(m->regex_comp); m->match_string = ms->match_string; m->match_path = ms->match_path ? Str_dup(ms->match_path) : NULL; m->action = ms->action; m->not = ms->not; m->ignore = ms->ignore; m->next = NULL; addeventaction(&(m->action), actionnumber, Action_Ignored); int reg_return = regcomp(m->regex_comp, ms->match_string, REG_NOSUB|REG_EXTENDED); if (reg_return != 0) { char errbuf[STRLEN]; regerror(reg_return, ms->regex_comp, errbuf, STRLEN); if (m->match_path != NULL) yyerror2("Regex '%s' parsing error: %s on line %i of", ms->match_string, errbuf, linenumber); else yyerror("Regex '%s' parsing error: %s", ms->match_string, errbuf); } appendmatch(m->ignore ? ¤t->matchignorelist : ¤t->matchlist, m); } static void addmatchpath(Match_T ms, Action_Type actionnumber) { assert(ms->match_path); FILE *handle = fopen(ms->match_path, "r"); if (handle == NULL) { yyerror2("Cannot read regex match file (%s)", ms->match_path); return; } // The addeventaction() called from addmatch() will reset the command1 to NULL, but we need to duplicate the command for each line, thus need to save it here command_t savecommand = command1; for (int linenumber = 1; ! feof(handle); linenumber++) { char buf[2048]; if (! fgets(buf, sizeof(buf), handle)) continue; size_t len = strlen(buf); if (len == 0 || buf[0] == '\n') continue; if (buf[len - 1] == '\n') buf[len - 1] = 0; ms->match_string = Str_dup(buf); if (actionnumber == Action_Exec) { if (command1 == NULL) { assert(savecommand); command1 = copycommand(savecommand); } } addmatch(ms, actionnumber, linenumber); } if (actionnumber == Action_Exec && savecommand) gccmd(&savecommand); fclose(handle); } /* * Set output change object in the current service */ static void addoutputchange(bool check_invers, Action_Type failed, Action_Type succeeded) { OutputChange_T outputchange; NEW(outputchange); addeventaction(&(outputchange->action), failed, succeeded); outputchange->previous = NULL; outputchange->check_invers = check_invers; outputchange->next = current->outputchangelist; current->outputchangelist = outputchange; } /* * Set exit status test object in the current service */ static void addstatus(Status_T status) { Status_T s; assert(status); NEW(s); s->initialized = status->initialized; s->return_value = status->return_value; s->operator = status->operator; s->action = status->action; s->next = current->statuslist; current->statuslist = s; reset_statusset(); } /* * Set Uid object in the current service */ static Uid_T adduid(Uid_T u) { assert(u); Uid_T uid; NEW(uid); uid->uid = u->uid; uid->action = u->action; reset_uidset(); return uid; } /* * Set Gid object in the current service */ static Gid_T addgid(Gid_T g) { assert(g); Gid_T gid; NEW(gid); gid->gid = g->gid; gid->action = g->action; reset_gidset(); return gid; } /* * Add a new filesystem to the current service's filesystem list */ static void addfilesystem(FileSystem_T ds) { FileSystem_T dev; assert(ds); NEW(dev); dev->resource = ds->resource; dev->operator = ds->operator; dev->limit_absolute = ds->limit_absolute; dev->limit_percent = ds->limit_percent; dev->action = ds->action; dev->next = current->filesystemlist; current->filesystemlist = dev; reset_filesystemset(); } /* * Add a new icmp object to the current service's icmp list */ static void addicmp(Icmp_T is) { Icmp_T icmp; assert(is); NEW(icmp); icmp->family = is->family; icmp->type = is->type; icmp->size = is->size; icmp->count = is->count; icmp->timeout = is->timeout; icmp->action = is->action; icmp->outgoing = is->outgoing; icmp->check_invers = is->check_invers; icmp->is_available = Connection_Init; icmp->responsetime.limit = responsetimeset.limit; icmp->responsetime.current = responsetimeset.current; icmp->responsetime.operator = responsetimeset.operator; icmp->next = current->icmplist; current->icmplist = icmp; reset_responsetimeset(); reset_icmpset(); } /* * Set EventAction object */ static void addeventaction(EventAction_T *_ea, Action_Type failed, Action_Type succeeded) { EventAction_T ea; assert(_ea); NEW(ea); NEW(ea->failed); NEW(ea->succeeded); ea->failed->id = failed; ea->failed->repeat = repeat1; ea->failed->count = rate1.count; ea->failed->cycles = rate1.cycles; if (failed == Action_Exec) { assert(command1); ea->failed->exec = command1; command1 = NULL; } ea->succeeded->id = succeeded; ea->succeeded->repeat = repeat2; ea->succeeded->count = rate2.count; ea->succeeded->cycles = rate2.cycles; if (succeeded == Action_Exec) { assert(command2); ea->succeeded->exec = command2; command2 = NULL; } *_ea = ea; reset_rateset(&rate); reset_rateset(&rate1); reset_rateset(&rate2); repeat = repeat1 = repeat2 = 0; } /* * Add a generic protocol handler to */ static void addgeneric(Port_T port, char *send, char *expect) { Generic_T g = port->parameters.generic.sendexpect; if (! g) { NEW(g); port->parameters.generic.sendexpect = g; } else { while (g->next) g = g->next; NEW(g->next); g = g->next; } if (send) { g->send = send; g->expect = NULL; } else if (expect) { int reg_return; NEW(g->expect); reg_return = regcomp(g->expect, expect, REG_NOSUB|REG_EXTENDED); FREE(expect); if (reg_return != 0) { char errbuf[STRLEN]; regerror(reg_return, g->expect, errbuf, STRLEN); yyerror2("Regex parsing error: %s", errbuf); } g->send = NULL; } } /* * Add the current command object to the current service object's * start or stop program. */ static void addcommand(int what, unsigned int cmdtimeout) { switch (what) { case START: current->start = command; break; case STOP: current->stop = command; break; case RESTART: current->restart = command; break; } command->timeout = cmdtimeout; command = NULL; } /* * Add a new argument to the argument list */ static void addargument(char *argument) { assert(argument); if (! command) { check_exec(argument); NEW(command); } if (command->length + 1 >= ARGMAX) { yyerror("Exceeded maximum number of program arguments"); FREE(argument); } else { command->arg[command->length++] = argument; command->arg[command->length] = NULL; } } /* * Setup a url request for the current port object */ static void prepare_urlrequest(URL_T U) { assert(U); /* Only the HTTP protocol is supported for URLs currently. See also the lexer if this is to be changed in the future */ portset.protocol = Protocol_get(Protocol_HTTP); if (urlrequest == NULL) NEW(urlrequest); urlrequest->url = U; portset.hostname = Str_dup(U->hostname); portset.target.net.port = U->port; portset.url_request = urlrequest; portset.type = Socket_Tcp; portset.parameters.http.request = Str_cat("%s%s%s", U->path, U->query ? "?" : "", U->query ? U->query : ""); if (IS(U->protocol, "https")) sslset.flags = SSL_Enabled; } /* * Set the url request for a port */ static void seturlrequest(int operator, char *regex) { assert(regex); if (! urlrequest) NEW(urlrequest); urlrequest->operator = operator; int reg_return; NEW(urlrequest->regex); reg_return = regcomp(urlrequest->regex, regex, REG_NOSUB|REG_EXTENDED); if (reg_return != 0) { char errbuf[STRLEN]; regerror(reg_return, urlrequest->regex, errbuf, STRLEN); yyerror2("Regex parsing error: %s", errbuf); } } /* * Add a new data recipient server to the mmonit server list */ static void addmmonit(Mmonit_T mmonit) { assert(mmonit->url); Mmonit_T c; NEW(c); c->url = mmonit->url; c->compress = MmonitCompress_Init; _setSSLOptions(&(c->ssl)); if (IS(c->url->protocol, "https")) { #ifdef HAVE_OPENSSL c->ssl.flags = SSL_Enabled; #else yyerror("SSL check cannot be activated -- SSL disabled"); #endif } c->timeout = mmonit->timeout; c->hostgroups = mmonit->hostgroups; c->next = NULL; if (Run.mmonits) { Mmonit_T C; for (C = Run.mmonits; C->next; C = C->next) /* Empty */ ; C->next = c; } else { Run.mmonits = c; } reset_sslset(); reset_mmonitset(); } /* * Add a new smtp server to the mail server list */ static void addmailserver(MailServer_T mailserver) { MailServer_T s; assert(mailserver->host); NEW(s); s->host = mailserver->host; s->port = mailserver->port; s->username = mailserver->username; s->password = mailserver->password; if (sslset.flags && (mailserver->port == 25 || mailserver->port == 587)) sslset.flags = SSL_StartTLS; _setSSLOptions(&(s->ssl)); s->next = NULL; if (Run.mailservers) { MailServer_T l; for (l = Run.mailservers; l->next; l = l->next) /* empty */; l->next = s; } else { Run.mailservers = s; } reset_mailserverset(); } /* * Return uid if found on the system. If the parameter user is NULL * the uid parameter is used for looking up the user id on the system, * otherwise the user parameter is used. */ static uid_t get_uid(char *user, uid_t uid) { char buf[4096]; struct passwd pwd, *result = NULL; if (user) { if (getpwnam_r(user, &pwd, buf, sizeof(buf), &result) != 0 || ! result) { yyerror2("Requested user not found on the system"); return(0); } } else { if (getpwuid_r(uid, &pwd, buf, sizeof(buf), &result) != 0 || ! result) { yyerror2("Requested uid not found on the system"); return(0); } } return(pwd.pw_uid); } /* * Return gid if found on the system. If the parameter group is NULL * the gid parameter is used for looking up the group id on the system, * otherwise the group parameter is used. */ static gid_t get_gid(char *group, gid_t gid) { struct group *grd; if (group) { grd = getgrnam(group); if (! grd) { yyerror2("Requested group not found on the system"); return(0); } } else { if (! (grd = getgrgid(gid))) { yyerror2("Requested gid not found on the system"); return(0); } } return(grd->gr_gid); } /* * Add a new user id to the current command object. */ static void addeuid(uid_t uid) { if (! getuid()) { command->has_uid = true; command->uid = uid; } else { yyerror("UID statement requires root privileges"); } } /* * Add a new group id to the current command object. */ static void addegid(gid_t gid) { if (! getuid()) { command->has_gid = true; command->gid = gid; } else { yyerror("GID statement requires root privileges"); } } /* * Reset the logfile if changed */ static void setlogfile(char *logfile) { if (Run.files.log) { if (IS(Run.files.log, logfile)) { FREE(logfile); return; } else { FREE(Run.files.log); } } Run.files.log = logfile; } /* * Reset the pidfile if changed */ static void setpidfile(char *pidfile) { if (Run.files.pid) { if (IS(Run.files.pid, pidfile)) { FREE(pidfile); return; } else { FREE(Run.files.pid); } } Run.files.pid = pidfile; } /* * Reset the idfile if changed */ static void setidfile(char *idfile) { if (Run.files.id) { if (IS(Run.files.id, idfile)) { FREE(idfile); return; } else { FREE(Run.files.id); } } Run.files.id = idfile; } /* * Reset the statefile if changed */ static void setstatefile(char *statefile) { if (Run.files.state) { if (IS(Run.files.state, statefile)) { FREE(statefile); return; } else { FREE(Run.files.state); } } Run.files.state = statefile; } /* * Read a apache htpasswd file and add credentials found for username */ static void addhtpasswdentry(char *filename, char *username, Digest_Type dtype) { char *ht_username = NULL; char *ht_passwd = NULL; char buf[STRLEN]; FILE *handle = NULL; int credentials_added = 0; char realpath[PATH_MAX] = {}; assert(filename); // Check that the htpasswd is a real file and not e.g. a directory if (filename[0] != SEPARATOR_CHAR) { if (! File_realPath(filename, realpath)) { yyerror2("Error getting path for the htpasswd file '%s' -- %s\n", filename, STRERROR); return; } } if (! File_isFile(filename)) { yyerror2("The htpasswd file '%s' is not a file", filename); return; } if (! (handle = fopen(filename, "r"))) { if (username) yyerror2("Cannot read htpasswd (%s) for user %s", filename, username); else yyerror2("Cannot read htpasswd (%s)", filename); return; } while (! feof(handle)) { char *colonindex = NULL; if (! fgets(buf, STRLEN, handle)) continue; Str_rtrim(buf); Str_curtail(buf, "#"); if (NULL == (colonindex = strchr(buf, ':'))) continue; ht_passwd = Str_dup(colonindex+1); *colonindex = '\0'; /* In case we have a file in /etc/passwd or /etc/shadow style we * want to remove ":.*$" and Crypt and MD5 hashed dont have a colon */ if ((NULL != (colonindex = strchr(ht_passwd, ':'))) && (dtype != Digest_Cleartext)) *colonindex = '\0'; ht_username = Str_dup(buf); if (username == NULL) { if (addcredentials(ht_username, ht_passwd, dtype, false)) credentials_added++; } else if (Str_cmp(username, ht_username) == 0) { if (addcredentials(ht_username, ht_passwd, dtype, false)) credentials_added++; } else { FREE(ht_passwd); FREE(ht_username); } } if (credentials_added == 0) { if (username == NULL) yywarning2("htpasswd file (%s) has no usable credentials", filename); else yywarning2("htpasswd file (%s) has no usable credentials for user %s", filename, username); } fclose(handle); } #ifdef HAVE_LIBPAM static void addpamauth(char* groupname, int readonly) { Auth_T prev = NULL; assert(groupname); if (! Run.httpd.credentials) NEW(Run.httpd.credentials); Auth_T c = Run.httpd.credentials; do { if (c->groupname != NULL && IS(c->groupname, groupname)) { yywarning2("PAM group %s was added already, entry ignored", groupname); FREE(groupname); return; } prev = c; c = c->next; } while (c != NULL); NEW(prev->next); c = prev->next; c->next = NULL; c->uname = NULL; c->passwd = NULL; c->groupname = groupname; c->digesttype = Digest_Pam; c->is_readonly = readonly; DEBUG("Adding PAM group '%s'\n", groupname); return; } #endif /* * Add Basic Authentication credentials */ static bool addcredentials(char *uname, char *passwd, Digest_Type dtype, bool readonly) { Auth_T c; assert(uname); assert(passwd); if (! Run.httpd.credentials) { NEW(Run.httpd.credentials); c = Run.httpd.credentials; } else { if (Util_getUserCredentials(uname) != NULL) { yywarning2("Credentials for user %s were already added, entry ignored", uname); FREE(uname); FREE(passwd); return false; } c = Run.httpd.credentials; while (c->next != NULL) c = c->next; NEW(c->next); c = c->next; } c->next = NULL; c->uname = uname; c->passwd = passwd; c->groupname = NULL; c->digesttype = dtype; c->is_readonly = readonly; DEBUG("Adding credentials for user '%s'\n", uname); return true; } /* * Set the syslog and the facilities to be used */ static void setsyslog(char *facility) { if (! Run.files.log || ihp.logfile) { ihp.logfile = true; setlogfile(Str_dup("syslog")); Run.flags |= Run_UseSyslog; Run.flags |= Run_Log; } if (facility) { if (IS(facility,"log_local0")) Run.facility = LOG_LOCAL0; else if (IS(facility, "log_local1")) Run.facility = LOG_LOCAL1; else if (IS(facility, "log_local2")) Run.facility = LOG_LOCAL2; else if (IS(facility, "log_local3")) Run.facility = LOG_LOCAL3; else if (IS(facility, "log_local4")) Run.facility = LOG_LOCAL4; else if (IS(facility, "log_local5")) Run.facility = LOG_LOCAL5; else if (IS(facility, "log_local6")) Run.facility = LOG_LOCAL6; else if (IS(facility, "log_local7")) Run.facility = LOG_LOCAL7; else if (IS(facility, "log_daemon")) Run.facility = LOG_DAEMON; else if (IS(facility, "log_user")) Run.facility = LOG_USER; else yyerror2("Invalid syslog facility"); } else { Run.facility = LOG_USER; } } /* * Reset the current sslset for reuse */ static void reset_sslset(void) { memset(&sslset, 0, sizeof(struct SslOptions_T)); sslset.version = sslset.verify = sslset.allowSelfSigned = -1; } /* * Reset the current mailset for reuse */ static void reset_mailset(void) { memset(&mailset, 0, sizeof(struct Mail_T)); } /* * Reset the mailserver set to default values */ static void reset_mailserverset(void) { memset(&mailserverset, 0, sizeof(struct MailServer_T)); mailserverset.port = PORT_SMTP; } /* * Reset the mmonit set to default values */ static void reset_mmonitset(void) { memset(&mmonitset, 0, sizeof(struct Mmonit_T)); mmonitset.timeout = Run.limits.networkTimeout; } /* * Reset the Port set to default values */ static void reset_portset(void) { memset(&portset, 0, sizeof(struct Port_T)); portset.check_invers = false; portset.socket = -1; portset.type = Socket_Tcp; portset.family = Socket_Ip; portset.timeout = Run.limits.networkTimeout; portset.retry = 1; portset.protocol = Protocol_get(Protocol_DEFAULT); urlrequest = NULL; } /* * Reset the Proc set to default values */ static void reset_resourceset(void) { resourceset.resource_id = 0; resourceset.limit = 0; resourceset.action = NULL; resourceset.operator = Operator_Equal; } /* * Reset the Timestamp set to default values */ static void reset_timestampset(void) { timestampset.type = Timestamp_Default; timestampset.operator = Operator_Equal; timestampset.time = 0; timestampset.test_changes = false; timestampset.initialized = false; timestampset.action = NULL; } /* * Reset the ActionRate set to default values */ static void reset_actionrateset(void) { actionrateset.count = 0; actionrateset.cycle = 0; actionrateset.action = NULL; } /* * Reset the Size set to default values */ static void reset_sizeset(void) { sizeset.operator = Operator_Equal; sizeset.size = 0; sizeset.test_changes = false; sizeset.action = NULL; } /* * Reset the NLink set to default values */ static void reset_nlinkset(void) { nlinkset.operator = Operator_Equal; nlinkset.nlink = 0; nlinkset.test_changes = false; nlinkset.action = NULL; } /* * Reset the Uptime set to default values */ static void reset_uptimeset(void) { uptimeset.operator = Operator_Equal; uptimeset.uptime = 0; uptimeset.action = NULL; } static void reset_responsetimeset(void) { responsetimeset.operator = Operator_Less; responsetimeset.current = 0.; responsetimeset.limit = -1.; } static void reset_linkstatusset(void) { linkstatusset.check_invers = false; linkstatusset.action = NULL; } static void reset_linkspeedset(void) { linkspeedset.action = NULL; } static void reset_linksaturationset(void) { linksaturationset.limit = 0.; linksaturationset.operator = Operator_Equal; linksaturationset.action = NULL; } /* * Reset the Bandwidth set to default values */ static void reset_bandwidthset(void) { bandwidthset.operator = Operator_Equal; bandwidthset.limit = 0ULL; bandwidthset.action = NULL; } /* * Reset the Pid set to default values */ static void reset_pidset(void) { pidset.action = NULL; } /* * Reset the PPid set to default values */ static void reset_ppidset(void) { ppidset.action = NULL; } /* * Reset the Fsflag set to default values */ static void reset_fsflagset(void) { fsflagset.action = NULL; } /* * Reset the Nonexist set to default values */ static void reset_nonexistset(void) { nonexistset.action = NULL; } static void reset_existset(void) { existset.action = NULL; } /* * Reset the Checksum set to default values */ static void reset_checksumset(void) { checksumset.type = Hash_Unknown; checksumset.test_changes = false; checksumset.action = NULL; *checksumset.hash = 0; } /* * Reset the Perm set to default values */ static void reset_permset(void) { permset.test_changes = false; permset.perm = 0; permset.action = NULL; } /* * Reset the Status set to default values */ static void reset_statusset(void) { statusset.initialized = false; statusset.return_value = 0; statusset.operator = Operator_Equal; statusset.action = NULL; } /* * Reset the Uid set to default values */ static void reset_uidset(void) { uidset.uid = 0; uidset.action = NULL; } /* * Reset the Gid set to default values */ static void reset_gidset(void) { gidset.gid = 0; gidset.action = NULL; } /* * Reset the Filesystem set to default values */ static void reset_filesystemset(void) { filesystemset.resource = 0; filesystemset.operator = Operator_Equal; filesystemset.limit_absolute = -1; filesystemset.limit_percent = -1.; filesystemset.action = NULL; } /* * Reset the ICMP set to default values */ static void reset_icmpset(void) { memset(&icmpset, 0, sizeof(struct Icmp_T)); icmpset.type = ICMP_ECHO; icmpset.size = ICMP_SIZE; icmpset.count = ICMP_ATTEMPT_COUNT; icmpset.timeout = Run.limits.networkTimeout; } /* * Reset the Rate set to default values */ static void reset_rateset(struct rate_t *r) { r->count = 1; r->cycles = 1; } /* ---------------------------------------------------------------- Checkers */ /* * Check for unique service name */ static void check_name(char *name) { assert(name); if (Util_existService(name) || (current && IS(name, current->name))) yyerror2("Service name conflict, %s already defined", name); if (name && *name == '/') yyerror2("Service name '%s' must not start with '/' -- ", name); } /* * Permission statement semantic check */ static int check_perm(int perm) { int result; char *status; char buf[STRLEN]; snprintf(buf, STRLEN, "%d", perm); result = (int)strtol(buf, &status, 8); if (*status != '\0' || result < 0 || result > 07777) yyerror2("Permission statements must have an octal value between 0 and 7777"); return result; } /* * Check the dependency graph for errors * by doing a topological sort, thereby finding any cycles. * Assures that graph is a Directed Acyclic Graph (DAG). */ static void check_depend(void) { Service_T depends_on = NULL; Service_T* dlt = &depend_list; /* the current tail of it */ bool done; /* no unvisited nodes left? */ bool found_some; /* last iteration found anything new ? */ depend_list = NULL; /* depend_list will be the topological sorted Service_List */ do { done = true; found_some = false; for (Service_T s = Service_List; s; s = s->next) { Dependant_T d; if (s->visited) continue; done = false; // still unvisited nodes depends_on = NULL; for (d = s->dependantlist; d; d = d->next) { Service_T dp = Util_getService(d->dependant); if (! dp) { Log_error("Depending service '%s' is not defined in the control file\n", d->dependant); exit(1); } if (! dp->visited) { depends_on = dp; } } if (! depends_on) { s->visited = true; found_some = true; *dlt = s; dlt = &s->next_depend; } } } while (found_some && ! done); if (! done) { assert(depends_on); Log_error("Found a depend loop in the control file involving the service '%s'\n", depends_on->name); exit(1); } assert(depend_list); Service_List = depend_list; for (Service_T s = depend_list; s; s = s->next_depend) s->next = s->next_depend; } // Check and warn if the executable does not exist static void check_exec(char *exec) { if (! File_exist(exec)) yywarning2("Program does not exist:"); else if (! File_isExecutable(exec)) yywarning2("Program is not executable:"); } /* Return a valid max forward value for SIP header */ static int verifyMaxForward(int mf) { if (mf == 0) { return INT_MAX; // Differentiate uninitialized (0) and explicit zero } else if (mf > 0 && mf <= 255) { return mf; } yywarning2("SIP max forward is outside the range [0..255]. Setting max forward to 70"); return 70; } /* -------------------------------------------------------------------- Misc */ /* * Cleans up a hash string, tolower and remove byte separators */ static int cleanup_hash_string(char *hashstring) { int i = 0, j = 0; assert(hashstring); while (hashstring[i]) { if (isxdigit((int)hashstring[i])) { hashstring[j] = tolower((int)hashstring[i]); j++; } i++; } hashstring[j] = 0; return j; } /* Return deep copy of the command */ static command_t copycommand(command_t source) { int i; command_t copy = NULL; NEW(copy); copy->length = source->length; copy->has_uid = source->has_uid; copy->uid = source->uid; copy->has_gid = source->has_gid; copy->gid = source->gid; copy->timeout = source->timeout; for (i = 0; i < copy->length; i++) copy->arg[i] = Str_dup(source->arg[i]); copy->arg[copy->length] = NULL; return copy; } static void _setPEM(char **store, char *path, const char *description, bool isFile) { if (*store) { yyerror2("Duplicate %s", description); FREE(path); } else if (! File_exist(path)) { yyerror2("%s doesn't exist", description); FREE(path); } else if (! (isFile ? File_isFile(path) : File_isDirectory(path))) { yyerror2("%s is not a %s", description, isFile ? "file" : "directory"); FREE(path); } else if (! File_isReadable(path)) { yyerror2("Cannot read %s", description); FREE(path); } else { sslset.flags = SSL_Enabled; *store = path; } } static void _setSSLOptions(SslOptions_T options) { options->allowSelfSigned = sslset.allowSelfSigned; options->CACertificateFile = sslset.CACertificateFile; options->CACertificatePath = sslset.CACertificatePath; options->checksum = sslset.checksum; options->checksumType = sslset.checksumType; options->ciphers = sslset.ciphers; options->clientpemfile = sslset.clientpemfile; options->flags = sslset.flags; options->pemfile = sslset.pemfile; options->pemchain = sslset.pemchain; options->pemkey = sslset.pemkey; options->verify = sslset.verify; options->version = sslset.version; reset_sslset(); } #ifdef HAVE_OPENSSL static void _setSSLVersion(short version) { sslset.flags = SSL_Enabled; if (sslset.version == -1) sslset.version = version; else sslset.version |= version; } #endif static void _unsetSSLVersion(short version) { if (sslset.version != -1) sslset.version &= ~version; } static void addsecurityattribute(char *value, Action_Type failed, Action_Type succeeded) { SecurityAttribute_T attr; NEW(attr); addeventaction(&(attr->action), failed, succeeded); attr->attribute = value; attr->next = current->secattrlist; current->secattrlist = attr; } static void addfiledescriptors(Operator_Type operator, bool total, long long value_absolute, float value_percent, Action_Type failed, Action_Type succeeded) { Filedescriptors_T fds; NEW(fds); addeventaction(&(fds->action), failed, succeeded); fds->total = total; fds->limit_absolute = value_absolute; fds->limit_percent = value_percent; fds->operator = operator; fds->next = current->filedescriptorslist; current->filedescriptorslist = fds; } static void _sanityCheckEveryStatement(Service_T s) { if (s->every.type != Every_Initializing) { yywarning2("The 'every' statement can be specified only once, the last value will be used\n"); switch (s->every.type) { case Every_Cron: case Every_NotInCron: FREE(s->every.spec.cron); break; default: break; } } } // Turn back on unreachable code warnings #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic pop #endif monit-5.35.2/src/http.c0000644000016400001720000001036415007061157011570 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_WAIT_H #include #endif #include "monit.h" #include "engine.h" // libmonit #include "exceptions/AssertException.h" /* Private prototypes */ static void *thread_wrapper(void *arg); /* The HTTP Thread */ static Thread_T thread; static volatile bool running = false; /** * Facade functions for the cervlet sub-system. Start/Stop the monit * http server and check if monit http can start. * * @file */ /* ------------------------------------------------------------------ Public */ /** * @return true if the monit http can start and is specified in the * controlfile to start, otherwise return false. Print an error * message if monit httpd _should_ start but can't. */ bool can_http(void) { if ((Run.httpd.flags & Httpd_Net || Run.httpd.flags & Httpd_Unix) && (Run.flags & Run_Daemon)) { if (! Engine_hasAllow() && ! Run.httpd.credentials && ! ((Run.httpd.socket.net.ssl.flags & SSL_Enabled) && (Run.httpd.flags & Httpd_Net) && Run.httpd.socket.net.ssl.clientpemfile)) { Log_error("%s: monit httpd not started since no connections are allowed\n", Prog); return false; } return true; } return false; } /** * Start and stop the monit http server * @param action Httpd_Action */ void monit_http(Httpd_Action action) { switch (action) { case Httpd_Stop: if (! running) break; Log_debug("Shutting down Monit HTTP server\n"); Engine_stop(); Thread_join(thread); Log_debug("Monit HTTP server stopped\n"); running = false; break; case Httpd_Start: if (Run.httpd.flags & Httpd_Net) Log_debug("Starting Monit HTTP server at [%s]:%d\n", Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "*", Run.httpd.socket.net.port); if (Run.httpd.flags & Httpd_Unix) Log_debug("Starting Monit HTTP server at %s\n", Run.httpd.socket.unix.path); Engine_setStopped(false); Thread_create(thread, thread_wrapper, NULL); Log_debug("Monit HTTP server started\n"); running = true; break; default: Log_error("Monit: Unknown http server action\n"); break; } } /* ----------------------------------------------------------------- Private */ static void *thread_wrapper(__attribute__ ((unused)) void *arg) { set_signal_block(false); Engine_start(); #ifdef HAVE_OPENSSL Ssl_threadCleanup(); #endif return NULL; } monit-5.35.2/src/monit.h0000644000016400001720000017605115007061157011752 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_H #define MONIT_H #include "config.h" #include #ifdef HAVE_KINFO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_PTHREAD_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_REGEX_H #include #endif #ifdef HAVE_SYSLOG_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_SYS_UTSNAME_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #include #include "Ssl.h" #include "Address.h" #include "statistics/Statistics.h" #include "net/socket.h" #include "net/Link.h" // libmonit #include "system/Command.h" #include "system/Process.h" #include "util/Str.h" #include "util/StringBuffer.h" #include "thread/Thread.h" #define MONITRC "monitrc" #define TIMEFORMAT "%FT%T%z" #define STRERROR strerror(errno) #define STRLEN 256 #ifndef USEC_PER_SEC #define USEC_PER_SEC 1000000LL #endif #define USEC_PER_MSEC 1000LL #define ARGMAX 64 #define MYPIDDIR PIDDIR #define MYPIDFILE "monit.pid" #define MYSTATEFILE "monit.state" #define MYIDFILE "monit.id" #define MYEVENTLISTBASE "/var/monit" #define LOCALHOST "localhost" #define PORT_SMTP 25 #define PORT_SMTPS 465 #define PORT_HTTP 80 #define PORT_HTTPS 443 #define SSL_TIMEOUT 15000 #define SMTP_TIMEOUT 30000 //FIXME: refactor Run_Flags to bit field typedef enum { Run_Once = 0x1, /**< Run Monit only once */ Run_Foreground = 0x2, /**< Don't daemonize Monit */ //FIXME: cleanup: Run_Foreground and Run_Daemon are mutually exclusive => no need for 2 flags Run_Daemon = 0x4, /**< Daemonize Monit */ //FIXME: cleanup: Run_Foreground and Run_Daemon are mutually exclusive => no need for 2 flags Run_Log = 0x8, /**< Log enabled */ Run_UseSyslog = 0x10, /**< Use syslog */ //FIXME: cleanup: no need for standalone flag ... if syslog is enabled, don't set Run.files.log, then (Run.flags&Run_Log && ! Run.files.log => syslog) Run_FipsEnabled = 0x20, /** FIPS-140 mode enabled */ Run_HandlerInit = 0x40, /**< The handlers queue initialization */ Run_ProcessEngineEnabled = 0x80, /**< Process monitoring engine enabled */ Run_ActionPending = 0x100, /**< Service action pending */ Run_MmonitCredentials = 0x200, /**< Should set M/Monit credentials */ Run_Stopped = 0x400, /**< Stop Monit */ Run_DoReload = 0x800, /**< Reload Monit */ Run_DoWakeup = 0x1000, /**< Wakeup Monit */ Run_Batch = 0x2000 /**< CLI batch mode */ } Run_Flags; typedef enum { ProcessEngine_None = 0x0, ProcessEngine_CollectCommandLine = 0x1 } ProcessEngine_Flags; typedef enum { Httpd_Start = 1, Httpd_Stop } Httpd_Action; typedef enum { Every_Initializing = 0, Every_Cycle, Every_SkipCycles, Every_Cron, Every_NotInCron } Every_Type; typedef enum { State_Succeeded = 0x0, State_Failed = 0x1, State_Changed = 0x2, State_ChangedNot = 0x4, State_Init = 0x8, State_None = State_Init // Alias } State_Type; typedef enum { Operator_Less = 0, Operator_LessOrEqual, Operator_Greater, Operator_GreaterOrEqual, Operator_Equal, Operator_NotEqual, Operator_Changed } Operator_Type; typedef enum { Timestamp_Default = 0, Timestamp_Access, Timestamp_Change, Timestamp_Modification } Timestamp_Type; typedef enum { Httpd_Disabled = 0x0, Httpd_Net = 0x1, // IP Httpd_Unix = 0x2, // Unix socket Httpd_UnixUid = 0x4, // Unix socket: override UID Httpd_UnixGid = 0x8, // Unix socket: override GID Httpd_UnixPermission = 0x10, // Unix socket: override permissions Httpd_Signature = 0x20 // Server Signature enabled } Httpd_Flags; typedef enum { Http_Head = 1, Http_Get } Http_Method; typedef enum { Time_Second = 1, Time_Minute = 60, Time_Hour = 3600, Time_Day = 86400, Time_Month = 2678400 } Time_Type; typedef enum { Action_Ignored = 0, Action_Alert, Action_Restart, Action_Stop, Action_Exec, Action_Unmonitor, Action_Start, Action_Monitor } Action_Type; typedef enum { Monitor_Active = 0, Monitor_Passive } Monitor_Mode; typedef enum { Onreboot_Start = 0, Onreboot_Nostart, Onreboot_Laststate } Onreboot_Type; typedef enum { Monitor_Not = 0x0, Monitor_Yes = 0x1, Monitor_Init = 0x2, Monitor_Waiting = 0x4 } Monitor_State; typedef enum { Connection_Failed = 0, Connection_Ok, Connection_Init } Connection_State; typedef enum { Service_Filesystem = 0, Service_Directory, Service_File, Service_Process, Service_Host, Service_System, Service_Fifo, Service_Program, Service_Net, Service_Last = Service_Net } Service_Type; typedef enum { Resource_CpuPercent = 1, Resource_MemoryPercent, Resource_MemoryKbyte, Resource_LoadAverage1m, Resource_LoadAverage5m, Resource_LoadAverage15m, Resource_Children, Resource_MemoryKbyteTotal, Resource_MemoryPercentTotal, Resource_Inode, Resource_InodeFree, Resource_Space, Resource_SpaceFree, Resource_CpuUser, Resource_CpuSystem, Resource_CpuWait, Resource_CpuNice, Resource_CpuHardIRQ, Resource_CpuSoftIRQ, Resource_CpuSteal, Resource_CpuGuest, Resource_CpuGuestNice, Resource_CpuPercentTotal, Resource_SwapPercent, Resource_SwapKbyte, Resource_Threads, Resource_ReadBytes, Resource_ReadBytesPhysical, Resource_ReadOperations, Resource_WriteBytes, Resource_WriteBytesPhysical, Resource_WriteOperations, Resource_ServiceTime, Resource_LoadAveragePerCore1m, Resource_LoadAveragePerCore5m, Resource_LoadAveragePerCore15m, Resource_HardLink // Used by check file, fifo and directory } Resource_Type; typedef enum { Digest_Cleartext = 1, Digest_Crypt, Digest_Md5, Digest_Pam } Digest_Type; typedef enum { Unit_Byte = 1, Unit_Kilobyte = 1024, Unit_Megabyte = 1048576, Unit_Gigabyte = 1073741824 } Unit_Type; typedef enum { Hash_Unknown = 0, Hash_Md5, Hash_Sha1, Hash_Default = Hash_Md5 } Hash_Type; typedef enum { Handler_Succeeded = 0x0, Handler_Alert = 0x1, Handler_Mmonit = 0x2, Handler_Max = Handler_Mmonit } Handler_Type; typedef enum { MmonitCompress_Init = 0, MmonitCompress_No, MmonitCompress_Yes } MmonitCompress_Type; typedef enum { Statistics_CpuUser = 0x1, Statistics_CpuNice = 0x2, Statistics_CpuSystem = 0x4, Statistics_CpuIOWait = 0x8, Statistics_CpuHardIRQ = 0x10, Statistics_CpuSoftIRQ = 0x20, Statistics_CpuSteal = 0x40, Statistics_CpuGuest = 0x80, Statistics_CpuGuestNice = 0x100, Statistics_FiledescriptorsPerSystem = 0x200, Statistics_FiledescriptorsPerProcess = 0x400, Statistics_FiledescriptorsPerProcessMax = 0x800 } Statistics_Flags; /* Length of the longest message digest in bytes */ #define MD_SIZE 65 #define ICMP_SIZE 64 #define ICMP_MAXSIZE 1500 #define ICMP_ATTEMPT_COUNT 3 /* Default limits */ #define LIMIT_SENDEXPECTBUFFER 256 #define LIMIT_FILECONTENTBUFFER 512 #define LIMIT_PROGRAMOUTPUT 512 #define LIMIT_HTTPCONTENTBUFFER 1048576 #define LIMIT_NETWORKTIMEOUT 5000 #define LIMIT_PROGRAMTIMEOUT 300000 #define LIMIT_STOPTIMEOUT 30000 #define LIMIT_STARTTIMEOUT 30000 #define LIMIT_RESTARTTIMEOUT 30000 #define LIMIT_EXECTIMEOUT 0 /* Unlimited timeout */ /** ------------------------------------------------- Special purpose macros */ /* Replace the standard signal function with a more reliable using * sigaction. Taken from Stevens APUE book. */ typedef void Sigfunc(int); Sigfunc *signal(int signo, Sigfunc * func); #if defined(SIG_IGN) && !defined(SIG_ERR) #define SIG_ERR ((Sigfunc *)-1) #endif /** ------------------------------------------------- General purpose macros */ #undef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) #undef MIN #define MIN(x,y) ((x) < (y) ? (x) : (y)) #define IS(a,b) ((a && b) ? Str_isEqual(a, b) : false) #define DEBUG Log_debug #define FLAG(x, y) (x & y) == y #define NVLSTR(x) (x ? x : "") /* --------------------------------------------------------- Data structures */ /** Message Digest type with size for the longest digest we will compute */ typedef char MD_T[MD_SIZE]; /** Defines monit limits object */ typedef struct Limits_T { size_t fileContentBuffer; /**< Maximum tested file content length [B] */ int programOutput; /**< Program output truncate limit [B] */ int sendExpectBuffer; /**< Maximum send/expect response length [B] */ int httpContentBuffer; /**< Maximum tested HTTP content length [B] */ int networkTimeout; /**< Default network timeout [ms] */ int programTimeout; /**< Default program timeout [ms] */ int stopTimeout; /**< Default stop timeout [ms] */ int startTimeout; /**< Default start timeout [ms] */ int restartTimeout; /**< Default restart timeout [ms] */ int execTimeout; /**< Default test action exec timeout [ms] */ } Limits_T; /** * Defines a Command with ARGMAX optional arguments. The arguments * array must be NULL terminated and the first entry is the program * itself. In addition, a user and group may be set for the Command * which means that the Command should run as a certain user and with * certain group. To avoid name collision with Command_T in libmonit * this structure uses lower case. */ typedef struct command_t { char *arg[ARGMAX]; /**< Program with arguments */ short length; /**< The length of the arguments array */ bool has_uid; /**< true if a new uid is defined for this Command */ bool has_gid; /**< true if a new gid is defined for this Command */ uid_t uid; /**< The user id to switch to when running this Command */ gid_t gid; /**< The group id to switch to when running this Command */ unsigned int timeout; /**< Max seconds which we wait for method to execute */ } *command_t; /** Defines an event action object */ typedef struct Action_T { Action_Type id; /**< Action to be done */ int count; /**< Event count needed to trigger the action */ int cycles; /**< Cycles during which count limit can be reached */ int repeat; /*< Repeat action each Xth cycle */ command_t exec; /**< Optional command to be executed */ } *Action_T; /** Defines event's up and down actions */ typedef struct EventAction_T { Action_T failed; /**< Action in the case of failure down */ Action_T succeeded; /**< Action in the case of failure up */ } *EventAction_T; /** Defines an url object */ typedef struct URL_T { char *url; /**< Full URL */ char *protocol; /**< URL protocol type */ char *user; /**< URL user part */ char *password; /**< URL password part */ char *hostname; /**< URL hostname part */ char *path; /**< URL path part */ char *query; /**< URL query part */ int port; /**< URL port part */ bool ipv6; } *URL_T; /** Defines a HTTP client request object */ typedef struct Request_T { URL_T url; /**< URL request */ Operator_Type operator; /**< Response content comparison operator */ regex_t *regex; /* regex used to test the response body */ } *Request_T; /** Defines an event notification and status receiver object */ typedef struct Mmonit_T { URL_T url; /**< URL definition */ struct SslOptions_T ssl; /**< SSL definition */ int timeout; /**< The timeout to wait for connection or i/o */ MmonitCompress_Type compress; /**< Compression flag */ List_T hostgroups; /**< Member of M/Monit host groups */ /** For internal use */ struct Mmonit_T *next; /**< next receiver in chain */ } *Mmonit_T; /** Defines a mailinglist object */ typedef struct Mail_T { char *to; /**< Mail address for alert notification */ Address_T from; /**< The mail from address */ Address_T replyto; /**< Optional reply-to address */ char *subject; /**< The mail subject */ char *message; /**< The mail message */ char *host; /**< FQDN hostname */ unsigned int events; /*< Events for which this mail object should be sent */ unsigned int reminder; /*< Send error reminder each Xth cycle */ /** For internal use */ struct Mail_T *next; /**< next recipient in chain */ } *Mail_T; /** Defines a mail server address */ typedef struct MailServer_T { char *host; /**< Server host address, may be a IP or a hostname string */ int port; /**< Server port */ char *username; /** < Username for SMTP_AUTH */ char *password; /** < Password for SMTP_AUTH */ struct SslOptions_T ssl; /**< SSL definition */ Socket_T socket; /**< Connected socket */ /** For internal use */ struct MailServer_T *next; /**< Next server to try on connect error */ } *MailServer_T; typedef struct Auth_T { char *uname; /**< User allowed to connect to monit httpd */ char *passwd; /**< The users password data */ char *groupname; /**< PAM group name */ Digest_Type digesttype; /**< How did we store the password */ bool is_readonly; /**< true if this is a read-only authenticated user*/ struct Auth_T *next; /**< Next credential or NULL if last */ } *Auth_T; /** Defines data for systemwide statistic */ typedef struct SystemInfo_T { Statistics_Flags statisticsAvailable; /**< List of statistics that are available on this system */ struct { int count; /**< Number of CPUs */ struct { float user; /**< Time in user space [%] */ float nice; /**< Time in user space with low priority [%] */ float system; /**< Time in kernel space [%] */ float iowait; /**< Idle time while waiting for I/O [%] */ float hardirq; /**< Time servicing hardware interrupts [%] */ float softirq; /**< Time servicing software interrupts [%] */ float steal; /**< Stolen time, which is the time spent in other operating systems when running in a virtualized environment [%] */ float guest; /**< Time spent running a virtual CPU for guest operating systems under the control of the kernel [%] */ float guest_nice; /**< Time spent running a niced guest (virtual CPU for guest operating systems under the control of the kernel) [%] */ float idle; /**< Idle time [%] */ } usage; } cpu; struct { unsigned long long size; /**< Maximal system real memory */ struct { float percent; /**< Total real memory in use in the system */ unsigned long long bytes; /**< Total real memory in use in the system */ } usage; } memory; struct { unsigned long long size; /**< Swap size */ struct { float percent; /**< Total swap in use in the system */ unsigned long long bytes; /**< Total swap in use in the system */ } usage; } swap; struct { long long allocated; /**< Number of allocated filedescriptors */ long long unused; /**< Number of unused filedescriptors */ long long maximum; /**< Filedescriptors limit */ } filedescriptors; size_t argmax; /**< Program arguments maximum [B] */ double loadavg[3]; /**< Load average triple */ struct utsname uname; /**< Platform information provided by uname() */ struct timeval collected; /**< When were data collected */ unsigned long long booted; /**< System boot time (seconds since UNIX epoch, using platform-agnostic unsigned long long) */ double time; /**< 1/10 seconds */ double time_prev; /**< 1/10 seconds */ } SystemInfo_T; /** Defines a protocol object with protocol functions */ typedef struct Protocol_T { const char *name; /**< Protocol name */ void (*check)(Socket_T); /**< Protocol verification function */ } *Protocol_T; /** Defines a send/expect object used for generic protocol tests */ typedef struct Generic_T { char *send; /* string to send, or NULL if expect */ regex_t *expect; /* regex code to expect, or NULL if send */ /** For internal use */ struct Generic_T *next; } *Generic_T; typedef struct Outgoing_T { char *ip; /**< Outgoing IP address */ struct sockaddr_storage addr; socklen_t addrlen; } Outgoing_T; typedef struct ResponseTime_T { Operator_Type operator; double current; /**< Current response time [ms] */ double limit; /**< Response time limit [ms] */ } ResponseTime_T; /** Defines a port object */ typedef struct Port_T { char *hostname; /**< Hostname to check */ union { struct { char *pathname; /**< Unix socket pathname */ } unix; struct { int port; /**< Port number */ struct { struct SslOptions_T options; struct { int validDays; int minimumDays; } certificate; } ssl; } net; } target; Outgoing_T outgoing; /**< Outgoing address */ bool check_invers; /**< Whether to alert on a connection success */ int timeout; /**< The timeout in [ms] to wait for connect or read i/o */ int retry; /**< Number of connection retry before reporting an error */ volatile int socket; /**< Socket used for connection */ struct ResponseTime_T responsetime; /**< Response time limit */ Socket_Type type; /**< Socket type used for connection (UDP/TCP) */ Socket_Family family; /**< Socket family used for connection (NET/UNIX) */ Connection_State is_available; /**< Server/port availability */ EventAction_T action; /**< Description of the action upon event occurrence */ /** Protocol specific parameters */ union { struct { char *username; char *password; char *path; /**< status path */ short loglimit; /**< Max percentage of logging processes */ short closelimit; /**< Max percentage of closinging processes */ short dnslimit; /**< Max percentage of processes doing DNS lookup */ short keepalivelimit; /**< Max percentage of keepalive processes */ short replylimit; /**< Max percentage of replying processes */ short requestlimit; /**< Max percentage of processes reading requests */ short startlimit; /**< Max percentage of processes starting up */ short waitlimit; /**< Min percentage of processes waiting for connection */ short gracefullimit;/**< Max percentage of processes gracefully finishing */ short cleanuplimit; /**< Max percentage of processes in idle cleanup */ Operator_Type loglimitOP; /**< loglimit operator */ Operator_Type closelimitOP; /**< closelimit operator */ Operator_Type dnslimitOP; /**< dnslimit operator */ Operator_Type keepalivelimitOP; /**< keepalivelimit operator */ Operator_Type replylimitOP; /**< replylimit operator */ Operator_Type requestlimitOP; /**< requestlimit operator */ Operator_Type startlimitOP; /**< startlimit operator */ Operator_Type waitlimitOP; /**< waitlimit operator */ Operator_Type gracefullimitOP; /**< gracefullimit operator */ Operator_Type cleanuplimitOP; /**< cleanuplimit operator */ } apachestatus; struct { Generic_T sendexpect; } generic; struct { Hash_Type hashtype; /**< Type of hash for a checksum (optional) */ bool hasStatus; /**< Is explicit HTTP status set? */ Operator_Type operator; /**< HTTP status operator */ Http_Method method; int status; /**< HTTP status */ char *username; char *password; char *request; /**< HTTP request */ char *checksum; /**< Document checksum (optional) */ List_T headers; /**< List of headers to send with request (optional) */ } http; struct { char *username; char *password; } mqtt; struct { char *username; char *password; char *rsaChecksum; Hash_Type rsaChecksumType; } mysql; struct { char *username; char *password; char *database; } postgresql; struct { char *secret; } radius; struct { int maxforward; char *target; } sip; struct { char *username; char *password; } smtp; struct { int version; char *host; char *origin; char *request; } websocket; } parameters; Protocol_T protocol; /**< Protocol object for testing a port's service */ Request_T url_request; /**< Optional url client request object */ /** For internal use */ struct Port_T *next; /**< next port in chain */ } *Port_T; /** Defines a ICMP/Ping object */ typedef struct Icmp_T { int type; /**< ICMP type used */ int size; /**< ICMP echo requests size */ int count; /**< ICMP echo requests count */ int timeout; /**< The timeout in milliseconds to wait for response */ bool check_invers; /**< Whether to alert on a connection success */ Connection_State is_available; /**< Flag for the server is availability */ Socket_Family family; /**< ICMP family used for connection */ struct ResponseTime_T responsetime; /**< Response time limit */ Outgoing_T outgoing; /**< Outgoing address */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Icmp_T *next; /**< next icmp in chain */ } *Icmp_T; typedef struct Dependant_T { char *dependant; /**< name of dependant service */ char *dependant_urlescaped; /**< URL escaped name of dependant service */ StringBuffer_T dependant_htmlescaped; /**< HTML escaped name of dependant service */ /** For internal use */ struct Dependant_T *next; /**< next dependant service in chain */ } *Dependant_T; /** Defines resource data */ typedef struct Resource_T { Resource_Type resource_id; /**< Which value is checked */ Operator_Type operator; /**< Comparison operator */ double limit; /**< Limit of the resource */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Resource_T *next; /**< next resource in chain */ } *Resource_T; /** Defines timestamp object */ typedef struct Timestamp_T { bool initialized; /**< true if timestamp was initialized */ bool test_changes; /**< true if we only should test for changes */ Timestamp_Type type; Operator_Type operator; /**< Comparison operator */ unsigned long long time; /**< Timestamp watermark */ time_t lastTimestamp; /**< Last timestamp (context depends on type) */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Timestamp_T *next; /**< next timestamp in chain */ } *Timestamp_T; /** Defines action rate object */ typedef struct ActionRate_T { int count; /**< Action counter */ int cycle; /**< Cycle counter */ EventAction_T action; /**< Description of the action upon matching rate */ /** For internal use */ struct ActionRate_T *next; /**< next actionrate in chain */ } *ActionRate_T; /** Defines when to run a check for a service. This type supports both the old cycle based every statement and the new cron-format version */ typedef struct Every_T { Every_Type type; time_t last_run; union { struct { int number; /**< Check this program at a given cycles */ int counter; /**< Counter for number. When counter == number, check */ } cycle; /**< Old cycle based every check */ char *cron; /* A crontab format string */ } spec; } Every_T; typedef struct Status_T { bool initialized; /**< true if status was initialized */ Operator_Type operator; /**< Comparison operator */ int return_value; /**< Return value of the program to check */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Status_T *next; /**< next exit value in chain */ } *Status_T; typedef struct Program_T { Process_T P; /**< A Process_T object representing the sub-process */ Command_T C; /**< A Command_T object for creating the sub-process */ command_t args; /**< Program arguments */ time_t started; /**< When the sub-process was started */ int timeout; /**< Seconds the program may run until it is killed */ int exitStatus; /**< Sub-process exit status for reporting */ StringBuffer_T lastOutput; /**< Last program output */ StringBuffer_T inprogressOutput; /**< Output of the pending program instance */ } *Program_T; /** Defines size object */ typedef struct Size_T { bool initialized; /**< true if size was initialized */ bool test_changes; /**< true if we only should test for changes */ Operator_Type operator; /**< Comparison operator */ unsigned long long size; /**< Size watermark */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Size_T *next; /**< next size in chain */ } *Size_T; /** Defines nlink object */ typedef struct NLink_T { bool initialized; /**< true if size was initialized */ bool test_changes; /**< true if we only should test for changes */ Operator_Type operator; /**< Comparison operator */ unsigned long long nlink; /**< Hard links watermark */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct NLink_T *next; /**< next nlink in chain */ } *NLink_T; /** Defines uptime object */ typedef struct Uptime_T { Operator_Type operator; /**< Comparison operator */ unsigned long long uptime; /**< Uptime watermark */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Uptime_T *next; /**< next uptime in chain */ } *Uptime_T; typedef struct LinkStatus_T { bool check_invers; /**< Whether to alert on a link up */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct LinkStatus_T *next; /**< next link in chain */ } *LinkStatus_T; typedef struct LinkSpeed_T { int duplex; /**< Last duplex status */ long long speed; /**< Last speed [bps] */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct LinkSpeed_T *next; /**< next link in chain */ } *LinkSpeed_T; typedef struct LinkSaturation_T { Operator_Type operator; /**< Comparison operator */ float limit; /**< Saturation limit [%] */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct LinkSaturation_T *next; /**< next link in chain */ } *LinkSaturation_T; typedef struct Bandwidth_T { Operator_Type operator; /**< Comparison operator */ Time_Type range; /**< Time range to watch: unit */ int rangecount; /**< Time range to watch: count */ unsigned long long limit; /**< Data watermark */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Bandwidth_T *next; /**< next bandwidth in chain */ } *Bandwidth_T; /** Defines checksum object */ typedef struct Checksum_T { bool initialized; /**< true if checksum was initialized */ bool test_changes; /**< true if we only should test for changes */ Hash_Type type; /**< The type of hash (e.g. md5 or sha1) */ int length; /**< Length of the hash */ char hash[MD_SIZE + 1]; /**< A checksum hash computed for the path */ EventAction_T action; /**< Description of the action upon event occurrence */ } *Checksum_T; /** Defines permission object */ typedef struct Perm_T { bool test_changes; /**< true if we only should test for changes */ int perm; /**< Access permission */ EventAction_T action; /**< Description of the action upon event occurrence */ } *Perm_T; /** Defines match object */ typedef struct Match_T { bool ignore; /**< Ignore match */ bool not; /**< Invert match */ char *match_string; /**< Match string */ //FIXME: union? char *match_path; /**< File with matching rules */ //FIXME: union? regex_t *regex_comp; /**< Match compile */ StringBuffer_T log; /**< The temporary buffer used to record the matches */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct Match_T *next; /**< next match in chain */ } *Match_T; /** Defines output change object */ typedef struct OutputChange_T { char *previous; /**< previous output (truncated to `programOutput`) */ bool check_invers; /**< Whether to alert on no change */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct OutputChange_T *next; } *OutputChange_T; /** Defines uid object */ typedef struct Uid_T { uid_t uid; /**< Owner's uid */ EventAction_T action; /**< Description of the action upon event occurrence */ } *Uid_T; /** Defines gid object */ typedef struct Gid_T { gid_t gid; /**< Owner's gid */ EventAction_T action; /**< Description of the action upon event occurrence */ } *Gid_T; typedef struct SecurityAttribute_T { char *attribute; /**< Security attribute */ EventAction_T action; /**< Description of the action upon event occurrence */ /** For internal use */ struct SecurityAttribute_T *next; } *SecurityAttribute_T; typedef struct Filedescriptors_T { bool total; /** 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* begin standard C++ headers. */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an * integer in range [0..255] for use as an array index. */ #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); void yy_delete_buffer ( YY_BUFFER_STATE b ); void yy_flush_buffer ( YY_BUFFER_STATE b ); void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); void yypop_buffer_state ( void ); static void yyensure_buffer_stack ( void ); static void yy_load_buffer_state ( void ); static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); void *yyalloc ( yy_size_t ); void *yyrealloc ( void *, yy_size_t ); void yyfree ( void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef flex_uint8_t YY_CHAR; FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr yytext static yy_state_type yy_get_previous_state ( void ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); static int yy_get_next_buffer ( void ); static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 415 #define YY_END_OF_BUFFER 416 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static const flex_int16_t yy_acclist[4397] = { 0, 2, 2, 411, 411, 416, 410, 415, 1, 410, 415, 2, 415, 410, 415, 354, 410, 415, 2, 351, 410, 415, 351, 410, 415, 338, 410, 415, 354, 410, 415, 351, 410, 415, 346, 351, 410, 415, 336, 337, 351, 410, 415, 336, 337, 351, 410, 415, 336, 337, 351, 410, 415, 336, 337, 351, 410, 415, 410, 415, 304, 351, 410, 415, 306, 351, 410, 415, 302, 351, 410, 415, 351, 410, 415, 286, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 311, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 310, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 309, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 351, 410, 415, 2, 351, 410, 415, 372, 410, 415, 367, 410, 415, 368, 415, 367, 372, 410, 415, 369, 410, 415, 371, 372, 410, 415, 361, 410, 415, 362, 415, 410, 415, 363, 410, 415, 410, 415, 361, 410, 415, 355, 410, 415, 356, 415, 360, 410, 415, 357, 410, 415, 360, 410, 415, 410, 415,16758, 373, 410, 415,16758, 373, 415,16758, 373, 410, 415, 381, 410, 415,16758, 376, 410, 415,16758, 379, 410, 415,16758, 410, 415, 380, 410, 415,16758, 410, 415,16758, 386, 410, 415, 382, 415, 384, 386, 410, 415, 383, 384, 386, 410, 415, 383, 384, 385, 386, 410, 415, 385, 386, 410, 415, 383, 386, 410, 415, 382, 386, 410, 415, 415, 390, 410, 415, 387, 410, 415, 390, 410, 415, 394, 397, 410, 415, 391, 397, 410, 415, 393, 415, 394, 397, 410, 415, 394, 397, 410, 415, 391, 394, 397, 410, 415, 391, 397, 410, 415, 392, 397, 410, 415, 396, 397, 410, 415, 402, 410, 415, 398, 402, 410, 415, 402, 410, 415, 399, 402, 410, 415, 402, 410, 415, 409, 410, 415, 403, 409, 410, 415, 405, 415, 403, 409, 410, 415, 409, 410, 415, 404, 409, 410, 415, 408, 409, 410, 415, 414, 415, 411, 415, 414, 415, 414, 415, 1, 307, 342, 2, 2, 2, 351, 2, 351, 2, 2, 351, 351, 351, 343, 351, 351, 345, 351, 345, 351, 339, 351, 339, 351, 336, 337, 339, 351, 339, 351, 339, 351, 336, 337, 339, 351, 336, 337, 339, 351, 336, 337, 339, 351, 336, 337, 339, 351, 353, 305, 351, 306, 351, 303, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 4, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 306, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 289, 339, 351, 303, 339, 351, 339, 351, 339, 351, 339, 351, 302, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 40, 339, 351, 339, 351, 339, 351, 27, 339, 351, 339, 351, 3, 339, 351, 287, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 305, 339, 351, 339, 351, 339, 351, 339, 351, 304, 339, 351, 339, 351, 288, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 308, 339, 351, 339, 351, 339, 351, 307, 339, 351, 339, 351, 339, 351, 339, 351, 23, 339, 351, 339, 351, 8, 339, 351, 339, 351, 24, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 16, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 74, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 372, 367, 367, 372, 372, 370, 372, 366, 361, 366, 362, 366, 361, 366, 361, 362, 366, 366, 362, 366, 362, 363, 362, 355, 357,16758, 373,16758, 373, 381, 16758, 381, 381, 376,16758,16758, 379,16758, 379, 379, 378, 380,16758, 380, 380,16758, 384, 383, 384, 383, 387, 394, 391, 391, 394, 394, 391, 394, 398, 399, 406, 403, 403, 407, 407, 407, 407, 414, 411, 414, 414, 340, 342, 2, 2, 351, 2, 351, 2, 344, 2, 344, 351, 344, 341, 343, 351, 351, 345, 351, 339, 351, 337, 339, 351, 337, 339, 351, 337, 339, 351, 337, 339, 351, 339, 351, 336, 337, 339, 351, 339, 351, 353, 336, 337, 339, 351, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 11, 339, 351, 339, 351, 5, 339, 351, 339, 351, 339, 351, 339, 351, 286, 339, 351, 339, 351, 339, 351, 22, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 197, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 312, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 140, 339, 351, 339, 351, 339, 351, 151, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 6, 339, 351, 339, 351, 339, 351, 339, 351, 131, 339, 351, 339, 351, 124, 339, 351, 180, 339, 351, 339, 351, 164, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 12, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 59, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 256, 339, 351, 339, 351, 193, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 231, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 26, 339, 351, 339, 351, 271, 339, 351, 339, 351, 135, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 54, 339, 351, 339, 351, 339, 351, 339, 351, 163, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 145, 339, 351, 44, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 17, 339, 351, 339, 351, 339, 351, 339, 351, 108, 339, 351, 339, 351, 339, 351, 15, 339, 351, 339, 351, 339, 351, 43, 339, 351, 157, 339, 351, 339, 351, 339, 351, 110, 339, 351, 176, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 269, 339, 351, 339, 351, 14, 339, 351, 339, 351, 339, 351, 339, 351, 7, 339, 351, 339, 351, 20, 339, 351, 339, 351, 339, 351, 339, 351, 370, 364, 365, 358, 359, 381, 376,16758, 379, 375, 380, 377,16758, 377, 388, 389, 394, 395, 395, 407, 407, 412, 414, 412, 413, 414, 413, 351, 351, 339, 351, 337, 339, 351, 337, 339, 351, 337, 339, 351, 337, 339, 351, 336, 337, 339, 351, 339, 351, 335, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 216, 339, 351, 339, 351, 339, 351, 286, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 196, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 263, 339, 351, 312, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 91, 339, 351, 339, 351, 25, 339, 351, 75, 339, 351, 240, 339, 351, 267, 339, 351, 339, 351, 339, 351, 177, 339, 351, 339, 351, 339, 351, 222, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 284, 339, 351, 220, 339, 351, 339, 351, 339, 351, 289, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 125, 339, 351, 121, 339, 351, 311, 339, 351, 128, 339, 351, 236, 339, 351, 339, 351, 339, 351, 137, 339, 351, 339, 351, 87, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 104, 339, 351, 105, 339, 351, 287, 339, 351, 339, 351, 339, 351, 28, 339, 351, 339, 351, 304, 339, 351, 339, 351, 66, 339, 351, 155, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 288, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 169, 339, 351, 339, 351, 339, 351, 339, 351, 302, 339, 351, 160, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 143, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 144, 339, 351, 339, 351, 8, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 99, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 221, 339, 351, 339, 351, 339, 351, 237, 339, 351, 136, 339, 351, 102, 339, 351, 339, 351, 272, 339, 351, 339, 351, 339, 351, 339, 351, 29, 339, 351, 339, 351, 92, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 241, 339, 351, 339, 351, 257, 339, 351, 339, 351, 339, 351, 223, 339, 351, 228, 339, 351, 132, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 101, 339, 351, 339, 351, 339, 351, 194, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 18, 339, 351, 41, 339, 351, 339, 351, 201, 339, 351, 339, 351, 339, 351, 106, 339, 351, 103, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 9, 339, 351, 339, 351, 8566, 8566, 381, 8566, 379, 8566, 380, 377, 407, 351, 351, 339, 351, 339, 351, 339, 351, 339, 351, 336, 337, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 339, 351, 339, 351, 111, 339, 351, 88, 339, 351, 339, 351, 314, 339, 351, 339, 351, 339, 351, 58, 339, 351, 339, 351, 339, 351, 286, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 199, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 273, 339, 351, 293, 294, 295, 339, 351, 339, 351, 258, 339, 351, 315, 339, 351, 116, 339, 351, 339, 351, 339, 351, 339, 351, 56, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 306, 339, 351, 339, 351, 319, 339, 351, 38, 339, 351, 339, 351, 261, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 347, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 311, 339, 351, 339, 351, 63, 339, 351, 129, 339, 351, 339, 351, 339, 351, 138, 339, 351, 339, 351, 218, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 152, 339, 351, 153, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 230, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 313, 339, 351, 316, 339, 351, 141, 339, 351, 339, 351, 304, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 302, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 39, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 158, 339, 351, 339, 351, 238, 339, 351, 239, 339, 351, 339, 351, 339, 351, 339, 351, 107, 339, 351, 339, 351, 154, 339, 351, 339, 351, 339, 351, 339, 351, 146, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 118, 339, 351, 339, 351, 156, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 149, 339, 351, 339, 351, 228, 339, 351, 133, 339, 351, 219, 339, 351, 339, 351, 77, 339, 351, 339, 351, 209, 339, 351, 210, 339, 351, 100, 339, 351, 339, 351, 339, 351, 36, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 21, 339, 351, 211, 339, 351, 78, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 19, 339, 351, 339, 351, 13, 339, 351, 50, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 93, 339, 351, 401, 203, 351, 204, 351, 205, 351, 339, 351, 339, 351, 339, 351, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 235, 339, 351, 170, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 68, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 321, 322, 339, 351, 339, 351, 215, 339, 351, 139, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 116, 339, 351, 55, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 47, 339, 351, 339, 351, 339, 351, 339, 351, 261, 339, 351, 242, 339, 351, 339, 351, 339, 351, 42, 339, 351, 339, 351, 339, 351, 347, 283, 339, 351, 339, 351, 339, 351, 339, 351, 332, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 97, 339, 351, 232, 339, 351, 339, 351, 218, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 244, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 172, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 193, 339, 351, 339, 351, 123, 339, 351, 339, 351, 310, 339, 351, 268, 339, 351, 339, 351, 339, 351, 339, 351, 313, 339, 351, 142, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 32, 339, 351, 161, 339, 351, 67, 339, 351, 265, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 85, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 165, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 89, 339, 351, 339, 351, 274, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 86, 339, 351, 339, 351, 309, 339, 351, 182, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 35, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 126, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 61, 339, 351, 167, 339, 351, 109, 339, 351, 339, 351, 200, 339, 351, 339, 351, 339, 351, 212, 339, 351, 213, 339, 351, 214, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 72, 339, 351, 225, 339, 351, 339, 351, 49, 339, 351, 339, 351, 339, 351, 339, 351, 9, 339, 351, 339, 351, 401, 206, 351, 207, 351, 208, 351, 339, 351, 352, 339, 351, 352, 339, 351, 352, 339, 351, 352, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 64, 339, 351, 339, 351, 339, 351, 339, 351, 227, 339, 351, 69, 339, 351, 339, 351, 339, 351, 339, 351, 82, 339, 351, 202, 339, 351, 339, 351, 339, 351, 215, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 270, 339, 351, 294, 293, 295, 339, 351, 339, 351, 339, 351, 127, 339, 351, 320, 339, 351, 48, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 222, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 283, 339, 351, 339, 351, 339, 351, 302, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 317, 339, 351, 339, 351, 339, 351, 262, 339, 351, 339, 351, 339, 351, 339, 351, 290, 339, 351, 60, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 310, 339, 351, 339, 351, 147, 339, 351, 339, 351, 112, 339, 351, 339, 351, 174, 339, 351, 339, 351, 339, 351, 339, 351, 32, 339, 351, 339, 351, 339, 351, 339, 351, 67, 339, 351, 171, 339, 351, 339, 351, 339, 351, 83, 339, 351, 338, 339, 351, 339, 351, 96, 339, 351, 339, 351, 339, 351, 10, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 181, 339, 351, 339, 351, 339, 351, 115, 339, 351, 339, 351, 309, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 217, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 200, 339, 351, 117, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 162, 339, 351, 339, 351, 339, 351, 9, 339, 351, 339, 351, 352, 339, 351, 352, 339, 351, 352, 339, 351, 352, 339, 351, 352, 339, 351, 352, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 31, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 30, 339, 351, 339, 351, 119, 339, 351, 199, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 280, 339, 351, 185, 339, 351, 73, 339, 351, 339, 351, 339, 351, 339, 351, 62, 339, 351, 148, 339, 351, 339, 351, 339, 351, 289, 339, 351, 339, 351, 224, 339, 351, 339, 351, 339, 351, 277, 339, 351, 339, 351, 276, 339, 351, 339, 351, 339, 351, 287, 339, 351, 339, 351, 290, 183, 339, 351, 339, 351, 339, 351, 230, 339, 351, 339, 351, 288, 339, 351, 166, 339, 351, 350, 339, 351, 339, 351, 339, 351, 260, 339, 351, 307, 339, 351, 173, 339, 351, 339, 351, 67, 339, 351, 70, 339, 351, 339, 351, 279, 339, 351, 84, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 10, 339, 351, 339, 351, 107, 339, 351, 339, 351, 90, 339, 351, 339, 351, 282, 339, 351, 275, 339, 351, 339, 351, 339, 351, 339, 351, 114, 339, 351, 339, 351, 37, 339, 351, 339, 351, 115, 339, 351, 339, 351, 339, 351, 178, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 349, 339, 351, 57, 339, 351, 339, 351, 198, 339, 351, 195, 339, 351, 339, 351, 339, 351, 72, 339, 351, 278, 339, 351, 339, 351, 339, 351, 339, 351, 352, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 179, 339, 351, 339, 351, 339, 351, 339, 351, 255, 339, 351, 339, 351, 339, 351, 339, 351, 296, 339, 351, 320, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 289, 339, 351, 339, 351, 224, 339, 351, 339, 351, 339, 351, 339, 351, 65, 339, 351, 339, 351, 287, 339, 351, 175, 339, 351, 339, 351, 339, 351, 339, 351, 288, 339, 351, 350, 350, 339, 351, 339, 351, 339, 351, 260, 339, 351, 318, 95, 339, 351, 71, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 90, 339, 351, 264, 339, 351, 348, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 259, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 98, 339, 351, 339, 351, 339, 351, 349, 349, 266, 339, 351, 201, 339, 351, 198, 195, 339, 351, 339, 351, 234, 339, 351, 190, 339, 351, 159, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 179, 339, 351, 339, 351, 339, 351, 329, 325, 327, 339, 351, 339, 351, 184, 339, 351, 233, 339, 351, 300, 299, 339, 351, 320, 73, 339, 351, 46, 229, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 122, 339, 351, 339, 351, 339, 351, 290, 291, 339, 351, 120, 339, 351, 168, 339, 351, 335, 350, 339, 351, 339, 351, 339, 351, 339, 351, 95, 339, 351, 221, 339, 351, 102, 339, 351, 339, 351, 339, 351, 339, 351, 348, 187, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 76, 339, 351, 81, 339, 351, 339, 351, 339, 351, 339, 351, 45, 189, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 335, 349, 339, 351, 103, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 314, 339, 351, 339, 351, 339, 351, 51, 339, 351, 315, 339, 351, 339, 351, 281, 339, 351, 34, 254, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 333, 339, 351, 339, 351, 292, 113, 339, 351, 308, 339, 351, 339, 351, 316, 339, 351, 95, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 94, 339, 351, 339, 351, 33, 339, 351, 339, 351, 339, 351, 251, 339, 351, 195, 339, 351, 400, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 339, 351, 323, 331, 192, 339, 351, 339, 351, 297, 298, 243, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 308, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 188, 339, 351, 226, 339, 351, 339, 351, 339, 351, 339, 351, 94, 150, 339, 351, 339, 351, 252, 339, 351, 195, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 130, 339, 351, 339, 351, 328, 330, 79, 339, 351, 339, 351, 339, 351, 191, 339, 351, 334, 339, 351, 339, 351, 339, 351, 339, 351, 248, 339, 351, 339, 351, 339, 351, 339, 351, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 339, 351, 321, 322, 301, 339, 351, 339, 351, 339, 351, 186, 339, 351, 249, 339, 351, 134, 339, 351, 250, 339, 351, 339, 351, 253, 339, 351, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 339, 351, 339, 351, 326, 339, 351, 285, 339, 351, 339, 351, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 314, 339, 351, 339, 351, 339, 351, 315, 324, 339, 351, 339, 351, 316, 245, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 52, 339, 351, 53, 339, 351, 246, 339, 351, 247, 339, 351, 316, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 353, 353, 353, 353, 353, 353, 353, 353, 339, 351, 353, 353, 339, 351, 80, 339, 351, 316 } ; static const flex_int16_t yy_accept[2767] = { 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 8, 11, 13, 15, 18, 22, 25, 28, 31, 34, 38, 43, 48, 53, 58, 60, 64, 68, 72, 75, 79, 82, 85, 88, 91, 94, 98, 101, 104, 107, 110, 114, 117, 120, 123, 126, 130, 133, 136, 139, 142, 146, 149, 152, 154, 158, 161, 165, 168, 170, 172, 175, 177, 180, 183, 185, 188, 191, 194, 197, 201, 204, 207, 211, 215, 219, 221, 225, 228, 231, 233, 237, 242, 248, 252, 256, 260, 261, 264, 267, 270, 274, 278, 280, 284, 288, 293, 297, 301, 305, 308, 312, 315, 319, 322, 325, 329, 331, 335, 338, 342, 346, 348, 350, 352, 354, 355, 356, 356, 357, 357, 358, 359, 361, 363, 364, 366, 367, 368, 368, 368, 369, 369, 370, 371, 373, 375, 377, 379, 383, 383, 385, 387, 391, 395, 399, 403, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 465, 467, 469, 471, 473, 475, 477, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 498, 501, 504, 506, 508, 510, 513, 515, 517, 519, 521, 523, 525, 528, 530, 532, 535, 537, 540, 543, 545, 547, 549, 551, 554, 556, 558, 560, 563, 565, 568, 570, 572, 574, 576, 578, 580, 583, 585, 587, 590, 592, 594, 596, 599, 601, 604, 606, 609, 611, 613, 615, 617, 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, 663, 665, 667, 669, 672, 674, 676, 678, 680, 683, 685, 687, 689, 691, 693, 695, 697, 699, 701, 702, 703, 705, 706, 706, 708, 709, 711, 713, 715, 716, 718, 719, 721, 722, 722, 723, 723, 724, 725, 725, 726, 726, 727, 727, 729, 730, 732, 733, 734, 736, 737, 739, 740, 741, 741, 742, 744, 745, 746, 747, 747, 748, 750, 751, 751, 752, 752, 753, 754, 754, 754, 755, 756, 756, 757, 757, 759, 760, 760, 760, 761, 761, 761, 762, 763, 764, 765, 766, 766, 767, 768, 769, 770, 771, 771, 772, 772, 772, 774, 775, 777, 779, 781, 783, 784, 785, 785, 787, 788, 789, 791, 793, 796, 799, 802, 805, 807, 811, 813, 813, 813, 814, 818, 819, 820, 821, 822, 823, 824, 826, 828, 830, 832, 834, 837, 839, 842, 844, 846, 848, 851, 853, 855, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 891, 893, 895, 897, 899, 901, 903, 906, 908, 910, 912, 914, 917, 919, 921, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 953, 955, 957, 959, 962, 964, 967, 970, 972, 975, 977, 979, 981, 983, 986, 988, 990, 992, 994, 996, 998, 1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, 1028, 1030, 1032, 1034, 1036, 1039, 1041, 1043, 1045, 1047, 1049, 1052, 1054, 1057, 1059, 1061, 1063, 1065, 1067, 1069, 1071, 1073, 1075, 1077, 1079, 1081, 1083, 1085, 1087, 1089, 1091, 1094, 1096, 1098, 1100, 1102, 1104, 1106, 1108, 1110, 1112, 1114, 1116, 1119, 1121, 1124, 1126, 1129, 1131, 1133, 1135, 1137, 1139, 1141, 1143, 1145, 1147, 1149, 1151, 1153, 1155, 1157, 1159, 1161, 1163, 1165, 1167, 1169, 1171, 1173, 1175, 1177, 1180, 1182, 1184, 1186, 1189, 1191, 1193, 1195, 1197, 1199, 1202, 1205, 1207, 1209, 1211, 1213, 1216, 1218, 1220, 1222, 1225, 1227, 1229, 1232, 1234, 1236, 1239, 1242, 1244, 1246, 1249, 1252, 1254, 1256, 1258, 1260, 1263, 1265, 1268, 1270, 1272, 1274, 1277, 1279, 1282, 1284, 1286, 1288, 1289, 1290, 1291, 1292, 1293, 1293, 1294, 1296, 1297, 1298, 1299, 1301, 1301, 1301, 1302, 1303, 1304, 1306, 1307, 1307, 1307, 1307, 1307, 1308, 1308, 1309, 1309, 1311, 1312, 1314, 1315, 1316, 1317, 1319, 1322, 1325, 1328, 1331, 1335, 1337, 1338, 1338, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1344, 1345, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1353, 1355, 1357, 1359, 1361, 1363, 1365, 1367, 1370, 1372, 1374, 1377, 1379, 1381, 1383, 1385, 1387, 1389, 1391, 1393, 1395, 1397, 1399, 1401, 1403, 1406, 1408, 1408, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1423, 1426, 1428, 1430, 1432, 1434, 1437, 1439, 1442, 1445, 1448, 1451, 1453, 1455, 1458, 1460, 1462, 1465, 1467, 1469, 1471, 1473, 1475, 1478, 1481, 1483, 1485, 1488, 1490, 1492, 1494, 1496, 1498, 1501, 1504, 1507, 1510, 1513, 1515, 1517, 1520, 1522, 1525, 1527, 1529, 1531, 1533, 1536, 1539, 1542, 1544, 1546, 1549, 1551, 1554, 1556, 1559, 1562, 1564, 1566, 1568, 1570, 1572, 1574, 1576, 1579, 1581, 1583, 1585, 1587, 1589, 1591, 1593, 1595, 1598, 1600, 1602, 1604, 1607, 1610, 1612, 1614, 1616, 1618, 1621, 1623, 1625, 1627, 1627, 1629, 1632, 1634, 1637, 1639, 1641, 1643, 1645, 1647, 1649, 1652, 1654, 1656, 1658, 1660, 1663, 1665, 1667, 1670, 1673, 1676, 1678, 1681, 1683, 1685, 1687, 1690, 1692, 1695, 1697, 1699, 1701, 1703, 1705, 1707, 1709, 1711, 1713, 1715, 1717, 1719, 1721, 1723, 1725, 1727, 1729, 1731, 1733, 1736, 1738, 1741, 1743, 1745, 1748, 1751, 1754, 1756, 1758, 1760, 1760, 1762, 1764, 1766, 1768, 1771, 1773, 1775, 1778, 1780, 1782, 1784, 1786, 1789, 1792, 1794, 1797, 1799, 1801, 1804, 1807, 1809, 1811, 1813, 1815, 1817, 1819, 1821, 1823, 1825, 1827, 1829, 1832, 1834, 1835, 1837, 1839, 1841, 1842, 1842, 1842, 1843, 1844, 1845, 1847, 1849, 1851, 1853, 1857, 1857, 1857, 1858, 1859, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1866, 1866, 1866, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1877, 1879, 1881, 1883, 1886, 1889, 1891, 1894, 1896, 1898, 1901, 1903, 1905, 1908, 1910, 1912, 1914, 1916, 1918, 1920, 1923, 1925, 1927, 1929, 1931, 1933, 1935, 1937, 1939, 1942, 1942, 1942, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1947, 1949, 1952, 1955, 1958, 1960, 1962, 1964, 1967, 1969, 1971, 1973, 1975, 1977, 1980, 1982, 1985, 1985, 1986, 1988, 1990, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2006, 2008, 2010, 2012, 2014, 2016, 2018, 2020, 2022, 2024, 2027, 2027, 2029, 2032, 2035, 2037, 2039, 2042, 2044, 2047, 2049, 2051, 2053, 2055, 2057, 2059, 2062, 2065, 2067, 2069, 2071, 2073, 2075, 2077, 2079, 2082, 2084, 2086, 2088, 2090, 2092, 2094, 2096, 2098, 2100, 2102, 2104, 2107, 2110, 2113, 2115, 2118, 2120, 2122, 2124, 2124, 2126, 2129, 2131, 2133, 2135, 2137, 2139, 2141, 2143, 2145, 2145, 2146, 2148, 2150, 2152, 2154, 2156, 2159, 2161, 2164, 2167, 2169, 2171, 2173, 2176, 2178, 2181, 2183, 2185, 2187, 2190, 2192, 2194, 2196, 2198, 2200, 2202, 2204, 2206, 2208, 2211, 2213, 2216, 2218, 2220, 2222, 2224, 2226, 2228, 2230, 2233, 2235, 2238, 2241, 2244, 2246, 2249, 2249, 2249, 2251, 2254, 2257, 2260, 2262, 2264, 2264, 2265, 2267, 2269, 2271, 2273, 2275, 2277, 2279, 2281, 2283, 2285, 2287, 2290, 2293, 2296, 2298, 2300, 2302, 2304, 2307, 2309, 2312, 2315, 2317, 2319, 2321, 2323, 2325, 2327, 2330, 2330, 2331, 2333, 2335, 2337, 2339, 2341, 2343, 2345, 2345, 2345, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2360, 2360, 2360, 2360, 2361, 2362, 2363, 2363, 2364, 2364, 2365, 2366, 2367, 2368, 2369, 2371, 2374, 2377, 2379, 2381, 2383, 2385, 2387, 2389, 2392, 2394, 2396, 2398, 2400, 2402, 2404, 2406, 2408, 2410, 2413, 2416, 2418, 2420, 2422, 2424, 2426, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2430, 2432, 2435, 2438, 2440, 2442, 2444, 2446, 2448, 2450, 2453, 2455, 2457, 2459, 2462, 2465, 2467, 2469, 2472, 2474, 2476, 2477, 2480, 2482, 2484, 2486, 2487, 2489, 2491, 2493, 2495, 2495, 2497, 2500, 2503, 2505, 2508, 2510, 2512, 2514, 2516, 2518, 2520, 2523, 2525, 2527, 2529, 2531, 2533, 2536, 2538, 2540, 2542, 2544, 2547, 2549, 2552, 2554, 2557, 2560, 2562, 2564, 2566, 2569, 2572, 2574, 2576, 2578, 2580, 2580, 2582, 2584, 2586, 2589, 2592, 2595, 2598, 2600, 2602, 2604, 2606, 2609, 2611, 2613, 2615, 2617, 2619, 2621, 2623, 2626, 2628, 2630, 2632, 2634, 2637, 2639, 2642, 2644, 2646, 2648, 2650, 2652, 2654, 2657, 2659, 2662, 2665, 2667, 2669, 2671, 2673, 2675, 2677, 2677, 2677, 2679, 2679, 2680, 2682, 2684, 2686, 2688, 2690, 2693, 2693, 2693, 2693, 2695, 2697, 2699, 2701, 2704, 2707, 2710, 2712, 2715, 2717, 2719, 2722, 2725, 2728, 2728, 2730, 2732, 2734, 2736, 2739, 2742, 2744, 2747, 2749, 2751, 2753, 2756, 2758, 2758, 2759, 2761, 2763, 2765, 2768, 2771, 2774, 2777, 2777, 2777, 2778, 2779, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2789, 2790, 2791, 2792, 2793, 2794, 2794, 2794, 2794, 2794, 2795, 2795, 2795, 2795, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2804, 2806, 2809, 2811, 2813, 2815, 2818, 2821, 2823, 2825, 2827, 2830, 2830, 2833, 2833, 2833, 2833, 2833, 2833, 2833, 2835, 2837, 2840, 2842, 2844, 2846, 2848, 2850, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2854, 2854, 2854, 2855, 2855, 2855, 2855, 2856, 2856, 2858, 2860, 2862, 2865, 2866, 2868, 2871, 2873, 2875, 2875, 2877, 2879, 2882, 2884, 2886, 2888, 2890, 2892, 2895, 2897, 2899, 2902, 2904, 2906, 2908, 2910, 2910, 2912, 2915, 2917, 2919, 2922, 2924, 2926, 2928, 2931, 2934, 2936, 2938, 2940, 2942, 2944, 2946, 2948, 2950, 2952, 2955, 2957, 2957, 2960, 2962, 2965, 2967, 2970, 2970, 2972, 2974, 2976, 2979, 2981, 2983, 2985, 2988, 2991, 2993, 2995, 2998, 3001, 3003, 3006, 3008, 3010, 3013, 3015, 3017, 3019, 3021, 3023, 3025, 3027, 3029, 3032, 3034, 3036, 3039, 3041, 3044, 3046, 3048, 3050, 3052, 3054, 3056, 3056, 3056, 3059, 3059, 3059, 3059, 3061, 3063, 3065, 3067, 3067, 3069, 3071, 3073, 3075, 3077, 3080, 3083, 3085, 3085, 3085, 3087, 3089, 3091, 3093, 3095, 3097, 3100, 3102, 3104, 3107, 3107, 3110, 3113, 3116, 3119, 3122, 3125, 3125, 3125, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3148, 3148, 3148, 3148, 3148, 3148, 3148, 3148, 3149, 3150, 3151, 3151, 3152, 3152, 3153, 3154, 3155, 3156, 3157, 3157, 3160, 3162, 3164, 3166, 3168, 3171, 3173, 3173, 3173, 3173, 3173, 3173, 3173, 3173, 3173, 3176, 3179, 3181, 3183, 3185, 3187, 3189, 3189, 3189, 3189, 3189, 3189, 3189, 3189, 3189, 3189, 3191, 3193, 3196, 3196, 3196, 3199, 3202, 3202, 3204, 3206, 3208, 3211, 3214, 3216, 3218, 3221, 3223, 3226, 3228, 3230, 3233, 3233, 3235, 3238, 3240, 3242, 3245, 3247, 3248, 3248, 3251, 3253, 3255, 3258, 3260, 3263, 3266, 3267, 3269, 3271, 3271, 3273, 3276, 3276, 3279, 3282, 3284, 3287, 3290, 3292, 3295, 3298, 3300, 3302, 3304, 3306, 3309, 3311, 3314, 3316, 3319, 3321, 3324, 3327, 3329, 3331, 3333, 3336, 3338, 3338, 3339, 3341, 3343, 3346, 3348, 3350, 3353, 3355, 3357, 3357, 3359, 3361, 3363, 3363, 3363, 3363, 3365, 3367, 3369, 3371, 3371, 3373, 3375, 3376, 3378, 3381, 3383, 3383, 3383, 3386, 3389, 3391, 3393, 3396, 3399, 3401, 3403, 3403, 3406, 3406, 3406, 3407, 3408, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3436, 3436, 3436, 3436, 3436, 3436, 3436, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3445, 3447, 3449, 3452, 3454, 3456, 3456, 3456, 3456, 3456, 3456, 3456, 3456, 3456, 3456, 3458, 3461, 3463, 3465, 3467, 3467, 3467, 3467, 3467, 3468, 3468, 3468, 3468, 3468, 3470, 3471, 3471, 3473, 3473, 3475, 3477, 3479, 3481, 3483, 3486, 3488, 3491, 3493, 3495, 3495, 3497, 3500, 3502, 3505, 3508, 3508, 3508, 3508, 3510, 3512, 3514, 3517, 3518, 3519, 3521, 3523, 3523, 3525, 3528, 3529, 3532, 3535, 3537, 3539, 3541, 3543, 3545, 3548, 3551, 3552, 3554, 3556, 3558, 3558, 3558, 3558, 3560, 3562, 3564, 3566, 3568, 3568, 3570, 3573, 3575, 3575, 3575, 3575, 3577, 3579, 3581, 3584, 3584, 3586, 3588, 3589, 3590, 3593, 3596, 3597, 3598, 3600, 3602, 3605, 3608, 3611, 3611, 3611, 3611, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3647, 3647, 3647, 3647, 3647, 3647, 3647, 3647, 3648, 3649, 3650, 3650, 3651, 3651, 3652, 3653, 3654, 3655, 3656, 3656, 3658, 3660, 3663, 3665, 3667, 3667, 3667, 3667, 3668, 3669, 3670, 3670, 3670, 3670, 3670, 3672, 3674, 3677, 3680, 3680, 3681, 3681, 3681, 3681, 3681, 3682, 3682, 3684, 3685, 3685, 3688, 3689, 3692, 3694, 3696, 3698, 3700, 3702, 3704, 3707, 3707, 3709, 3711, 3711, 3712, 3712, 3712, 3712, 3713, 3713, 3715, 3718, 3721, 3723, 3725, 3727, 3727, 3729, 3731, 3734, 3737, 3740, 3742, 3744, 3746, 3747, 3750, 3752, 3754, 3754, 3756, 3758, 3761, 3764, 3766, 3766, 3768, 3770, 3770, 3771, 3771, 3774, 3776, 3778, 3778, 3780, 3782, 3784, 3784, 3786, 3789, 3789, 3789, 3789, 3790, 3791, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3829, 3829, 3829, 3829, 3829, 3829, 3829, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3841, 3843, 3845, 3848, 3849, 3849, 3849, 3849, 3849, 3849, 3849, 3849, 3851, 3853, 3853, 3853, 3853, 3856, 3857, 3860, 3862, 3864, 3866, 3868, 3869, 3869, 3871, 3873, 3873, 3874, 3874, 3874, 3874, 3874, 3874, 3877, 3880, 3882, 3883, 3885, 3888, 3890, 3892, 3894, 3896, 3898, 3898, 3900, 3902, 3904, 3904, 3907, 3909, 3910, 3910, 3912, 3914, 3914, 3916, 3919, 3919, 3922, 3922, 3923, 3923, 3923, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3968, 3968, 3968, 3968, 3968, 3968, 3968, 3968, 3969, 3970, 3971, 3971, 3972, 3972, 3973, 3974, 3975, 3976, 3977, 3977, 3979, 3981, 3983, 3983, 3984, 3984, 3984, 3984, 3984, 3984, 3985, 3988, 3990, 3990, 3990, 3991, 3991, 3992, 3995, 3997, 3999, 4001, 4001, 4003, 4005, 4005, 4005, 4005, 4005, 4008, 4010, 4010, 4012, 4014, 4016, 4018, 4021, 4024, 4024, 4026, 4028, 4030, 4031, 4034, 4034, 4036, 4039, 4039, 4039, 4040, 4040, 4040, 4040, 4040, 4040, 4041, 4041, 4042, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4089, 4089, 4089, 4089, 4089, 4089, 4089, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4098, 4100, 4103, 4105, 4105, 4105, 4105, 4106, 4106, 4107, 4110, 4110, 4112, 4114, 4117, 4118, 4120, 4122, 4122, 4122, 4122, 4124, 4126, 4129, 4131, 4131, 4133, 4135, 4137, 4137, 4137, 4137, 4137, 4137, 4137, 4137, 4137, 4137, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4169, 4170, 4171, 4171, 4172, 4172, 4173, 4174, 4175, 4176, 4177, 4177, 4179, 4181, 4183, 4183, 4183, 4183, 4184, 4185, 4185, 4186, 4188, 4190, 4192, 4195, 4195, 4195, 4198, 4201, 4204, 4204, 4206, 4209, 4211, 4211, 4211, 4211, 4211, 4211, 4212, 4213, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4246, 4246, 4246, 4246, 4246, 4246, 4246, 4246, 4247, 4248, 4249, 4250, 4251, 4251, 4253, 4255, 4257, 4257, 4258, 4258, 4260, 4263, 4265, 4265, 4265, 4265, 4265, 4267, 4267, 4267, 4267, 4267, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4291, 4291, 4291, 4291, 4291, 4291, 4291, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4299, 4301, 4303, 4304, 4305, 4307, 4309, 4309, 4310, 4313, 4313, 4313, 4313, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4339, 4339, 4339, 4339, 4340, 4341, 4342, 4344, 4347, 4350, 4353, 4356, 4357, 4357, 4357, 4357, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4363, 4363, 4363, 4363, 4364, 4365, 4366, 4368, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4379, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4389, 4389, 4390, 4391, 4393, 4393, 4396, 4397, 4397 } ; static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8, 9, 10, 9, 11, 12, 13, 14, 9, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 9, 9, 9, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 9, 90, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 } ; static const YY_CHAR yy_meta[91] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 13, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 12, 19, 9, 19, 20, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 9, 25, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 26, 27 } ; static const flex_int16_t yy_base[2984] = { 0, 0, 0, 89, 99, 110, 200, 290, 380, 470, 560, 650, 740, 830, 920, 129, 156, 1009, 1073, 170, 244, 143, 218, 3743,19096, 238,19096, 3698, 90, 1138, 102, 19096, 87, 202, 122, 1221, 254, 288, 305, 3700, 132, 147, 162, 1293, 1360, 1430, 1500, 1570, 1640, 1711, 1760, 1809, 362, 363, 1858, 1907, 384, 1961, 2010, 456, 2059, 2113, 2164, 472, 473, 153, 0, 122,19096, 232,19096, 258, 330, 334, 0, 0, 0, 348, 283,19096, 0, 0, 0, 3680, 317, 3664, 352, 235, 2245, 416, 345, 459, 2335,19096,19096, 0, 369, 512,19096, 0,19096, 19096, 0, 0, 0, 0, 595,19096, 579, 613, 599, 630,19096,19096,19096, 431, 448, 640, 41, 3660, 680, 19096, 686, 665,19096,19096, 0, 176, 407, 185, 692, 19096, 3664,19096, 238, 92,19096, 2425, 2515, 2605, 2695, 176, 3632, 0, 3648,19096, 241, 495, 683, 191, 3619, 253, 728, 2778, 91, 710, 2850, 755, 765, 702, 3598, 2901, 265, 282, 355, 3579, 786, 850, 725, 151, 314, 356, 0, 375, 452, 685, 860, 460, 474, 879, 939, 781, 480, 1002, 770, 497, 760, 554, 573, 2953, 1119, 567, 605, 822, 625, 913, 628, 730, 711, 726, 758, 901, 1001, 816, 769, 907, 787, 810, 3591, 3588, 809, 871, 812, 1004, 0, 918, 832, 921, 856, 871, 910, 0, 905, 933, 1127, 921, 0, 3578, 939, 941, 936, 955, 940, 947, 944, 1022, 0, 1131, 3566, 3558, 1143, 1013, 976, 1053, 988, 0, 1015, 1030, 1049, 1048, 1353, 1054, 0, 1069, 1072, 1109, 1065, 1284, 1110, 1056, 1284, 1273, 1083, 1126, 1286, 1147, 3007, 1330, 1141, 1356, 1171, 1382, 1172, 1273, 1294, 1354, 1293, 1362, 1299, 1282, 1292, 1341, 1345, 1406, 1358, 1358, 1361, 1392, 1404, 1407, 1421, 1419, 1446, 1418, 1464, 1421, 1416, 1442, 1469, 1445, 1450, 1472, 0, 454, 642, 1044, 3562, 0,19096, 1577, 1595, 1627, 1657, 1674, 1111, 1547, 1739, 3564, 0, 3559, 1753, 754, 3521, 0, 3468, 3416, 0, 1450, 1059, 1512, 1569, 0, 3089, 3179, 1618, 1663, 0, 3409, 1795, 1610, 1802, 0, 3269, 3359, 0, 1520, 0, 3429, 0, 3395, 0, 1903, 0, 0, 1915, 1711, 3385, 2000, 3372, 1964, 1116, 1217, 1564, 1844, 1500, 3355,19096, 2018, 2192, 0, 1781, 2014, 1697, 1935, 0, 262, 624, 3362, 980, 3335, 313, 19096, 338, 3449, 3539, 3629, 3719, 3311, 0, 602,19096, 1635, 1770, 3304, 3269, 2261, 2276, 2291, 2335, 2045, 3802, 2306, 3277, 3247, 3873, 3195, 2202, 3925, 2245, 2350, 2358, 2366, 2381, 3977, 2392, 1513, 1759, 1499, 1808, 1515, 1851, 1719, 1811, 356, 1914, 1818, 1532, 1916, 2440, 1762, 1919, 2009, 1971, 1567, 2012, 2049, 2013, 2056, 2047, 2103, 2064, 2067, 2127, 2111, 2115, 2117, 1922, 2477, 2128, 2160, 2512, 2405, 2403, 2412, 2247, 2497, 2408, 1577, 2166, 2439, 2409, 2511, 2513, 2509, 2521, 2502, 2520, 2577, 2519, 2583, 2571, 1592, 2584, 2582, 2585, 1594, 2507, 1639, 1698, 2597, 1755, 2593, 2602, 2003, 2603, 1770, 2604, 2208, 1852, 2638, 2640, 1810, 2601, 2642, 2643, 2650, 2682, 2662, 2687, 2692, 2470, 2710, 2688, 2693, 2689, 2696, 2694, 1838, 2705, 2863, 2862, 2912, 2836, 2697, 2916, 2840, 2938, 1892, 2950, 2952, 2698, 2352, 2858, 2826, 2951, 2918, 2955, 2961, 2954, 2959, 2960, 2605, 3000, 3003, 3004, 3013, 3012, 3072, 2592, 3067, 2719, 3070, 3073, 1909, 3071, 3081, 3084, 2860, 3091, 3130, 3171, 3089, 3106, 3162, 3173, 3174, 3132, 3177, 1956, 3180, 3178, 3186, 3187, 2054, 2249, 3194, 2262, 3248, 3183, 3261, 3237, 3129, 3247, 3250, 3351, 3090, 3269, 3265, 2378, 2962, 3270, 3305, 2440, 3196, 3263, 3336, 3358, 3286, 2524, 3433, 3359, 3354, 3284, 3375, 2710, 3366, 3353, 3376, 3416, 3338, 3423, 3424, 3431, 3436, 3430, 3016, 3449, 3442, 3128, 3182, 3448, 3415, 3476, 3220, 3271, 3466, 3485, 3484, 3308, 3506, 3355, 3515, 3451, 3517, 3491, 3521,19096,19096, 3173,19096, 3156, 3114, 3572, 4048, 3575,19096, 3577, 3118, 4138, 3060, 3036, 19096,19096, 0,19096, 1703, 3519, 0, 0, 3610, 3061, 3643, 3051, 0,19096, 0,19096, 3594, 3605, 3660, 3675, 3716, 3734, 3749, 3953, 3574,19096, 3021, 2991, 4212, 2923, 3690, 2468, 3764, 3772, 3780, 4263, 3894, 3902, 4006, 0, 104, 2999, 0, 3621, 4040, 3552, 3635, 4027, 3633, 3553, 3547, 3579, 3863, 3860, 4049, 4043, 4048, 3911, 3708, 3862, 3968, 3916, 3975, 4045, 4057, 4051, 4064, 4065, 3584, 3965, 4122, 4327, 4106, 4117, 4119, 4122, 4136, 4115, 4138, 3736, 4169, 4133, 4220, 4270, 3861, 3913, 3914, 4170, 3964, 3966, 4171, 4221, 4029, 4172, 4137, 4266, 4251, 4271, 4264, 4318, 4279, 4044, 4139, 4155, 4283, 421, 4316, 4276, 4311, 4313, 4321, 4223, 4329, 4323, 4381, 4232, 4364, 4360, 4372, 4336, 4281, 4378, 4379, 4383, 4384, 4317, 4330, 524, 4388, 4397, 4385, 4443, 4373, 4418, 4386, 4399, 4433, 4406, 4427, 4457, 4440, 4437, 4439, 562, 4441, 4450, 4444, 4459, 4446, 4448, 4449, 4455, 4464, 4490, 4485, 4495, 4476, 4483, 4501, 4499, 4492, 4500, 4503, 4508, 4507, 4518, 4548, 4517, 4506, 4534, 4513, 4548, 4553, 4549, 4540, 4556, 4561, 4602, 4559, 4550, 4580, 4593, 4566, 4568, 4583, 4611, 4591, 4596, 4606, 4598, 4599, 4607, 4614, 4610, 4619, 4647, 4616, 4623, 4641, 4656, 4649, 4646, 4657, 4663, 4660, 4665, 4669, 4668, 4681, 4693, 4695, 4691, 4703, 4705, 4707, 4712, 4709, 4711, 4719, 4726, 4721, 4729, 4735, 4727, 4757, 4759, 4800, 4753, 4751, 4761, 4773, 4843, 4775, 4791, 4770, 4807, 4793, 4809, 4781, 4792, 4797, 4823, 4827, 4834, 4829, 4811, 4835, 4841, 4847, 4849, 4855, 4860, 4830, 4886, 4888, 4867, 4887, 4871, 4891, 4873, 19096, 0, 0, 0,19096, 1897, 4896,19096, 2548, 1513, 654, 4950, 4965, 4980, 4995, 2982, 2936, 5049, 5100, 5003, 5019, 5029, 0, 126, 2936, 0, 5037, 2933, 5072, 5082, 5123, 5151, 5131, 5203, 5172, 5180, 2871, 2879, 0, 2866, 5191, 5137, 5091, 5192, 4893, 5193, 5194, 4895, 5211, 4907, 4908, 5205, 4993, 4923, 5206, 4909, 5141, 5212, 5213, 5255, 5243, 5244, 5237, 5245, 5247, 5248, 5251, 5262, 5263, 4939, 4955, 0,19096, 5026, 5047, 5040, 5284, 5078, 5097, 5275, 5264, 5090, 5139, 5260, 5301, 5310, 5305, 5140, 5312, 5311, 5309, 5315, 5320, 5249, 5317, 5303, 3059,19096, 5318, 5322, 5348, 5352, 5326, 5360, 5361, 5359, 5368, 3346, 5369, 5357, 5374, 5370, 5412, 5376, 5401, 5384, 5414, 5378, 5380, 5411, 5391, 5404, 5419, 5422, 5416, 5426, 5424, 5423, 5432, 5425, 5456, 5449, 5431, 5437, 5438, 5462, 5464, 5470, 5475, 5493, 5480, 5483, 5469, 5487, 5481, 5495, 5507, 5513, 5522, 5520, 5531, 5492, 5528, 5534, 5533, 5535, 5537, 5539, 5538, 5541, 5545, 5569, 5540, 5571, 5555, 5575, 5580, 5585, 5587, 5586, 5593, 5589, 5595, 3662,19096, 5611, 5596, 5613, 5633, 5627, 5565, 5636, 5605, 5606, 5641, 5623, 5651, 5650, 5645, 5646, 5672, 5654, 5661, 5648, 5660, 5676, 5669, 5681, 5711, 5691, 5694, 5697, 5695, 5696, 5699, 5706, 5717, 5713, 5718, 5712, 5719, 5734, 5745, 5722, 5750, 5727, 5736, 5752, 5754, 5753, 5755, 5752, 5759, 5760, 5762, 5832, 5772, 5767, 5840,19096, 5847, 5804, 5785, 5817, 5819, 5823, 5816, 5826, 5825, 5836, 5837, 5851, 5895, 5890, 5857, 5841, 5882, 5871, 5869, 5887, 5881, 5883, 5885, 5893, 5888, 5903, 5902, 5909, 5889, 2163, 5894, 821, 901, 4236, 5962, 5977, 5992, 6007, 2730, 2666, 2635, 6024, 6013, 6045, 6033, 6055, 6075, 6096, 6127, 6104, 6148, 6084, 2620, 0, 2560,19096, 6156, 6179, 6189, 6199, 6206, 6216, 6226, 6235, 6244, 6265, 6273, 6296, 0, 378, 2550, 6272, 5905, 5920, 5937, 6281, 6117, 5951, 6282, 6283, 5935, 6284, 6089, 6285, 6114, 6304, 6298, 6374, 6287, 6234, 6290, 6115, 6302, 6307, 6339, 6116, 6315, 6330, 6239, 6237, 6279, 6295, 6309, 6347, 6377, 6382, 6386, 6356, 6363, 6347, 6351, 6367, 6382, 6434, 6399, 6360, 6409, 6425, 6414, 6417, 6423, 6361, 6436, 6431, 6412, 6418, 6427, 6435, 463, 6439, 6440, 6467, 6453, 628, 6470, 6466, 6484, 6477, 6461, 6483, 6485, 6487, 6493, 6490, 6498, 6502, 6520, 6497, 6500, 6532, 6507, 6530, 6537, 6509, 6550, 6534, 6535, 6542, 6546, 6539, 6552, 6545, 6558, 6548, 6569, 6578, 6555, 6573, 6619, 6593, 6570, 6591, 6595, 6592, 6600, 6601, 6608, 6613, 6608, 6606, 6618, 6609, 6640, 6623, 6631, 6636, 6625, 6653, 6644, 6651, 6658, 6659, 6663, 6661, 6666, 6671, 6664, 6710, 6704, 6689, 6712, 6681, 6713, 6694, 6711, 6703, 6714, 6717, 6716, 6719, 6720, 6724, 6721, 6728, 6747, 6763, 6762, 6756, 6765, 6768, 6756, 6775, 6773, 6849,19096, 6853, 6770, 6801, 6771, 6774, 6775, 3810, 6779, 3964, 6819, 6820, 6821, 6831, 6793, 6805, 6823, 6841, 6835, 6829, 6846, 6836, 6842, 6843, 6853, 6859, 6877, 6884, 6868, 6887, 6851, 6889, 6863, 6891, 6890, 6898, 6881, 6903, 2957,19096, 970, 1095, 1183, 6957, 6973, 6989, 7005, 2520, 2477, 7021, 7072, 7042, 7050, 7095, 0, 416, 2454, 0, 7104, 7123, 7133, 7143, 7164, 7172, 7195, 0, 470, 2452, 2450, 7205, 7215, 7225, 7233, 2404, 7243, 7253, 7263, 7272, 7293, 7324, 7301, 7345, 6113, 2393, 0, 2391, 6871, 6899, 6901, 7006, 6951, 7330, 6917, 6931, 7010, 6947, 7337, 6945, 6951, 6979, 7133, 7011, 7006, 7065, 7053, 7047, 7130, 7258, 7131, 7259, 7336, 7314, 7311, 7132, 7260, 7263, 7303, 7337, 7337, 7323, 7343, 901,19096, 7404, 1154,19096, 7343, 1524, 1670,19096, 7342, 7358, 7355, 7372, 7356, 7411, 7413, 7426, 7379, 7396, 7394, 7398, 7399, 7440, 7406, 7393, 7407, 7410, 7437, 7414, 7434, 7429, 7416, 7449, 7452, 7453, 7471, 7462, 7457, 7456, 7474, 7479, 7462, 7475, 7476, 7484, 7544, 7465, 7487, 7531, 7510, 7492, 7520, 7529, 7530, 7533, 7534, 7509, 7543, 7520, 7532, 7536, 7537, 7542, 7545, 7537, 7548, 7556, 7578, 7550, 7595, 7583, 7581, 7592, 7587, 7594, 7590, 7591, 7597, 7598, 7599, 7608, 7629, 7625, 7611, 7658, 7639, 7642, 7641, 7644, 7657, 7647, 7656, 7666, 7678, 7734, 7646, 7652, 7686, 7672, 7687, 7726, 7700, 7718, 7677, 7711, 7711, 7765, 7704, 7786, 7732, 7750, 7753, 7759, 7708, 7754, 7764, 7784, 7771, 7772, 7758, 7768, 7776, 7770, 7782, 7790, 7794, 7808, 7811, 7820, 7799, 7792, 7803, 7816, 7814, 3010, 7873, 7888, 7904, 7920, 7936, 7952, 2372, 2357, 2295, 7969, 7990, 7998, 7881, 8021, 8030, 8051, 8082, 8059, 8103, 7896, 2302, 0, 2286, 8133, 8111, 8185, 8154, 8162, 7912, 2271, 0, 2222, 8206, 8216, 8237, 8247, 8253, 8263, 8273, 8283, 8290, 8300, 8310, 8319, 8328, 8349, 8357, 8380, 0, 611, 2219, 7818, 8399, 8454, 7946, 7913, 7958, 7959, 8024, 7959, 7947, 8008, 8373, 8008, 8008, 8014, 8034, 8071, 8072, 8122, 8370, 8375, 8123, 8371, 8074, 8060, 8072, 1767, 8121, 8121, 8151, 2021, 2027, 8428, 8322, 8175, 8168, 8384, 8177, 8320, 8165, 8381, 8398, 8359, 8383, 8385, 8406, 8437, 8438, 8450, 8439, 8430, 8461, 8386, 8443, 8463, 8453, 8465, 8474, 8505, 8487, 750, 335, 8471, 8510, 8496, 8497, 8498, 8520, 8501, 2211, 8512, 8508, 8503, 8511, 8519, 8488, 8509, 8513, 8523, 1198, 8528, 8544, 8545, 8553, 8554, 8556, 8581, 8564, 8565, 8566, 8567, 8592, 8568, 8578, 8571, 8572, 2650, 8577, 8599, 8581, 8589, 8651,19096, 8658, 8615, 8604, 8622, 8629, 8612, 8635, 8646, 8616, 8645, 8650, 8647, 8641, 8633, 8644, 8662, 8669, 8681, 8684, 8656, 8673, 8687, 2157, 8695, 8671, 8697, 8673, 8685, 8701, 8706, 8704, 8708, 8705, 8711, 8727, 8728, 3759, 2119, 2083, 2022, 8793, 8844, 8778, 8814, 8824, 0, 788, 2000, 0, 8866, 8876, 8895, 8905, 8926, 8934, 8957, 0, 982, 1881, 8966, 8976, 8986, 8996, 9017, 9025, 9048, 0, 1207, 1854, 9057, 9066, 9075, 9084, 1815, 9094, 9104, 9114, 1746, 9124, 9134, 9144, 9153, 9174, 9205, 9182, 9226, 8770, 1739, 0, 1712, 8711, 9266, 8788, 9324, 9224, 8725, 8712, 8781, 8786, 8777, 8788, 8822, 8820, 8897, 8824, 9210, 8882, 9226, 8883, 8977, 9252, 9253, 8887, 2500,19096, 8974, 2666, 8980, 924, 9234, 799, 8975, 9264, 8983, 9282, 9129, 9271, 9267, 9294, 9134, 9308, 9130, 9132, 9307, 9147, 9314, 9157, 9317, 9236, 9182, 4048, 9298, 9365, 9347, 9316, 9340, 9319, 0, 1707, 9347, 9341, 9215, 9355, 9240,19096, 9356, 9266, 9357, 9351, 9396, 9364, 9368, 1429, 9366, 1122, 9372, 9389, 9400, 7873, 9368, 9453, 9411, 9404, 9414, 9425, 9415, 9409, 9423, 9413, 9420, 9429, 9438, 9438, 9430, 9435, 9441, 9432, 9448, 9468, 9456, 0, 1701, 9448, 9457,19096, 9466, 9472, 9473, 9465, 9467, 9469, 4217, 1679, 1672, 1670, 9539, 9560, 9568, 9548, 9591, 9600, 9621, 9652, 9629, 9673, 9576, 1667, 0, 1656, 9703, 9681, 9755, 9724, 9732, 9609, 1647, 0, 1630, 9806, 9776, 9858, 9784, 9827, 9637, 1599, 0, 1584, 9836, 9880, 9889, 9909, 9917, 9927, 9937, 9947, 9953, 9963, 9973, 9983, 9990,10000,10010,10019,10028,10049,10057, 10080, 0, 1386, 1561, 9642,10099,10081,10159, 9647, 9644, 9645, 9648, 9649,19096, 9679,19096, 9684, 9695, 9683, 9697, 9694, 9717, 0, 0, 2893,19096, 9741, 9734, 9735, 3476, 19096, 3510, 9734, 1517, 9742, 0,19096, 0, 9781, 9797, 9783, 9788, 9792, 4941, 0, 9788, 9834, 9846,10105,19096, 10106,10107,10128,19096,10122,10105, 0, 0, 0, 9852, 9842, 9853,10018,10152, 1543, 0, 0,10137,10008,10020, 1589, 0,10017,10014,10013,10081,10086, 0, 0,10101, 10096,10105,10113,10141,19096,10132, 0,10160,10141,10162, 10151,10145, 0,10148,10142, 0, 9540, 1517, 1462,10216, 10267,10237,10245,10290, 0, 1498, 1442, 0,10299,10318, 10328,10338,10359,10367,10390, 0, 1887, 1433,10399,10409, 10419,10429,10450,10458,10481, 0, 1911, 1398,10490,10500, 10510,10520,10541,10549,10572, 0, 1922, 1385,10581,10590, 10599,10608,10617, 1374,10627,10637,10647, 1372,10657,10667, 10677,10686,10707,10738,10715,10759,10194, 1331, 0, 1318, 10149,10799,10189,10872,10149,10192,10207,10193,10189,10197, 10197,10264,10253,10247,10745,10330, 3516, 3638,10314,19096, 10315,10318,10736,10317,10767, 4991,10405,10757,10787,10809, 19096,10781, 3648,10411, 3663,10412, 1578,10408,10788,10410, 10500, 1767,10825,10496,10666,10498,10810,10512,10664,10818, 10713,10678,10665,10800,19096,10734,10790,10717,10779,10905, 10791,10787,10793,10909,19096, 1284, 1187,10969,11021,10917, 10925,10907,10940,11072,10948,11124,10956,10990,10978, 1105, 0, 1093,11175,10998,11227,11042,11050,11006, 1031, 0, 1010,11278,11093,11330,11101,11145,11030, 1008, 0, 984, 11381,11153,11433,11196,11204,11058, 893, 0, 839,11249, 11258,11300,11309,11351,11361,11404,11414,11454,11464,11485, 11495,11502,11512,11522,11531,11540,11561,11569,11592, 0, 2147, 811,10803,11611,11593,11686,10815,19096,10845,10842, 10880,10903,10910,19096,11062,11063,11064, 4068,19096, 4259, 19096,11065,11583,11584,11586, 5028,11592,11114, 4467,11057, 4703, 4813,11067,11374,11075,11593,11616,11610,11616,11115, 11116,11104,11169,11624,11166,19096,11168,11162,11682,11193, 11566,11704,19096, 789, 149,11706,11716,11287,11736, 651, 11787, 0,11757,11767, 0, 2192, 778, 0,11809,11819, 11838,11848, 0,11869,11879, 0, 2208, 766,11899,11909, 11919,11929, 0,11950,11960, 0, 2408, 743,11980,11990, 12000,12010, 0,12031,12041, 0, 2483, 721,12061,12071, 12081,12091, 0,12112,12122, 0, 2546, 700,12142,12151, 12160,12169,12178, 698,12188,12198,12208, 672,12218,12228, 12238,12247,12268,12299,12276,12320,11339, 623, 0, 581, 11222,12360, 1958,12424,11223,11207,11206,19096, 1737, 2070, 12331, 4942,12332,12333,12336, 5813,12347,12390, 5245,11357, 11377,12396,11663,12349,12397,11379,12413,12427,12356,12273, 12302, 558,12328, 525, 521,12491, 0, 2747, 1143,12501, 12522,12552,12530,12603, 0, 529,12654,12573,12705, 0, 499,12756,12581,12807, 0, 474,12858,12624,12909, 0, 472,12960,12632,13011, 0, 447,12676,12685,12727,12736, 12777,12787,12830,12477,12838,12881,12891,12932,12939,12982, 12992,13032,13062, 0,13040,13085, 0, 2757, 438,11368, 13123,13184,11680,11386,11404,11425,19096,19096, 5511,19096, 11530,12366,11726,11422,11423,11420,11594, 2086,11614,11623, 13115,11724,11839, 404,13144,13154,13208, 379,13238,13217, 1209,13289,13184, 0,13260,13270,13311,13340,13228,13321, 13362,13372,13391,13412,13421,13442,13452,13462,13483,13492, 13513,13523,13533,13554,13563,13584,13594,13604,13625,13634, 13655,13664,13673,13682, 361,13692,13702,13712, 264,13722, 13732,13742,13751,13772,13802, 0, 241,11718,11727,11916, 12341,11769,19096,11773,12001,11778,12082,11832,11830,12527, 12578,13762,13786,13826,13836,13854, 187,13861,13882,13912, 13890, 0,13963,13933, 0,14014,13941, 0,14065,13984, 0,14116,13992, 0,14167,14035, 0,14044,14087,14096, 14138,14146,14190,14200,14219,14225,14235,14245,14255,14262, 14272,14282,14292,14313,19096,12594,12289,11918,19096,19096, 14157,14298,11842,19096,11920, 177,14351,14362,14372,14381, 14322, 0,14403,14412,14432,14441,14450,14459,14468,14477, 14486,14495,14504,14513,14522,14531,14540,14549,14558,14567, 14576,14585,14594,14603,14612, 90,14622,14632,14642,14651, 14672, 0,14665,11998,11999,12000,12079,12070,14701,14718, 14728,14689,14737,14746,14755,14764,14773,14782,14790,14800, 14810,14820,14827,14836,14845,14830,12070,14855,14866,14884, 14895,14904,14913,14922,14931,14940,12234,12245,14949,14958, 14967,14976,14985,14994,15003,15012,12996,12282,15021,15030, 13071,12280,12288,19096,19096,15056,15083,15110,15137,15164, 15191,15218,15245,15272,15299,15326,15353,15373,15398,15418, 15443,15470,15497,15520,15540,15561,15584,15604,15625,15652, 15679,15706,15733,15760,15787,15814,15837,15856,15873,15889, 15907,15925,15950,15977,16004,16030,16047,16074,16101,16128, 16155,16182,16209,16236,16263,16290,16317,16337,16355,16373, 16398,16425,16445,16463,16481,16499, 9518,16524,16551,16578, 16605,16628,16648,16669,16692,16712,16733,16760,16787,16814, 16841,16868,16895,16922,16949,16976,17003,17030,17057,17084, 17111,17138,17165,17188,17207,17224,17241,17259,17277,17302, 17329,17356,17383,17410,17436,17453,17480,17507,17534,17561, 17588,17615,17642,17669,17696,17723,17750,17777,17797,17815, 17840,17860,17878,17896, 2771,17914,17935,17958,17985,18012, 18039,18066,18093,18120,18147,18165,18190,18216,18233,18260, 18287,18314,18341,18361,18379, 6929, 7744, 209,18397,18422, 18449,18476,18502, 7850,10122, 689,18518,12465,12541, 875, 18528,18552,18562,18580,12592,12665, 1817, 2099,18604,12715, 12767, 2323,18614,18632,18657,18683,18708,18718,12817,12869, 2664, 3146, 3494,18736,18754,18779,18805,18830,12919,12971, 3508,18840,18858,18883,18909,18934,13073,13116, 4238, 4787, 5348, 5791,18944,18962,13126, 6754,18980,18998,13172,14878, 6809, 7629, 7854, 9287, 9417,19016,19034,13201,13248, 9510, 19052,19070,13299 } ; static const flex_int16_t yy_def[2984] = { 0, 2765, 1, 2766, 2766, 2767, 2767, 2768, 2768, 2769, 2769, 2770, 2770, 2771, 2771, 2772, 2772, 2773, 2773, 2774, 2774, 2775, 2775, 2765, 2765, 2765, 2765, 2765, 2776, 2777, 2778, 2765, 2779, 2778, 2780, 2765, 35, 35, 35, 2765, 2778, 2778, 2778, 35, 35, 44, 44, 44, 44, 35, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 57, 50, 50, 2778, 2781, 2765, 2765, 2781, 2765, 2782, 2783, 2783, 2784, 2785, 2786, 2765, 2765, 2765, 2787, 2788, 2789, 2790, 2790, 2790, 2765, 2791, 2792, 2793, 2794, 2795, 2796, 2765, 2765, 2797, 2798, 2798, 2765, 2799, 2765, 2765, 2800, 2801, 2802, 2803, 2765, 2765, 2804, 2805, 2803, 2765, 2765, 2765, 2765, 2765, 2806, 2765, 2765, 2807, 2765, 2765, 2807, 2808, 2765, 2765, 2809, 2765, 2810, 2811, 2765, 2765, 2812, 2765, 2813, 2814, 2765, 2815, 2816, 2817, 2815, 2818, 2819, 2820, 2821, 2765, 2822, 2818, 2818, 2823, 2824, 2825, 2826, 2765, 2827, 153, 153, 153, 153, 153, 153, 2765, 2818, 2818, 2818, 2826, 153, 153, 156, 156, 156, 156, 156, 156, 156, 2825, 153, 156, 156, 153, 153, 156, 156, 156, 156, 156, 156, 156, 156, 153, 189, 156, 156, 156, 156, 189, 156, 156, 156, 156, 156, 156, 189, 156, 156, 156, 156, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 2828, 2765, 2828, 2829, 2830, 2828, 2765, 2831, 2831, 2765, 2765, 2831, 2831, 2765, 2765, 2832, 2833, 2834, 2765, 2765, 2835, 2836, 2837, 2838, 2839, 2838, 2765, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2765, 2861, 2862, 2765, 2863, 2861, 2864, 2862, 2860, 2765, 2865, 2865, 2765, 2765, 2866, 2765, 2765, 2866, 2867, 2867, 2765, 2868, 2869, 2870, 2765, 2871, 2872, 2873, 2874, 2875, 2765, 2876, 2877, 2877, 2878, 2878, 2879, 2880, 2881, 2765, 2882, 2882, 2883, 2884, 2884, 2884, 2884, 2884, 2884, 2765, 400, 2765, 2885, 2765, 400, 2765, 2765, 407, 407, 409, 409, 400, 400, 400, 413, 413, 413, 413, 413, 413, 413, 413, 2886, 413, 413, 413, 413, 400, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 400, 413, 413, 400, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 400, 413, 413, 413, 413, 413, 413, 413, 413, 2886, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2886, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2886, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 2887, 2765, 2888, 2889, 2890, 2891, 2892, 2765, 2893, 2894, 2895, 2896, 2889, 2765, 2765, 2897, 2765, 2898, 2765, 2899, 2900, 2901, 2899, 2902, 2900, 2903, 2765, 2903, 2765, 2904, 2904, 2905, 2905, 2905, 2905, 2905, 413, 413, 2765, 2906, 2907, 2765, 669, 669, 671, 671, 2765, 2765, 2765, 2908, 676, 676, 679, 679, 676, 676, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2909, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2909, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2909, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2910, 2911, 2912, 2765, 2913, 2765, 2765, 2904, 2904, 2905, 2905, 2905, 2905, 413, 2914, 2915, 2765, 2765, 2916, 919, 919, 922, 922, 919, 919, 2765, 2765, 2765, 2765, 2765, 2765, 932, 2765, 934, 934, 936, 934, 932, 932, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 712, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2909, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2909, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 413, 413, 413, 413, 413, 2765, 2765, 2909, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2917, 2765, 2904, 2904, 2904, 2905, 2905, 2905, 2905, 2765, 2918, 2919, 2765, 1172, 1172, 1174, 1174, 2765, 1177, 2765, 1179, 1179, 1181, 1179, 1177, 1177, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2920, 1195, 1195, 1198, 1198, 1195, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 2765, 2765, 2921, 413, 413, 413, 413, 413, 2765, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2922, 2765, 2923, 2923, 2923, 2924, 2924, 2924, 2924, 2925, 2926, 2765, 2765, 2927, 1405, 1405, 1408, 1408, 1405, 1405, 2765, 2765, 2765, 2765, 2928, 1416, 1416, 1419, 1419, 1416, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1432, 2765, 1434, 1434, 1436, 1434, 1432, 1432, 2765, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 2765, 2765, 2765, 2765, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 2921, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 2765, 2765, 2765, 413, 413, 413, 413, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 2765, 2765, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, 2929, 2924, 2924, 2924, 2924, 2924, 2924, 2765, 2930, 2931, 2765, 1620, 1620, 1622, 1622, 2765, 1625, 2765, 1627, 1627, 1629, 1627, 1625, 1625, 2765, 1634, 2765, 1636, 1636, 1638, 1636, 1634, 1634, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2932, 1655, 1655, 1658, 1658, 1655, 2765, 2933, 2933, 2934, 1664, 1664, 1664, 1664, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1664, 1664, 1664, 2765, 2765, 1664, 1664, 2765, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 2765, 1664, 1664, 1664, 1664, 1664, 1664, 2765, 2765, 1664, 2934, 1664, 1664, 1664, 1664, 1664, 2935, 1664, 1664, 2765, 1664, 1664, 2765, 1664, 1664, 1664, 2934, 1664, 1664, 1664, 1664, 1664, 1664, 2934, 1664, 1664, 1664, 1664, 2934, 1664, 1664, 1664, 1664, 2934, 1664, 1664, 1664, 1664, 2765, 2765, 2934, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 2765, 1664, 1664, 1664, 2765, 2765, 2765, 1664, 1664, 1664, 1664, 2765, 1664, 1664, 2936, 1664, 1664, 1664, 2765, 2765, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 1664, 2937, 2938, 2939, 2940, 2765, 2765, 2941, 1806, 1806, 1809, 1809, 1806, 1806, 2765, 2765, 2765, 2765, 2942, 1817, 1817, 1820, 1820, 1817, 2765, 2765, 2765, 2765, 2943, 1827, 1827, 1830, 1830, 1827, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1846, 2765, 1848, 1848, 1850, 1848, 1846, 1846, 2765, 2944, 2945, 2944, 1858, 1858, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1858, 1858, 1858, 1858, 1858, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1858, 2765, 2765, 1858, 2765, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 2765, 1858, 1858, 1858, 1858, 1858, 2765, 2765, 2765, 2945, 1858, 1858, 1858, 2946, 2946, 1858, 1858, 2765, 1858, 1858, 2765, 1858, 1858, 1858, 1858, 2945, 1858, 1858, 2945, 1858, 2765, 1858, 1858, 1858, 2765, 2765, 2765, 1858, 1858, 1858, 1858, 1858, 2765, 1858, 1858, 1858, 2765, 2765, 2765, 1858, 1858, 1858, 1858, 2765, 1858, 1858, 2947, 2947, 1858, 1858, 2765, 2765, 1858, 1858, 1858, 1858, 1858, 2948, 2765, 2949, 2950, 2765, 1970, 1970, 1972, 1972, 2765, 1975, 2765, 1977, 1977, 1979, 1977, 1975, 1975, 2765, 1984, 2765, 1986, 1986, 1988, 1986, 1984, 1984, 2765, 1993, 2765, 1995, 1995, 1997, 1995, 1993, 1993, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2951, 2018, 2018, 2021, 2021, 2018, 2765, 2952, 2953, 2952, 2028, 2028, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2028, 2028, 2028, 2028, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2028, 2765, 2765, 2028, 2765, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2765, 2028, 2028, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2953, 2028, 2028, 2954, 2028, 2028, 2765, 2028, 2953, 2028, 2028, 2028, 2953, 2028, 2028, 2765, 2028, 2028, 2028, 2765, 2028, 2028, 2028, 2028, 2028, 2765, 2028, 2028, 2765, 2765, 2765, 2028, 2028, 2028, 2765, 2028, 2028, 2955, 2765, 2028, 2028, 2956, 2957, 2958, 2765, 2765, 2959, 2121, 2121, 2124, 2124, 2121, 2121, 2765, 2765, 2765, 2765, 2960, 2132, 2132, 2135, 2135, 2132, 2765, 2765, 2765, 2765, 2961, 2142, 2142, 2145, 2145, 2142, 2765, 2765, 2765, 2765, 2962, 2152, 2152, 2155, 2155, 2152, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2172, 2765, 2174, 2174, 2176, 2174, 2172, 2172, 2765, 2963, 2964, 2963, 2184, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2184, 2184, 2765, 2765, 2765, 2184, 2765, 2184, 2184, 2184, 2184, 2184, 2765, 2765, 2184, 2184, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2964, 2184, 2184, 2765, 2184, 2964, 2964, 2184, 2184, 2184, 2184, 2765, 2184, 2184, 2184, 2765, 2184, 2184, 2765, 2765, 2184, 2184, 2765, 2184, 2184, 2765, 2184, 2765, 2765, 2765, 2965, 2765, 2765, 2249, 2249, 2251, 2251, 2765, 2254, 2765, 2256, 2256, 2258, 2256, 2254, 2254, 2765, 2263, 2765, 2265, 2265, 2267, 2265, 2263, 2263, 2765, 2272, 2765, 2274, 2274, 2276, 2274, 2272, 2272, 2765, 2281, 2765, 2283, 2283, 2285, 2283, 2281, 2281, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2966, 2306, 2306, 2309, 2309, 2306, 2765, 2967, 2968, 2967, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2316, 2316, 2765, 2765, 2765, 2765, 2765, 2316, 2316, 2316, 2316, 2765, 2316, 2316, 2765, 2765, 2765, 2765, 2316, 2316, 2765, 2316, 2968, 2316, 2316, 2316, 2316, 2765, 2316, 2316, 2316, 2765, 2316, 2765, 2316, 2316, 2765, 2765, 2765, 2969, 2970, 2970, 2366, 2367, 2765, 2970, 2765, 2971, 2371, 2371, 2374, 2374, 2371, 2371, 2765, 2765, 2765, 2765, 2972, 2382, 2382, 2385, 2385, 2382, 2765, 2765, 2765, 2765, 2973, 2392, 2392, 2395, 2395, 2392, 2765, 2765, 2765, 2765, 2974, 2402, 2402, 2405, 2405, 2402, 2765, 2765, 2765, 2765, 2975, 2412, 2412, 2415, 2415, 2412, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2432, 2765, 2434, 2434, 2436, 2434, 2432, 2432, 2765, 2976, 2977, 2976, 2765, 2765, 2765, 2765, 2765, 2765, 2444, 2765, 2444, 2444, 2444, 2765, 2444, 2444, 2765, 2765, 2765, 2444, 2977, 2444, 2444, 2765, 2444, 2444, 2444, 2765, 2765, 2765, 2765, 2978, 2979, 2978, 2476, 2476, 2978, 2765, 2480, 2765, 2482, 2765, 2482, 2482, 2765, 2487, 2765, 2487, 2487, 2765, 2492, 2765, 2492, 2492, 2765, 2497, 2765, 2497, 2497, 2765, 2502, 2765, 2502, 2502, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2980, 2523, 2523, 2526, 2526, 2523, 2765, 2981, 2981, 2532, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2532, 2532, 2532, 2532, 2765, 2765, 2532, 2982, 2532, 2765, 2532, 2532, 2532, 2765, 2765, 2765, 2765, 2983, 2765, 2765, 2983, 2765, 2562, 2562, 2765, 2765, 2765, 2765, 2568, 2765, 2765, 2765, 2765, 2573, 2765, 2765, 2765, 2765, 2578, 2765, 2765, 2765, 2765, 2583, 2765, 2765, 2765, 2765, 2588, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2603, 2765, 2603, 2603, 2765, 2532, 2532, 2532, 2765, 2765, 2765, 2532, 2532, 2532, 2765, 2765, 2765, 2765, 2532, 2765, 2765, 2765, 2765, 2765, 2765, 2628, 2765, 2630, 2630, 2765, 2633, 2633, 2765, 2636, 2636, 2765, 2639, 2639, 2765, 2642, 2642, 2765, 2645, 2645, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2663, 2765, 2532, 2532, 2532, 2765, 2765, 2532, 2532, 2765, 2765, 2532, 2765, 2765, 2765, 2765, 2765, 2680, 2680, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2710, 2710, 2532, 2532, 2532, 2532, 2532, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2532, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2532, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2532, 2765, 2765, 2765, 2532, 2765, 2532, 2765, 0, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765 } ; static const flex_int16_t yy_nxt[19187] = { 0, 24, 25, 26, 25, 25, 27, 28, 29, 30, 31, 32, 25, 25, 30, 25, 33, 30, 34, 35, 36, 37, 38, 38, 38, 38, 38, 39, 25, 40, 41, 42, 30, 24, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 52, 59, 60, 61, 62, 63, 64, 52, 52, 52, 30, 65, 30, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 52, 59, 60, 61, 62, 63, 64, 52, 52, 52, 24, 24, 67, 68, 69, 67, 136, 70, 133, 145, 364, 71, 67, 68, 69, 67, 146, 70, 2729, 134, 402, 71, 24, 72, 73, 72, 72, 24, 74, 404, 142, 24, 76, 77, 77, 303, 77, 303, 303, 364, 932, 932, 106, 107, 106, 106, 143, 108, 24, 77, 150, 109, 110, 110, 24, 111, 127, 101, 101, 127, 142, 128, 1177, 1177, 382, 129, 143, 136, 110, 106, 107, 106, 106, 162, 108, 142, 143, 2473, 109, 110, 110, 142, 111, 120, 121, 120, 122, 2475, 163, 375, 142, 143, 375, 122, 122, 110, 120, 143, 379, 417, 112, 379, 113, 164, 142, 2719, 143, 374, 123, 122, 24, 24, 24, 72, 73, 72, 72, 24, 74, 150, 143, 24, 76, 77, 77, 2475, 77, 112, 417, 113, 142, 127, 101, 101, 127, 143, 128, 938, 24, 77, 129, 124, 938, 125, 24, 303, 143, 304, 303, 325, 325, 130, 132, 130, 130, 144, 381, 120, 121, 120, 122, 130, 130, 390, 130, 147, 148, 122, 122, 2522, 120, 306, 306, 330, 306, 375, 306, 130, 375, 331, 307, 165, 123, 122, 157, 157, 157, 157, 157, 157, 157, 157, 2656, 142, 147, 148, 321, 143, 321, 321, 24, 24, 24, 78, 79, 78, 78, 24, 80, 143, 142, 24, 82, 24, 24, 124, 24, 125, 158, 158, 158, 158, 158, 159, 160, 160, 143, 132, 24, 24, 327, 381, 327, 328, 24, 160, 160, 160, 160, 160, 160, 160, 160, 309, 310, 309, 309, 313, 314, 313, 313, 1905, 136, 311, 311, 326, 312, 315, 315, 418, 316, 312, 320, 312, 312, 328, 1906, 328, 328, 311, 1907, 312, 312, 315, 312, 338, 338, 338, 338, 338, 338, 338, 338, 142, 165, 344, 344, 312, 418, 2652, 24, 24, 24, 78, 79, 78, 78, 24, 80, 143, 143, 24, 82, 24, 24, 419, 24, 156, 156, 227, 382, 156, 228, 346, 1432, 1432, 229, 2475, 24, 24, 377, 156, 156, 377, 24, 374, 156, 156, 420, 156, 325, 325, 2623, 248, 419, 325, 156, 156, 227, 421, 156, 228, 249, 250, 360, 229, 360, 360, 251, 165, 156, 156, 1625, 1625, 335, 156, 156, 420, 156, 325, 336, 361, 248, 361, 361, 143, 2522, 303, 421, 303, 303, 249, 250, 325, 325, 2305, 1259, 251, 325, 1259, 24, 24, 83, 84, 85, 84, 86, 83, 83, 87, 83, 83, 83, 83, 83, 83, 83, 340, 83, 89, 2017, 264, 1654, 341, 265, 266, 1634, 1634, 90, 83, 83, 83, 83, 91, 24, 156, 422, 295, 298, 267, 156, 296, 299, 142, 426, 297, 300, 1194, 344, 344, 264, 156, 156, 265, 266, 301, 156, 156, 427, 143, 434, 92, 83, 83, 156, 422, 295, 298, 267, 156, 296, 299, 165, 426, 297, 300, 346, 675, 391, 2560, 156, 156, 442, 2475, 301, 156, 156, 427, 143, 434, 83, 83, 83, 84, 85, 84, 86, 83, 83, 87, 83, 83, 83, 83, 83, 83, 83, 391, 83, 89, 165, 442, 356, 356, 356, 356, 2248, 350, 90, 83, 83, 83, 83, 91, 24, 356, 143, 445, 351, 2305, 351, 351, 354, 352, 354, 354, 144, 353, 354, 354, 446, 354, 359, 359, 390, 354, 358, 358, 358, 358, 453, 92, 83, 83, 354, 350, 445, 377, 359, 358, 377, 1264, 653, 354, 1264, 354, 354, 1846, 1846, 446, 356, 2765, 356, 354, 354, 303, 354, 304, 303, 453, 83, 83, 93, 93, 94, 93, 95, 95, 454, 354, 363, 363, 363, 363, 363, 363, 363, 363, 370, 2765, 371, 370, 1165, 372, 358, 457, 358, 373, 97, 2475, 98, 459, 98, 367, 99, 367, 367, 454, 143, 367, 2515, 367, 368, 367, 367, 130, 367, 130, 130, 368, 368, 142, 367, 165, 457, 130, 130, 1183, 130, 367, 459, 98, 1183, 98, 366, 368, 2511, 143, 2305, 143, 152, 130, 405, 405, 405, 405, 405, 405, 165, 392, 401, 401, 401, 401, 401, 401, 401, 401, 423, 2017, 93, 100, 93, 93, 94, 93, 95, 95, 395, 396, 397, 398, 398, 398, 398, 398, 1722, 321, 392, 321, 321, 1654, 143, 1723, 415, 460, 461, 423, 97, 462, 98, 416, 98, 152, 99, 405, 405, 405, 405, 405, 405, 405, 405, 152, 1194, 405, 405, 405, 405, 405, 405, 405, 405, 415, 460, 461, 675, 463, 462, 443, 416, 98, 2054, 98, 165, 2054, 401, 401, 401, 401, 401, 401, 401, 401, 1975, 1975, 431, 2248, 439, 444, 432, 471, 440, 412, 433, 441, 463, 474, 443, 2305, 93, 100, 24, 24, 101, 24, 24, 24, 102, 142, 413, 24, 104, 24, 24, 431, 24, 439, 444, 432, 471, 440, 412, 433, 441, 143, 474, 2017, 24, 24, 475, 455, 469, 477, 24, 480, 470, 486, 165, 413, 401, 401, 401, 401, 401, 401, 401, 401, 165, 456, 401, 401, 401, 401, 401, 401, 401, 401, 414, 475, 455, 469, 477, 1438, 480, 470, 486, 165, 1438, 401, 401, 401, 401, 401, 401, 401, 401, 1476, 456, 478, 489, 2765, 479, 424, 425, 1477, 428, 414, 490, 142, 24, 24, 24, 24, 101, 24, 24, 24, 102, 429, 1883, 24, 104, 24, 24, 143, 24, 712, 478, 489, 464, 479, 424, 425, 465, 428, 472, 490, 24, 24, 491, 466, 401, 492, 24, 458, 473, 165, 429, 401, 401, 401, 401, 401, 401, 401, 401, 156, 493, 464, 484, 485, 156, 465, 487, 472, 488, 500, 502, 491, 466, 401, 492, 379, 458, 473, 379, 503, 142, 504, 505, 430, 655, 506, 507, 508, 156, 493, 509, 484, 485, 156, 1654, 487, 143, 488, 500, 502, 1984, 1984, 24, 24, 115, 101, 115, 115, 503, 116, 504, 505, 430, 116, 506, 507, 508, 524, 2765, 509, 1194, 117, 117, 117, 117, 117, 117, 117, 117, 435, 467, 481, 401, 436, 528, 482, 468, 437, 118, 306, 306, 2765, 306, 438, 306, 483, 524, 156, 307, 510, 529, 522, 156, 523, 328, 511, 328, 328, 435, 467, 481, 401, 436, 528, 482, 468, 437, 118, 115, 101, 115, 115, 438, 116, 483, 530, 156, 116, 510, 529, 522, 156, 523, 525, 511, 117, 117, 117, 117, 117, 117, 117, 117, 526, 533, 531, 538, 527, 532, 539, 544, 550, 118, 675, 530, 142, 314, 314, 314, 314, 540, 360, 525, 360, 360, 2765, 541, 2091, 556, 2765, 2091, 143, 526, 533, 531, 538, 527, 532, 539, 544, 550, 118, 135, 135, 136, 135, 135, 135, 135, 540, 542, 135, 135, 135, 135, 541, 135, 556, 138, 548, 401, 450, 1479, 2473, 549, 543, 494, 451, 135, 135, 1480, 452, 495, 2475, 139, 156, 512, 557, 496, 542, 156, 513, 497, 498, 560, 499, 518, 514, 548, 401, 450, 515, 519, 549, 543, 494, 451, 573, 520, 521, 452, 495, 140, 142, 156, 512, 557, 496, 579, 156, 513, 497, 498, 560, 499, 518, 514, 2248, 165, 143, 515, 519, 361, 584, 361, 361, 573, 520, 521, 2473, 135, 135, 151, 151, 143, 1993, 1993, 579, 151, 2475, 151, 152, 151, 153, 153, 153, 153, 153, 153, 153, 153, 154, 584, 151, 151, 151, 151, 143, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 151, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 165, 1969, 155, 155, 155, 155, 155, 155, 155, 155, 545, 551, 553, 558, 554, 555, 585, 590, 586, 166, 167, 552, 587, 595, 596, 2017, 546, 547, 168, 559, 169, 591, 170, 597, 171, 172, 173, 174, 2765, 545, 551, 553, 558, 554, 555, 585, 590, 586, 166, 167, 552, 587, 595, 596, 571, 546, 547, 168, 559, 169, 591, 170, 597, 171, 172, 173, 174, 165, 175, 155, 155, 155, 155, 155, 155, 155, 155, 534, 572, 2298, 598, 2294, 574, 571, 176, 588, 599, 592, 593, 589, 535, 575, 2017, 576, 603, 536, 537, 577, 594, 578, 604, 2172, 2172, 605, 177, 1654, 534, 572, 178, 598, 580, 574, 581, 176, 588, 599, 592, 593, 589, 535, 575, 582, 576, 603, 536, 537, 577, 594, 578, 604, 600, 583, 605, 177, 601, 606, 165, 178, 151, 580, 1194, 581, 327, 607, 327, 328, 608, 602, 609, 675, 582, 610, 143, 614, 179, 611, 618, 619, 180, 600, 583, 181, 182, 601, 606, 183, 620, 326, 184, 185, 623, 186, 607, 187, 156, 608, 602, 609, 188, 2248, 610, 612, 614, 179, 611, 618, 619, 180, 615, 613, 181, 182, 616, 624, 183, 620, 617, 184, 185, 623, 186, 621, 187, 156, 625, 325, 325, 188, 151, 2054, 612, 622, 2054, 2254, 2254, 344, 344, 615, 613, 1479, 142, 616, 624, 1164, 189, 617, 646, 1480, 190, 330, 621, 156, 191, 625, 1969, 331, 143, 192, 193, 316, 622, 316, 316, 346, 156, 156, 194, 156, 156, 316, 316, 2084, 316, 189, 687, 646, 645, 190, 645, 645, 156, 191, 631, 631, 156, 316, 192, 193, 2017, 309, 310, 309, 309, 156, 156, 194, 156, 156, 151, 311, 311, 2091, 312, 687, 2091, 165, 331, 313, 314, 313, 313, 1654, 331, 156, 155, 311, 195, 315, 315, 156, 316, 143, 701, 325, 325, 196, 2765, 197, 325, 156, 198, 325, 325, 315, 199, 200, 325, 201, 156, 312, 320, 312, 312, 155, 156, 195, 156, 340, 156, 312, 312, 701, 312, 341, 196, 335, 197, 1194, 156, 198, 325, 336, 142, 199, 200, 312, 201, 156, 151, 312, 320, 312, 312, 156, 2765, 156, 631, 631, 143, 312, 312, 631, 312, 675, 202, 1483, 313, 314, 313, 313, 657, 156, 203, 1484, 2765, 312, 315, 315, 204, 316, 336, 205, 206, 207, 156, 631, 336, 2120, 156, 1969, 650, 650, 315, 202, 369, 645, 1619, 645, 645, 657, 156, 203, 650, 356, 356, 356, 356, 204, 643, 2113, 205, 206, 207, 156, 650, 2079, 356, 156, 165, 1654, 156, 156, 156, 156, 156, 156, 156, 156, 208, 2537, 156, 316, 2537, 316, 316, 156, 209, 156, 156, 210, 156, 316, 316, 211, 316, 316, 2765, 316, 316, 650, 212, 156, 213, 2010, 214, 316, 316, 316, 316, 156, 691, 356, 1878, 356, 156, 209, 156, 156, 210, 156, 1879, 316, 211, 370, 165, 371, 370, 142, 372, 212, 156, 213, 373, 214, 215, 156, 697, 156, 216, 691, 143, 156, 156, 143, 156, 631, 631, 688, 217, 156, 631, 156, 156, 218, 338, 338, 338, 338, 338, 338, 338, 338, 658, 215, 156, 697, 156, 216, 635, 341, 156, 156, 2006, 156, 1631, 341, 688, 217, 156, 1631, 156, 156, 218, 156, 689, 219, 220, 156, 221, 222, 156, 658, 757, 156, 694, 223, 224, 156, 225, 692, 156, 226, 156, 363, 363, 363, 363, 363, 363, 363, 363, 1654, 156, 689, 219, 220, 156, 221, 222, 156, 774, 757, 156, 694, 223, 224, 156, 225, 692, 156, 226, 156, 230, 156, 156, 231, 232, 690, 1194, 1160, 233, 1160, 1160, 754, 234, 351, 235, 351, 351, 774, 352, 236, 2263, 2263, 353, 354, 354, 354, 354, 354, 354, 230, 156, 156, 231, 232, 690, 354, 354, 233, 354, 354, 754, 234, 156, 235, 2272, 2272, 652, 652, 236, 237, 238, 354, 239, 240, 369, 2281, 2281, 241, 652, 814, 693, 242, 695, 243, 156, 244, 156, 245, 246, 156, 652, 156, 156, 247, 354, 717, 354, 354, 237, 238, 698, 239, 240, 165, 359, 359, 241, 354, 814, 693, 242, 695, 243, 156, 244, 156, 245, 246, 156, 143, 359, 156, 247, 156, 717, 652, 833, 156, 252, 698, 358, 358, 358, 358, 253, 700, 254, 156, 255, 643, 256, 156, 156, 358, 371, 675, 371, 371, 367, 647, 367, 367, 156, 648, 1479, 833, 156, 252, 367, 367, 1483, 367, 1480, 253, 700, 254, 156, 255, 1484, 256, 156, 156, 257, 156, 367, 704, 258, 1969, 259, 156, 260, 702, 156, 156, 699, 750, 261, 262, 358, 263, 358, 156, 660, 660, 660, 660, 660, 660, 660, 660, 2538, 257, 156, 2538, 704, 258, 143, 259, 156, 260, 702, 156, 156, 699, 750, 261, 262, 156, 263, 156, 156, 268, 705, 703, 838, 269, 156, 706, 270, 271, 709, 165, 272, 273, 156, 156, 274, 156, 1619, 275, 276, 277, 710, 278, 1640, 279, 156, 143, 156, 1640, 268, 705, 703, 838, 269, 156, 706, 270, 271, 709, 711, 272, 273, 156, 156, 274, 156, 712, 275, 276, 277, 710, 278, 156, 279, 280, 714, 281, 707, 282, 143, 156, 283, 284, 708, 156, 285, 156, 286, 287, 719, 716, 715, 1160, 156, 1160, 1160, 156, 156, 288, 2432, 2432, 156, 1956, 280, 714, 281, 707, 282, 713, 156, 283, 284, 708, 156, 285, 156, 286, 287, 719, 716, 715, 367, 156, 367, 368, 156, 156, 288, 289, 156, 156, 368, 368, 290, 367, 156, 156, 713, 291, 720, 292, 729, 293, 294, 2482, 2482, 366, 368, 674, 674, 674, 674, 674, 674, 674, 674, 1913, 289, 156, 156, 2487, 2487, 290, 1654, 156, 156, 1194, 291, 720, 292, 729, 293, 294, 325, 325, 325, 325, 156, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 753, 333, 325, 679, 679, 679, 679, 679, 679, 679, 679, 326, 325, 325, 325, 325, 325, 659, 156, 660, 660, 660, 660, 660, 660, 660, 660, 2765, 156, 753, 839, 726, 659, 143, 661, 661, 661, 661, 661, 661, 661, 661, 675, 841, 325, 325, 325, 659, 143, 662, 662, 662, 662, 662, 663, 395, 395, 156, 2765, 839, 726, 1805, 165, 143, 665, 665, 665, 665, 665, 665, 665, 665, 841, 325, 325, 325, 325, 325, 325, 1852, 325, 325, 325, 325, 1852, 325, 325, 325, 325, 325, 325, 659, 325, 395, 395, 395, 395, 395, 395, 395, 395, 343, 325, 325, 325, 325, 325, 143, 680, 680, 680, 680, 680, 681, 682, 682, 682, 682, 682, 682, 682, 682, 2765, 1619, 683, 683, 683, 683, 683, 683, 683, 683, 789, 156, 325, 325, 325, 165, 1171, 665, 665, 665, 665, 665, 665, 665, 665, 1194, 165, 2765, 665, 665, 665, 665, 665, 665, 665, 665, 684, 156, 1647, 789, 156, 325, 325, 135, 135, 136, 135, 135, 135, 135, 2492, 2492, 135, 135, 135, 135, 722, 135, 723, 138, 686, 731, 156, 724, 156, 684, 156, 156, 156, 135, 135, 156, 728, 725, 165, 139, 665, 665, 665, 665, 665, 665, 665, 665, 1643, 722, 1194, 723, 675, 686, 731, 156, 724, 156, 730, 696, 156, 156, 156, 156, 156, 728, 725, 140, 925, 925, 925, 925, 925, 925, 766, 165, 767, 665, 665, 665, 665, 665, 665, 665, 665, 1619, 1878, 730, 696, 2497, 2497, 156, 156, 156, 1879, 135, 135, 135, 135, 136, 135, 135, 135, 135, 718, 165, 135, 135, 135, 135, 165, 135, 665, 665, 665, 665, 665, 665, 665, 665, 156, 143, 156, 135, 135, 156, 732, 721, 1171, 139, 727, 733, 156, 718, 156, 737, 156, 734, 736, 738, 746, 735, 156, 156, 156, 740, 142, 156, 1194, 156, 1162, 1163, 2502, 2502, 156, 732, 721, 384, 675, 727, 733, 156, 143, 156, 737, 156, 734, 736, 738, 746, 735, 156, 156, 156, 740, 165, 156, 665, 665, 665, 665, 665, 665, 665, 665, 135, 135, 135, 135, 136, 135, 135, 135, 135, 156, 809, 135, 135, 135, 135, 739, 135, 741, 743, 742, 156, 156, 156, 156, 744, 748, 745, 747, 135, 135, 156, 156, 749, 2765, 135, 156, 751, 752, 156, 156, 156, 156, 156, 156, 739, 758, 741, 743, 742, 156, 156, 156, 156, 744, 748, 745, 747, 801, 1404, 156, 156, 749, 386, 165, 156, 751, 752, 2050, 156, 156, 156, 156, 156, 1929, 758, 2051, 156, 1981, 156, 143, 156, 156, 1981, 755, 760, 756, 801, 759, 156, 1171, 135, 135, 135, 135, 136, 135, 135, 135, 135, 761, 156, 135, 135, 135, 135, 156, 135, 156, 138, 156, 156, 763, 755, 760, 756, 762, 759, 156, 135, 135, 156, 764, 765, 165, 139, 156, 156, 156, 761, 156, 156, 156, 156, 769, 156, 156, 156, 770, 771, 143, 763, 772, 773, 156, 762, 775, 788, 781, 156, 156, 764, 765, 140, 668, 156, 156, 156, 156, 768, 156, 156, 156, 769, 156, 156, 156, 770, 771, 2558, 2558, 772, 773, 156, 811, 775, 788, 781, 156, 2603, 2603, 135, 135, 151, 151, 667, 667, 156, 768, 151, 667, 151, 399, 151, 400, 400, 400, 400, 400, 400, 400, 400, 154, 811, 151, 151, 151, 151, 143, 401, 401, 401, 401, 401, 401, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 151, 401, 401, 401, 401, 401, 401, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 165, 156, 156, 156, 156, 156, 156, 156, 156, 156, 208, 156, 783, 791, 780, 156, 675, 156, 156, 156, 156, 156, 156, 1201, 1201, 1201, 1201, 1201, 1201, 2765, 156, 2045, 777, 156, 818, 156, 790, 156, 156, 2046, 156, 783, 791, 780, 156, 776, 156, 156, 156, 156, 156, 156, 406, 407, 408, 409, 410, 410, 410, 410, 410, 777, 156, 818, 156, 790, 156, 156, 411, 411, 411, 411, 411, 411, 776, 922, 922, 922, 922, 922, 922, 922, 922, 1187, 778, 782, 675, 156, 165, 793, 779, 156, 1610, 794, 1610, 1610, 1171, 411, 411, 411, 411, 411, 411, 165, 143, 401, 401, 401, 401, 401, 401, 401, 401, 778, 782, 858, 156, 785, 793, 779, 156, 786, 794, 784, 447, 156, 156, 156, 795, 156, 156, 792, 797, 787, 156, 156, 156, 156, 799, 448, 798, 796, 668, 800, 449, 1610, 785, 1610, 1610, 675, 786, 918, 784, 447, 156, 156, 156, 795, 156, 156, 792, 797, 787, 156, 156, 156, 156, 799, 448, 798, 796, 802, 800, 449, 561, 156, 562, 563, 156, 156, 564, 668, 804, 565, 805, 803, 566, 156, 156, 567, 568, 156, 569, 570, 997, 908, 997, 997, 806, 998, 802, 908, 901, 561, 156, 562, 563, 156, 156, 564, 807, 804, 565, 805, 803, 566, 156, 156, 567, 568, 156, 569, 570, 325, 325, 325, 325, 806, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 810, 333, 325, 812, 156, 808, 815, 156, 156, 156, 156, 326, 325, 325, 325, 325, 325, 905, 156, 813, 816, 156, 819, 825, 855, 820, 156, 156, 156, 810, 821, 817, 812, 156, 808, 815, 156, 156, 156, 156, 326, 826, 901, 156, 325, 325, 325, 156, 813, 816, 156, 819, 825, 855, 820, 156, 156, 156, 1990, 821, 817, 822, 630, 1990, 830, 156, 156, 156, 849, 156, 826, 823, 156, 325, 325, 325, 325, 325, 325, 628, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 822, 325, 325, 830, 156, 156, 156, 849, 156, 156, 823, 326, 325, 325, 325, 325, 325, 152, 156, 827, 156, 156, 831, 834, 156, 156, 824, 156, 836, 156, 156, 828, 829, 156, 156, 832, 835, 840, 156, 861, 837, 156, 844, 156, 325, 325, 325, 156, 827, 156, 156, 831, 834, 156, 156, 824, 156, 836, 156, 156, 828, 829, 156, 156, 832, 835, 840, 890, 861, 837, 156, 844, 156, 325, 325, 325, 325, 325, 325, 668, 325, 325, 325, 325, 156, 325, 325, 325, 325, 325, 325, 842, 325, 848, 156, 156, 890, 156, 843, 850, 666, 343, 325, 325, 325, 325, 325, 143, 156, 851, 156, 856, 156, 156, 845, 846, 156, 156, 156, 847, 842, 862, 848, 156, 156, 857, 156, 843, 850, 866, 859, 156, 873, 156, 325, 325, 637, 156, 851, 156, 856, 156, 143, 845, 846, 156, 156, 156, 847, 143, 862, 656, 156, 1259, 857, 894, 1259, 860, 866, 859, 156, 873, 156, 325, 325, 631, 631, 631, 631, 402, 631, 631, 631, 631, 654, 631, 631, 631, 631, 631, 631, 156, 631, 156, 894, 156, 860, 366, 644, 879, 863, 639, 631, 631, 631, 631, 631, 644, 156, 864, 156, 156, 156, 876, 852, 156, 156, 853, 872, 865, 854, 642, 156, 156, 156, 870, 874, 871, 879, 863, 875, 877, 156, 156, 631, 631, 640, 156, 864, 156, 156, 156, 876, 852, 156, 156, 853, 872, 865, 854, 867, 641, 156, 867, 870, 874, 871, 635, 326, 875, 877, 156, 156, 631, 631, 135, 135, 136, 135, 135, 135, 135, 156, 156, 135, 135, 135, 135, 888, 135, 156, 156, 868, 878, 882, 880, 881, 156, 156, 883, 156, 135, 135, 156, 630, 886, 2050, 139, 885, 156, 884, 156, 156, 869, 2051, 156, 156, 888, 156, 156, 156, 868, 878, 882, 880, 881, 156, 156, 883, 156, 887, 891, 156, 156, 886, 384, 1999, 885, 156, 884, 1476, 1999, 869, 156, 156, 156, 2328, 156, 1477, 889, 2178, 156, 156, 629, 2329, 2178, 893, 899, 156, 887, 891, 892, 156, 135, 135, 135, 135, 136, 135, 135, 135, 135, 156, 895, 135, 135, 135, 135, 889, 135, 156, 156, 156, 896, 156, 893, 899, 156, 156, 907, 892, 135, 135, 897, 898, 628, 627, 139, 626, 900, 631, 631, 895, 631, 631, 631, 631, 517, 631, 516, 631, 156, 896, 156, 949, 944, 948, 156, 907, 156, 156, 501, 897, 898, 331, 384, 154, 336, 900, 341, 902, 476, 631, 903, 402, 904, 142, 143, 650, 650, 152, 156, 369, 949, 944, 948, 156, 142, 156, 156, 650, 156, 143, 135, 135, 135, 135, 136, 135, 135, 135, 135, 650, 143, 135, 135, 135, 135, 2330, 135, 156, 652, 652, 154, 909, 156, 2331, 143, 2213, 369, 156, 135, 135, 652, 145, 910, 2070, 135, 156, 1074, 143, 1074, 1074, 2215, 1075, 652, 133, 650, 941, 947, 156, 2074, 156, 909, 911, 912, 913, 914, 914, 914, 914, 914, 366, 945, 910, 386, 326, 156, 143, 660, 660, 660, 660, 660, 660, 660, 660, 941, 947, 156, 652, 156, 326, 143, 923, 923, 923, 923, 923, 924, 925, 925, 945, 135, 135, 135, 135, 136, 135, 135, 135, 135, 161, 131, 135, 135, 135, 135, 659, 135, 395, 395, 395, 395, 395, 395, 395, 395, 2765, 2765, 2765, 135, 135, 959, 143, 156, 659, 135, 395, 395, 395, 395, 395, 395, 395, 395, 1966, 2765, 1966, 1966, 2765, 659, 143, 395, 395, 395, 395, 395, 395, 660, 660, 2765, 959, 156, 156, 386, 2765, 143, 926, 926, 926, 926, 926, 926, 926, 926, 927, 927, 927, 927, 927, 927, 927, 927, 928, 929, 930, 931, 931, 931, 931, 931, 156, 135, 135, 151, 151, 1364, 2765, 1364, 1364, 151, 1130, 151, 399, 151, 664, 664, 664, 664, 664, 664, 664, 664, 154, 2765, 151, 151, 151, 151, 143, 665, 665, 665, 665, 665, 665, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 151, 665, 665, 665, 665, 665, 665, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 406, 669, 670, 671, 672, 672, 672, 672, 672, 950, 951, 156, 156, 156, 156, 960, 673, 673, 673, 673, 673, 673, 934, 935, 936, 937, 937, 937, 937, 937, 939, 939, 939, 939, 939, 939, 939, 939, 950, 951, 156, 156, 156, 156, 960, 673, 673, 673, 673, 673, 673, 675, 406, 676, 676, 676, 676, 676, 676, 676, 676, 677, 957, 962, 991, 156, 958, 156, 678, 678, 678, 678, 678, 678, 2765, 1364, 2765, 1364, 1364, 399, 1130, 915, 915, 915, 915, 915, 915, 915, 915, 154, 2765, 957, 962, 991, 156, 958, 156, 678, 678, 678, 678, 678, 678, 165, 156, 156, 156, 156, 156, 156, 156, 156, 156, 208, 961, 156, 156, 156, 963, 156, 156, 156, 156, 156, 156, 156, 156, 970, 685, 2765, 2765, 2765, 675, 156, 940, 940, 940, 940, 940, 940, 940, 940, 2765, 961, 156, 156, 156, 963, 156, 156, 156, 156, 156, 156, 156, 156, 970, 685, 325, 325, 325, 325, 1905, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 2765, 333, 325, 175, 1906, 156, 154, 156, 1907, 2328, 2765, 326, 325, 325, 325, 325, 325, 2329, 156, 946, 956, 156, 156, 156, 942, 967, 156, 952, 964, 156, 955, 943, 965, 953, 156, 156, 156, 954, 968, 969, 966, 2765, 156, 156, 325, 325, 325, 156, 946, 956, 156, 156, 156, 942, 967, 156, 952, 964, 156, 955, 943, 965, 953, 711, 156, 2765, 954, 968, 969, 966, 712, 156, 156, 325, 325, 631, 631, 631, 631, 2765, 631, 631, 631, 631, 156, 631, 631, 631, 631, 631, 631, 981, 631, 156, 980, 156, 983, 156, 2765, 985, 156, 639, 631, 631, 631, 631, 631, 901, 982, 986, 984, 156, 971, 156, 156, 156, 156, 156, 1008, 2765, 981, 2765, 156, 980, 156, 983, 156, 988, 985, 156, 2765, 996, 154, 156, 631, 631, 640, 982, 986, 984, 156, 971, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 992, 993, 2765, 2765, 1966, 988, 1966, 1966, 987, 996, 995, 156, 631, 631, 675, 406, 919, 919, 919, 919, 919, 919, 919, 919, 920, 156, 156, 156, 156, 992, 993, 921, 921, 921, 921, 921, 921, 987, 142, 995, 2260, 1395, 1396, 1397, 2765, 2260, 2765, 156, 156, 2330, 156, 994, 989, 997, 143, 997, 997, 2331, 998, 156, 921, 921, 921, 921, 921, 921, 406, 932, 932, 932, 932, 932, 932, 932, 932, 677, 156, 156, 156, 156, 994, 989, 933, 933, 933, 933, 933, 933, 156, 1001, 990, 156, 1002, 156, 1003, 2765, 2765, 156, 156, 1011, 1006, 1007, 1009, 156, 999, 1000, 156, 156, 156, 2765, 156, 933, 933, 933, 933, 933, 933, 972, 1001, 990, 156, 1002, 156, 1003, 1004, 973, 156, 156, 1011, 1006, 1007, 1009, 156, 999, 1000, 156, 1010, 156, 156, 156, 156, 1005, 2765, 156, 156, 156, 2765, 1013, 156, 1012, 156, 1014, 974, 975, 1015, 1016, 156, 156, 2765, 976, 1018, 1017, 2765, 156, 977, 1010, 978, 156, 979, 156, 1005, 1019, 156, 156, 156, 1026, 1013, 156, 1012, 156, 1014, 974, 975, 1015, 1016, 156, 156, 156, 976, 1018, 1017, 156, 156, 977, 1023, 978, 1024, 979, 1028, 156, 156, 1027, 1020, 1021, 1026, 156, 156, 1031, 156, 1025, 156, 156, 156, 156, 1030, 156, 156, 1032, 1022, 1029, 156, 2765, 1033, 1023, 156, 1024, 156, 1028, 156, 156, 1027, 1020, 1021, 1038, 156, 156, 1031, 156, 1025, 156, 156, 156, 156, 1030, 156, 156, 1032, 1022, 1029, 1034, 1035, 1033, 1037, 156, 1039, 156, 1036, 2339, 1040, 1042, 156, 1045, 1038, 1043, 156, 2211, 156, 156, 156, 1046, 156, 156, 1044, 156, 156, 1050, 156, 156, 1048, 1049, 1047, 1037, 1052, 1039, 156, 1036, 156, 1051, 1042, 156, 1045, 156, 1043, 156, 1041, 156, 156, 156, 1046, 156, 156, 1044, 156, 156, 1050, 156, 156, 1048, 1049, 1047, 156, 1052, 156, 156, 1053, 156, 1051, 156, 1054, 156, 156, 1055, 156, 1041, 1056, 1058, 156, 156, 156, 1057, 156, 1060, 156, 156, 156, 156, 1059, 1062, 807, 156, 156, 156, 2765, 1053, 156, 156, 156, 1054, 156, 1061, 1055, 156, 1064, 1056, 1058, 156, 156, 156, 1057, 156, 1060, 156, 156, 156, 156, 1059, 1062, 1069, 1066, 156, 1065, 1063, 1067, 156, 156, 156, 156, 1077, 1061, 1070, 156, 1064, 1068, 156, 1071, 1076, 156, 2765, 1072, 1074, 156, 1074, 1074, 1080, 1075, 156, 1069, 1066, 1081, 1065, 1063, 1067, 1073, 1078, 156, 156, 1077, 156, 1070, 156, 1082, 1068, 156, 1071, 1076, 156, 1079, 1072, 156, 1083, 156, 1084, 1080, 156, 156, 156, 156, 1081, 1085, 156, 1086, 1073, 1078, 156, 156, 1087, 156, 156, 156, 1082, 1088, 156, 1090, 156, 2765, 1079, 156, 156, 1091, 156, 156, 2765, 156, 1089, 156, 156, 1093, 1085, 156, 1086, 1094, 2765, 156, 156, 1087, 1098, 156, 156, 156, 1088, 156, 1090, 156, 156, 156, 156, 156, 1096, 1095, 156, 1092, 1097, 1089, 156, 156, 1093, 1100, 156, 1103, 1094, 156, 2765, 156, 2213, 1098, 156, 156, 156, 1102, 1101, 1099, 2070, 156, 156, 1105, 156, 1096, 1095, 156, 1092, 1097, 1104, 156, 156, 1106, 1100, 156, 1103, 156, 156, 156, 156, 156, 1108, 156, 156, 1109, 1102, 1101, 1099, 156, 1107, 156, 1105, 156, 1112, 1113, 156, 156, 156, 1104, 1110, 1114, 1106, 1111, 1115, 156, 156, 156, 156, 1118, 156, 1108, 156, 156, 1109, 156, 1124, 1125, 156, 1107, 156, 156, 156, 1112, 1113, 1116, 156, 156, 2765, 1110, 1114, 1117, 1111, 1115, 156, 1119, 156, 156, 1118, 156, 1120, 156, 156, 156, 156, 156, 867, 156, 2269, 867, 156, 1123, 2765, 2269, 1116, 1127, 156, 1134, 1126, 156, 1117, 156, 2215, 2765, 1119, 2765, 156, 1139, 156, 1120, 2074, 1128, 156, 1135, 156, 1137, 156, 156, 156, 156, 1123, 1121, 1122, 156, 1127, 156, 1134, 1126, 156, 1129, 156, 1129, 1129, 156, 1130, 156, 1139, 156, 1143, 1136, 1128, 1140, 1135, 2765, 1137, 1138, 156, 156, 156, 156, 1121, 1122, 156, 156, 1151, 156, 156, 1131, 1144, 1141, 156, 156, 156, 1142, 156, 1147, 156, 156, 1136, 156, 1140, 1145, 1146, 156, 1138, 156, 1132, 1149, 156, 1148, 1133, 156, 156, 1151, 156, 156, 156, 1144, 1141, 156, 156, 1150, 1142, 1154, 1147, 1159, 156, 156, 156, 156, 1145, 1146, 156, 1156, 156, 1132, 1149, 1152, 1148, 1133, 156, 1153, 156, 156, 156, 156, 1155, 1157, 1161, 156, 1150, 156, 1154, 1158, 1159, 175, 156, 2206, 156, 2206, 2206, 2539, 1156, 1210, 156, 1214, 1152, 2765, 2765, 2540, 1153, 156, 156, 156, 2765, 1155, 1157, 1161, 156, 156, 156, 1165, 1158, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 2765, 1210, 156, 1214, 156, 1165, 143, 1167, 1167, 1167, 1167, 1167, 1168, 911, 911, 2765, 2206, 156, 2206, 2206, 1165, 143, 911, 911, 911, 911, 911, 911, 911, 911, 1229, 2765, 2765, 156, 2765, 399, 143, 915, 915, 915, 915, 915, 915, 915, 915, 1179, 1180, 1181, 1182, 1182, 1182, 1182, 1182, 2456, 2765, 2456, 2456, 2765, 156, 1229, 156, 1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184, 675, 1212, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 156, 2765, 156, 406, 1172, 1173, 1174, 1175, 1175, 1175, 1175, 1175, 1212, 2765, 2765, 2765, 1230, 1231, 1232, 1176, 1176, 1176, 1176, 1176, 1176, 1187, 2765, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1187, 2765, 1189, 1189, 1189, 1189, 1189, 1190, 928, 928, 1230, 1231, 1232, 1176, 1176, 1176, 1176, 1176, 1176, 406, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 920, 2765, 1204, 1236, 1237, 156, 1205, 1178, 1178, 1178, 1178, 1178, 1178, 1187, 2765, 928, 928, 928, 928, 928, 928, 928, 928, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1204, 1236, 1237, 156, 1205, 1178, 1178, 1178, 1178, 1178, 1178, 406, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 677, 156, 1215, 156, 156, 156, 1203, 1192, 1192, 1192, 1192, 1192, 1192, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1199, 1199, 1199, 1199, 1199, 1200, 1201, 1201, 2765, 156, 1215, 156, 156, 156, 1203, 1192, 1192, 1192, 1192, 1192, 1192, 1194, 406, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1196, 2765, 1208, 156, 156, 156, 156, 1197, 1197, 1197, 1197, 1197, 1197, 1202, 1206, 1207, 1209, 156, 156, 1216, 2339, 1217, 1211, 156, 156, 156, 2765, 1218, 2211, 1213, 1218, 1208, 156, 156, 156, 156, 1197, 1197, 1197, 1197, 1197, 1197, 1202, 1206, 1207, 1209, 156, 156, 1216, 156, 1217, 1211, 156, 156, 156, 156, 156, 156, 1213, 156, 156, 156, 1222, 156, 1220, 1221, 1226, 156, 1227, 1223, 1224, 1225, 156, 2765, 156, 156, 156, 1219, 156, 1238, 1228, 1239, 1240, 2765, 156, 156, 156, 156, 156, 156, 156, 1222, 156, 1220, 1221, 1226, 156, 1227, 1223, 1224, 1225, 156, 1233, 156, 156, 156, 1219, 1234, 1238, 1228, 1239, 1240, 1235, 156, 1242, 156, 156, 156, 1241, 1244, 1243, 156, 156, 156, 156, 1246, 1245, 156, 1248, 156, 1250, 1233, 156, 1247, 156, 2278, 1234, 1249, 1254, 2765, 2278, 1235, 156, 1242, 156, 1251, 156, 1241, 1244, 1243, 156, 156, 156, 156, 1246, 1245, 156, 1248, 156, 1250, 156, 156, 1247, 156, 156, 1255, 1249, 1254, 1256, 156, 1252, 156, 156, 156, 1251, 1253, 1258, 1257, 1263, 1260, 156, 156, 156, 1262, 1264, 1261, 156, 1264, 1265, 156, 156, 1269, 1267, 156, 1255, 2765, 156, 1256, 156, 1252, 156, 156, 156, 156, 1253, 1258, 1257, 1263, 1260, 156, 156, 156, 1262, 156, 1261, 156, 156, 1265, 1268, 156, 1269, 1267, 1266, 156, 156, 156, 156, 1271, 156, 1270, 1272, 156, 156, 1273, 156, 156, 156, 1277, 156, 2765, 1275, 1276, 156, 156, 156, 156, 1274, 1268, 2765, 156, 156, 1266, 156, 156, 1280, 156, 1271, 156, 1270, 1272, 156, 156, 1273, 156, 156, 156, 1277, 156, 156, 1275, 1276, 1278, 156, 156, 156, 1274, 156, 1279, 156, 156, 165, 1288, 156, 1280, 1281, 1283, 2539, 156, 1286, 1282, 156, 1284, 156, 156, 2540, 156, 143, 156, 1287, 156, 1278, 1291, 1285, 156, 156, 156, 1279, 156, 1289, 1290, 1288, 156, 2765, 1281, 1283, 1297, 156, 1286, 1282, 156, 1284, 156, 156, 1293, 156, 156, 2765, 1287, 156, 1294, 1291, 1285, 156, 156, 156, 1292, 156, 1289, 1290, 1296, 1298, 1300, 1295, 156, 1297, 156, 156, 156, 156, 156, 156, 156, 1293, 156, 156, 1301, 1299, 1305, 1294, 1302, 1303, 156, 1304, 156, 1292, 1307, 2765, 156, 1296, 1298, 1300, 1295, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 1301, 1299, 1305, 156, 1302, 1303, 1306, 1304, 156, 1309, 1307, 1308, 156, 156, 156, 156, 1314, 156, 1311, 1310, 1312, 156, 156, 156, 156, 1313, 156, 1318, 156, 1316, 1315, 1317, 156, 156, 156, 1306, 2765, 156, 1309, 156, 1308, 156, 156, 156, 156, 1314, 156, 1311, 1310, 1312, 156, 1324, 156, 156, 1313, 156, 1318, 1319, 1316, 1315, 1317, 156, 156, 156, 156, 1321, 1320, 1322, 156, 156, 156, 1325, 1326, 156, 156, 165, 156, 2765, 156, 156, 1324, 1323, 156, 1327, 156, 1330, 1319, 1329, 156, 156, 156, 143, 1333, 156, 1321, 1320, 1322, 156, 156, 1331, 1325, 1326, 156, 156, 156, 156, 1328, 156, 156, 156, 1323, 156, 1327, 1335, 1330, 1332, 1329, 156, 156, 156, 1334, 1333, 156, 156, 156, 156, 156, 156, 1331, 1337, 1339, 1338, 1340, 156, 156, 1328, 1343, 1342, 156, 156, 1345, 156, 1336, 1341, 1332, 156, 156, 1346, 156, 1334, 156, 156, 156, 156, 156, 156, 156, 1344, 1337, 1339, 1338, 1340, 156, 156, 156, 1343, 1342, 1348, 156, 1345, 156, 1336, 1341, 156, 156, 156, 1346, 1347, 156, 156, 156, 156, 156, 1351, 156, 1352, 1344, 156, 156, 1349, 156, 156, 1350, 156, 2287, 156, 1348, 1360, 1353, 2287, 156, 2456, 156, 2456, 2456, 1361, 1347, 156, 2765, 156, 156, 156, 1351, 1366, 1352, 2765, 156, 156, 1349, 156, 1354, 1350, 1354, 1354, 156, 1355, 1360, 1353, 1129, 156, 1129, 1129, 156, 1130, 1361, 1364, 2765, 1364, 1364, 1367, 1130, 1365, 1366, 1368, 156, 156, 2765, 156, 1356, 1369, 165, 156, 2765, 156, 156, 1370, 1362, 1371, 1372, 1373, 156, 156, 2765, 1357, 156, 156, 143, 1358, 1367, 1383, 1365, 1359, 1368, 156, 156, 1363, 156, 1374, 1369, 156, 156, 1379, 156, 156, 1370, 156, 1371, 1372, 1373, 156, 1375, 1382, 1357, 156, 156, 1385, 1358, 156, 1383, 156, 1359, 1376, 1377, 1378, 1363, 1384, 1374, 1386, 156, 156, 156, 156, 1380, 156, 156, 156, 1389, 156, 156, 1375, 1382, 156, 1381, 156, 1385, 1390, 156, 1388, 156, 1387, 156, 156, 1394, 156, 1384, 1391, 1386, 156, 156, 156, 156, 1380, 156, 2765, 156, 1389, 156, 156, 156, 1392, 156, 1381, 156, 1445, 1390, 2765, 1388, 2765, 1387, 156, 156, 1394, 156, 156, 1391, 156, 156, 1398, 1399, 1400, 1401, 1401, 1401, 1401, 1401, 2765, 1442, 156, 1392, 156, 1165, 143, 911, 911, 911, 911, 911, 911, 911, 911, 2765, 2765, 156, 2765, 156, 1165, 143, 911, 911, 911, 911, 911, 911, 911, 911, 1442, 2765, 2765, 156, 2765, 1165, 143, 911, 911, 911, 911, 911, 911, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 143, 675, 406, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1406, 1411, 1411, 1411, 1411, 1411, 1411, 1407, 1407, 1407, 1407, 1407, 1407, 1409, 1409, 1409, 1409, 1409, 1410, 1411, 1411, 2765, 2765, 1412, 1412, 1412, 1412, 1412, 1412, 1412, 1412, 2765, 2765, 2765, 2765, 2765, 1407, 1407, 1407, 1407, 1407, 1407, 406, 1413, 1413, 1413, 1413, 1413, 1413, 1413, 1413, 920, 1422, 1422, 1422, 1422, 1422, 1422, 1414, 1414, 1414, 1414, 1414, 1414, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1419, 1419, 1419, 1419, 1419, 1419, 1419, 1419, 1449, 1661, 1661, 1661, 1661, 1661, 1661, 1414, 1414, 1414, 1414, 1414, 1414, 1194, 406, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1417, 1444, 1451, 156, 1467, 156, 1449, 1418, 1418, 1418, 1418, 1418, 1418, 1420, 1420, 1420, 1420, 1420, 1421, 1422, 1422, 1423, 1424, 1425, 1426, 1426, 1426, 1426, 1426, 2765, 1444, 1451, 156, 1467, 156, 2765, 1418, 1418, 1418, 1418, 1418, 1418, 1187, 2765, 928, 928, 928, 928, 928, 928, 928, 928, 1187, 2765, 928, 928, 928, 928, 928, 928, 928, 928, 1187, 2765, 928, 928, 928, 928, 928, 928, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 677, 406, 674, 674, 674, 674, 674, 674, 674, 674, 677, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 677, 1428, 1429, 1430, 1431, 1431, 1431, 1431, 1431, 406, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1196, 1462, 1470, 2765, 1471, 156, 1441, 1433, 1433, 1433, 1433, 1433, 1433, 1434, 1435, 1436, 1437, 1437, 1437, 1437, 1437, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 2765, 1462, 1470, 1453, 1471, 156, 2765, 1433, 1433, 1433, 1433, 1433, 1433, 1194, 156, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 156, 156, 156, 156, 156, 1452, 156, 1472, 1473, 156, 1443, 1447, 1454, 1446, 1448, 1450, 2765, 156, 1461, 1463, 156, 156, 1465, 156, 2765, 1474, 156, 2765, 1464, 156, 156, 156, 156, 156, 156, 156, 1472, 1473, 156, 1443, 1447, 1454, 1446, 1448, 1450, 1468, 156, 1461, 1463, 156, 156, 1465, 156, 1218, 1474, 156, 1218, 1464, 156, 1476, 1469, 2765, 1475, 156, 1479, 1466, 156, 1477, 1483, 2765, 156, 2765, 1480, 1486, 1468, 156, 1484, 2765, 156, 1493, 156, 2765, 156, 2765, 2765, 2765, 156, 156, 1455, 1469, 1456, 1475, 1457, 1487, 1466, 156, 1488, 1481, 1458, 156, 1459, 156, 1486, 1460, 156, 1485, 1478, 1495, 1493, 156, 1482, 156, 1489, 1490, 1492, 156, 1490, 1455, 156, 1456, 1494, 1457, 1487, 1501, 2765, 1488, 1481, 1458, 156, 1459, 156, 156, 1460, 156, 1485, 1478, 156, 156, 1498, 1482, 1497, 1489, 156, 1492, 156, 1496, 156, 156, 1499, 1494, 156, 1502, 1501, 156, 156, 156, 2765, 156, 156, 156, 156, 1500, 156, 1491, 1503, 156, 156, 1498, 1504, 1497, 1505, 156, 156, 156, 1496, 156, 1512, 1499, 2765, 156, 1502, 1507, 156, 156, 156, 156, 156, 156, 156, 156, 1500, 1509, 1491, 1503, 1508, 1510, 156, 1504, 1506, 1505, 1511, 156, 156, 156, 156, 1512, 156, 1513, 1514, 156, 1507, 1515, 156, 1516, 156, 156, 1518, 156, 156, 156, 1509, 156, 2765, 1508, 1510, 156, 156, 1506, 1523, 1511, 1519, 156, 156, 156, 1517, 156, 1513, 1514, 156, 156, 1515, 156, 1516, 1520, 165, 1518, 156, 1521, 156, 156, 156, 156, 1522, 156, 156, 156, 156, 1523, 156, 1519, 143, 156, 1525, 1517, 156, 156, 1526, 156, 156, 1528, 1529, 156, 1520, 1530, 156, 1524, 1521, 156, 156, 1527, 156, 1522, 156, 156, 1531, 156, 1533, 156, 156, 156, 156, 1525, 156, 156, 156, 1526, 156, 156, 1528, 1529, 156, 1534, 1530, 156, 1524, 1535, 156, 1532, 1527, 2765, 156, 156, 156, 1531, 156, 1533, 1536, 156, 156, 156, 156, 156, 1537, 1540, 1541, 1543, 156, 156, 156, 1538, 2765, 1539, 156, 1542, 1535, 1545, 1532, 156, 156, 156, 156, 156, 156, 156, 1551, 1536, 1549, 1544, 156, 156, 156, 1537, 1540, 1541, 1543, 156, 156, 156, 1538, 1546, 1539, 156, 1542, 156, 1550, 1547, 156, 156, 1552, 1548, 156, 156, 156, 1551, 1555, 1549, 1544, 156, 156, 156, 156, 1553, 156, 156, 156, 156, 1556, 1554, 1546, 1558, 156, 2765, 156, 1550, 1547, 1557, 1559, 1552, 1548, 156, 156, 156, 2765, 1555, 165, 165, 156, 156, 156, 156, 1553, 156, 156, 156, 156, 1556, 1554, 1562, 1558, 156, 143, 143, 1566, 156, 1557, 1559, 1561, 1563, 1564, 156, 1568, 156, 156, 156, 1560, 156, 156, 156, 156, 156, 156, 1565, 156, 156, 1567, 1569, 1562, 156, 2438, 1570, 1572, 1566, 156, 2438, 1571, 1561, 1563, 1564, 2765, 1568, 156, 156, 156, 1560, 156, 156, 156, 156, 156, 156, 1565, 1576, 156, 1567, 1569, 156, 156, 1573, 1570, 1572, 1574, 156, 156, 1571, 156, 1579, 1580, 156, 1575, 1585, 1587, 2765, 156, 1588, 156, 156, 1577, 1578, 1581, 2765, 1576, 2765, 2765, 2484, 156, 2765, 1573, 1589, 2484, 1574, 156, 156, 156, 156, 1579, 1580, 156, 1575, 1585, 1587, 156, 156, 1588, 156, 156, 1577, 1578, 1581, 1354, 1586, 1354, 1354, 1584, 1355, 1584, 1584, 1589, 1355, 156, 156, 156, 156, 156, 1591, 1590, 1593, 2765, 165, 156, 156, 156, 1592, 1594, 156, 156, 156, 1582, 1597, 1586, 1596, 156, 156, 156, 143, 1595, 156, 1598, 156, 156, 156, 156, 156, 1591, 1590, 1593, 1583, 1599, 156, 156, 156, 1592, 1594, 156, 156, 156, 1600, 1597, 156, 1596, 156, 156, 156, 1601, 1595, 156, 1598, 156, 1602, 1603, 156, 156, 1662, 1604, 156, 1583, 1599, 156, 156, 156, 156, 156, 156, 1605, 1607, 1600, 1606, 156, 156, 156, 1608, 156, 1601, 156, 916, 916, 156, 1602, 1603, 916, 156, 1662, 1604, 156, 1609, 1663, 156, 156, 156, 156, 156, 2765, 1605, 1607, 2765, 1606, 165, 156, 156, 1608, 156, 156, 156, 1611, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 143, 1609, 1663, 156, 156, 156, 143, 1611, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 2765, 2765, 156, 1665, 1670, 1668, 143, 1611, 1614, 1614, 1614, 1614, 1614, 1615, 1616, 1616, 156, 2765, 156, 2765, 2765, 156, 143, 1611, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1665, 1670, 1668, 2765, 2765, 2765, 143, 406, 1620, 1621, 1622, 1623, 1623, 1623, 1623, 1623, 156, 1667, 156, 1664, 156, 1673, 1674, 1624, 1624, 1624, 1624, 1624, 1624, 1627, 1628, 1629, 1630, 1630, 1630, 1630, 1630, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 156, 1667, 2765, 1664, 156, 1673, 1674, 1624, 1624, 1624, 1624, 1624, 1624, 406, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1406, 2765, 2765, 2765, 1675, 1676, 1677, 1626, 1626, 1626, 1626, 1626, 1626, 675, 2765, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 920, 1675, 1676, 1677, 1626, 1626, 1626, 1626, 1626, 1626, 406, 674, 674, 674, 674, 674, 674, 674, 674, 920, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 920, 406, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1417, 1671, 156, 156, 1684, 1672, 1678, 1635, 1635, 1635, 1635, 1635, 1635, 1636, 1637, 1638, 1639, 1639, 1639, 1639, 1639, 1641, 1641, 1641, 1641, 1641, 1641, 1641, 1641, 2765, 1671, 156, 156, 1684, 1672, 1678, 1635, 1635, 1635, 1635, 1635, 1635, 1194, 2765, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1643, 2765, 1644, 1644, 1644, 1644, 1644, 1644, 1644, 1644, 1643, 2765, 1645, 1645, 1645, 1645, 1645, 1646, 1423, 1423, 1643, 2765, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 927, 927, 927, 927, 927, 927, 927, 927, 1647, 2765, 1648, 1648, 1648, 1648, 1648, 1648, 1648, 1648, 1647, 2765, 1649, 1649, 1649, 1649, 1649, 1650, 1428, 1428, 1647, 2765, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 406, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1196, 156, 156, 156, 1685, 1680, 1679, 1652, 1652, 1652, 1652, 1652, 1652, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1658, 1658, 1658, 1658, 1658, 1658, 1658, 1658, 2765, 156, 156, 156, 1685, 1680, 1679, 1652, 1652, 1652, 1652, 1652, 1652, 1654, 406, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1656, 1682, 156, 2765, 1686, 156, 1683, 1657, 1657, 1657, 1657, 1657, 1657, 1659, 1659, 1659, 1659, 1659, 1660, 1661, 1661, 156, 1669, 1687, 1688, 1689, 1690, 156, 156, 2765, 1682, 156, 1666, 1686, 156, 1683, 1657, 1657, 1657, 1657, 1657, 1657, 1681, 1692, 1693, 1694, 1695, 156, 1495, 156, 156, 1669, 1687, 1688, 1689, 1690, 156, 156, 1476, 1696, 2765, 1666, 1490, 156, 1490, 1490, 1477, 1490, 2765, 2765, 156, 1681, 1692, 1693, 1694, 1695, 156, 1698, 156, 2765, 1698, 1699, 1700, 2765, 156, 1702, 1703, 156, 1696, 156, 156, 997, 156, 997, 997, 1701, 998, 156, 156, 156, 1705, 156, 2765, 1706, 156, 156, 1691, 156, 1697, 1704, 1699, 1700, 1707, 156, 1702, 1703, 156, 156, 156, 156, 156, 1709, 1708, 1710, 1701, 156, 156, 156, 156, 1705, 156, 156, 1706, 156, 156, 1691, 156, 1697, 1704, 1713, 156, 1707, 1711, 156, 156, 1715, 156, 156, 156, 156, 1709, 1708, 1710, 156, 156, 1712, 156, 156, 1714, 1716, 156, 1717, 156, 1720, 1718, 156, 156, 156, 1713, 156, 156, 1711, 156, 156, 1715, 156, 156, 156, 156, 1719, 2765, 1727, 156, 156, 1712, 156, 1721, 1714, 1716, 1724, 1717, 156, 1720, 1718, 156, 156, 156, 165, 1722, 156, 156, 156, 2765, 1728, 156, 1723, 2765, 156, 1719, 1731, 1727, 156, 156, 143, 1726, 1721, 1729, 1730, 1724, 1732, 156, 156, 1734, 156, 156, 156, 1733, 156, 156, 156, 156, 1725, 1728, 156, 156, 156, 156, 1737, 1735, 156, 156, 156, 1738, 1726, 1736, 1729, 1730, 156, 1732, 156, 156, 1734, 156, 156, 156, 1733, 156, 156, 1739, 1545, 1725, 165, 156, 156, 156, 156, 1737, 1735, 156, 156, 156, 1738, 156, 1736, 156, 1740, 156, 143, 156, 1742, 1744, 156, 156, 156, 1743, 156, 1745, 1739, 156, 1746, 156, 2765, 1747, 2765, 1748, 2489, 1741, 2765, 156, 156, 2489, 156, 156, 156, 1740, 1752, 2765, 156, 1742, 1744, 156, 156, 156, 1743, 156, 1745, 156, 156, 1746, 156, 156, 1747, 1749, 165, 165, 1741, 1750, 1751, 156, 1755, 156, 156, 156, 156, 1752, 156, 2765, 1769, 156, 143, 143, 1756, 1759, 156, 1757, 156, 1754, 156, 2765, 156, 1760, 1749, 1753, 1761, 1758, 1750, 1751, 156, 1755, 156, 1777, 156, 156, 156, 156, 1762, 1769, 156, 1771, 156, 1756, 1759, 156, 1757, 1772, 1754, 156, 156, 156, 1760, 1773, 1753, 1761, 1758, 2765, 1763, 156, 1763, 1763, 1777, 1764, 156, 156, 1770, 1762, 1778, 2765, 1771, 156, 2765, 1775, 1776, 156, 1772, 1779, 1784, 156, 156, 2765, 156, 917, 917, 2765, 1765, 2765, 917, 1584, 156, 1584, 1584, 156, 1355, 1770, 156, 1778, 156, 2765, 1780, 1774, 1775, 1776, 156, 1766, 1779, 1784, 1767, 1768, 1584, 156, 1584, 1584, 156, 1355, 1785, 156, 156, 156, 1781, 1782, 156, 156, 1786, 156, 1783, 156, 156, 1780, 1774, 1788, 156, 1787, 1766, 156, 156, 1767, 1768, 1789, 156, 1791, 1792, 156, 1790, 1785, 156, 156, 156, 1781, 1782, 156, 156, 1786, 156, 1783, 156, 156, 156, 1798, 1788, 156, 1794, 156, 156, 156, 1793, 1799, 1789, 156, 1791, 1792, 156, 1790, 1795, 156, 1800, 156, 156, 1797, 156, 1796, 1855, 156, 156, 156, 2765, 156, 1798, 1169, 1169, 1794, 156, 2494, 1169, 1793, 1799, 1935, 2494, 1935, 1935, 156, 1764, 1795, 156, 1800, 2765, 156, 1797, 156, 1796, 1855, 2765, 156, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1812, 1812, 1812, 1812, 1812, 1812, 143, 1802, 1802, 1802, 1802, 1802, 1802, 1802, 1802, 1823, 1823, 1823, 1823, 1823, 1823, 143, 1611, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1833, 1833, 1833, 1833, 1833, 1833, 143, 1611, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 2765, 2765, 2765, 2765, 1858, 156, 143, 1611, 1616, 1616, 1616, 1616, 1616, 1616, 1612, 1612, 165, 2765, 2765, 2765, 2765, 2765, 143, 1611, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 143, 1858, 156, 2765, 2765, 2765, 143, 675, 406, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1807, 156, 156, 1857, 1859, 1861, 1862, 1808, 1808, 1808, 1808, 1808, 1808, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1810, 1810, 1810, 1810, 1810, 1811, 1812, 1812, 2765, 156, 156, 1857, 1859, 1861, 1862, 1808, 1808, 1808, 1808, 1808, 1808, 2765, 2765, 1813, 1813, 1813, 1813, 1813, 1813, 1813, 1813, 406, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1406, 1860, 1863, 1866, 1867, 1868, 156, 1815, 1815, 1815, 1815, 1815, 1815, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1869, 1860, 1863, 1866, 1867, 1868, 156, 1815, 1815, 1815, 1815, 1815, 1815, 1194, 406, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1818, 156, 156, 1875, 1876, 1877, 1869, 1819, 1819, 1819, 1819, 1819, 1819, 1821, 1821, 1821, 1821, 1821, 1822, 1823, 1823, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2765, 156, 156, 1875, 1876, 1877, 2765, 1819, 1819, 1819, 1819, 1819, 1819, 406, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1417, 156, 156, 1880, 1870, 1873, 1881, 1825, 1825, 1825, 1825, 1825, 1825, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1831, 1831, 1831, 1831, 1831, 1832, 1833, 1833, 1882, 156, 156, 1880, 1870, 1873, 1881, 1825, 1825, 1825, 1825, 1825, 1825, 1654, 406, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1828, 2765, 156, 1885, 156, 1888, 1882, 1829, 1829, 1829, 1829, 1829, 1829, 1834, 1835, 1836, 1837, 1837, 1837, 1837, 1837, 1643, 2765, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 156, 1885, 156, 1888, 2765, 1829, 1829, 1829, 1829, 1829, 1829, 1643, 2765, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 1643, 2765, 1423, 1423, 1423, 1423, 1423, 1423, 1838, 1839, 1840, 1841, 1841, 1841, 1841, 1841, 1647, 2765, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1647, 2765, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1647, 2765, 1428, 1428, 1428, 1428, 1428, 1428, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1196, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1196, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1196, 1842, 1843, 1844, 1845, 1845, 1845, 1845, 1845, 406, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1656, 1884, 2765, 1887, 156, 2765, 156, 1847, 1847, 1847, 1847, 1847, 1847, 1848, 1849, 1850, 1851, 1851, 1851, 1851, 1851, 1853, 1853, 1853, 1853, 1853, 1853, 1853, 1853, 2765, 1884, 1698, 1887, 156, 1698, 156, 1847, 1847, 1847, 1847, 1847, 1847, 1654, 1891, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 151, 151, 156, 156, 2765, 1864, 151, 156, 151, 165, 151, 1865, 1874, 156, 1872, 156, 1871, 156, 156, 208, 1891, 151, 151, 151, 151, 143, 1883, 2765, 1889, 1886, 156, 156, 156, 712, 1864, 2765, 156, 1892, 156, 1890, 1865, 1874, 156, 1872, 156, 1871, 156, 156, 2765, 476, 2765, 2765, 151, 151, 151, 151, 151, 1889, 1886, 156, 156, 151, 156, 151, 165, 151, 1892, 156, 1890, 156, 156, 156, 1897, 1899, 208, 713, 151, 151, 151, 151, 143, 1893, 156, 1894, 1896, 156, 1856, 2765, 1895, 156, 2765, 156, 1898, 156, 1900, 156, 1901, 156, 156, 156, 156, 1897, 1899, 156, 713, 1902, 156, 151, 151, 151, 1893, 156, 1894, 1896, 156, 1856, 501, 1895, 1904, 156, 165, 1898, 156, 1900, 156, 1901, 156, 1909, 156, 156, 156, 516, 156, 156, 1902, 156, 143, 156, 1916, 1919, 156, 156, 1910, 156, 156, 156, 1917, 1904, 156, 1908, 1903, 156, 156, 1914, 1915, 156, 1909, 156, 156, 156, 156, 2765, 156, 1920, 1918, 1911, 156, 1916, 1919, 156, 156, 1910, 156, 156, 156, 1917, 156, 156, 1908, 1903, 156, 156, 1914, 1915, 156, 156, 156, 1923, 156, 156, 1921, 165, 1920, 1918, 1911, 1922, 156, 156, 156, 156, 156, 1926, 165, 156, 156, 156, 156, 143, 1928, 156, 156, 1925, 1930, 156, 156, 156, 1923, 156, 143, 1921, 2765, 156, 2765, 1924, 1922, 156, 156, 156, 156, 156, 1926, 156, 156, 156, 1931, 1932, 156, 1928, 156, 156, 1925, 1930, 156, 1927, 156, 2765, 1763, 156, 1763, 1763, 156, 1764, 1924, 1935, 156, 1935, 1935, 1937, 1764, 1936, 156, 156, 1941, 1931, 1932, 156, 1939, 156, 165, 1945, 1938, 1946, 1927, 156, 1933, 1940, 156, 156, 156, 156, 1942, 1943, 156, 156, 143, 1947, 1937, 2765, 1936, 1952, 156, 1941, 1944, 1934, 156, 1939, 156, 1948, 1945, 1938, 1946, 156, 1949, 156, 1940, 156, 156, 156, 156, 1942, 1943, 156, 1950, 156, 1947, 1951, 156, 1953, 1952, 156, 1959, 1944, 1934, 156, 1960, 1957, 1948, 156, 1954, 156, 156, 1949, 156, 156, 156, 1962, 156, 156, 156, 1958, 156, 1950, 156, 156, 1951, 156, 1953, 1961, 156, 1959, 2025, 2031, 1963, 1960, 1957, 2765, 156, 1954, 156, 156, 156, 2765, 156, 2765, 1962, 156, 156, 156, 1958, 156, 156, 2030, 156, 1964, 1965, 2765, 1961, 2765, 2765, 2025, 2031, 1963, 2024, 2024, 2024, 2024, 2024, 2024, 156, 156, 1977, 1978, 1979, 1980, 1980, 1980, 1980, 1980, 165, 156, 2030, 2765, 1964, 1965, 406, 1970, 1971, 1972, 1973, 1973, 1973, 1973, 1973, 2765, 143, 2027, 2032, 2033, 2034, 2035, 1974, 1974, 1974, 1974, 1974, 1974, 1982, 1982, 1982, 1982, 1982, 1982, 1982, 1982, 675, 2765, 1983, 1983, 1983, 1983, 1983, 1983, 1983, 1983, 2027, 2032, 2033, 2034, 2035, 1974, 1974, 1974, 1974, 1974, 1974, 406, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1807, 2765, 2765, 2765, 2036, 2037, 2040, 1976, 1976, 1976, 1976, 1976, 1976, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1406, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1406, 2036, 2037, 2040, 1976, 1976, 1976, 1976, 1976, 1976, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1406, 406, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1818, 2038, 156, 156, 2043, 2039, 2048, 1985, 1985, 1985, 1985, 1985, 1985, 1986, 1987, 1988, 1989, 1989, 1989, 1989, 1989, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 2765, 2038, 156, 156, 2043, 2039, 2048, 1985, 1985, 1985, 1985, 1985, 1985, 1194, 2765, 1992, 1992, 1992, 1992, 1992, 1992, 1992, 1992, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1417, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1417, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1417, 406, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1828, 2044, 2049, 2052, 2055, 2057, 156, 1994, 1994, 1994, 1994, 1994, 1994, 1995, 1996, 1997, 1998, 1998, 1998, 1998, 1998, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2765, 2044, 2049, 2052, 2055, 2057, 156, 1994, 1994, 1994, 1994, 1994, 1994, 1654, 2765, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 406, 2003, 2003, 2003, 2003, 2003, 2004, 2005, 2005, 406, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2006, 2765, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2006, 2765, 2008, 2008, 2008, 2008, 2008, 2009, 1838, 1838, 2006, 2765, 1838, 1838, 1838, 1838, 1838, 1838, 1838, 1838, 2010, 2765, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2010, 476, 2012, 2012, 2012, 2012, 2012, 2013, 1842, 1842, 2010, 2765, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 406, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 1656, 156, 156, 2059, 2064, 2066, 156, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 156, 156, 156, 2059, 2064, 2066, 156, 2015, 2015, 2015, 2015, 2015, 2015, 2017, 406, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2019, 2765, 156, 2765, 2765, 2765, 156, 2020, 2020, 2020, 2020, 2020, 2020, 2022, 2022, 2022, 2022, 2022, 2023, 2024, 2024, 2765, 501, 2765, 2041, 1883, 2045, 2765, 2029, 2082, 156, 156, 712, 2042, 2046, 2765, 2020, 2020, 2020, 2020, 2020, 2020, 151, 151, 156, 2765, 156, 2053, 151, 2765, 151, 165, 151, 2041, 156, 2765, 156, 2029, 2082, 156, 156, 208, 2042, 151, 151, 151, 151, 143, 2047, 2056, 2026, 2069, 2499, 156, 971, 156, 2053, 2499, 2060, 2070, 2765, 2765, 2061, 156, 156, 156, 156, 156, 2058, 156, 2071, 156, 2765, 2765, 151, 151, 151, 2047, 2056, 2026, 151, 151, 156, 971, 2062, 516, 151, 2060, 151, 165, 151, 2061, 2072, 156, 156, 156, 156, 2058, 2063, 208, 156, 151, 151, 151, 151, 143, 2065, 156, 156, 2067, 2068, 156, 165, 2062, 156, 2077, 156, 156, 2073, 156, 2765, 2072, 2084, 156, 2028, 2078, 2074, 2063, 143, 2076, 2765, 2081, 151, 151, 151, 2065, 156, 156, 2067, 2068, 156, 156, 2080, 156, 2077, 156, 156, 156, 156, 2083, 2087, 156, 2086, 2028, 2078, 156, 2085, 156, 2076, 2075, 2081, 165, 2090, 2765, 156, 2089, 156, 2095, 156, 156, 156, 2080, 156, 2092, 2765, 2765, 156, 143, 2083, 2087, 156, 2086, 2504, 2093, 156, 2085, 156, 2504, 2075, 156, 2094, 2090, 2088, 156, 2089, 156, 2095, 156, 2097, 2101, 156, 156, 2092, 1935, 156, 1935, 1935, 2096, 1764, 2098, 2099, 156, 2093, 156, 156, 156, 2100, 2102, 156, 2094, 2103, 2088, 2104, 156, 2105, 156, 2106, 2097, 2101, 156, 156, 2107, 156, 156, 2108, 156, 2096, 2109, 2098, 2099, 156, 156, 156, 156, 156, 2100, 2102, 2110, 156, 2103, 2111, 2104, 156, 2105, 156, 2106, 156, 156, 2112, 156, 2107, 156, 2114, 2108, 156, 156, 2109, 156, 156, 156, 156, 2115, 156, 156, 2116, 2605, 2110, 156, 2765, 2111, 2605, 2765, 403, 403, 403, 156, 156, 2112, 403, 2765, 2244, 2114, 2244, 2244, 156, 2245, 156, 156, 156, 2245, 2115, 156, 156, 2116, 675, 406, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2122, 2127, 2127, 2127, 2127, 2127, 2127, 2123, 2123, 2123, 2123, 2123, 2123, 2124, 2124, 2124, 2124, 2124, 2124, 2124, 2124, 2125, 2125, 2125, 2125, 2125, 2126, 2127, 2127, 2138, 2138, 2138, 2138, 2138, 2138, 2765, 2123, 2123, 2123, 2123, 2123, 2123, 2765, 2765, 2128, 2128, 2128, 2128, 2128, 2128, 2128, 2128, 406, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 1807, 2148, 2148, 2148, 2148, 2148, 2148, 2130, 2130, 2130, 2130, 2130, 2130, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2135, 2135, 2135, 2135, 2135, 2135, 2135, 2135, 2158, 2158, 2158, 2158, 2158, 2158, 2765, 2130, 2130, 2130, 2130, 2130, 2130, 1194, 406, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2133, 2181, 2184, 2185, 2186, 2187, 2188, 2134, 2134, 2134, 2134, 2134, 2134, 2136, 2136, 2136, 2136, 2136, 2137, 2138, 2138, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2765, 2181, 2184, 2185, 2186, 2187, 2188, 2134, 2134, 2134, 2134, 2134, 2134, 406, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 1818, 2189, 2190, 2191, 2192, 2193, 2194, 2140, 2140, 2140, 2140, 2140, 2140, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2146, 2146, 2146, 2146, 2146, 2147, 2148, 2148, 2195, 2189, 2190, 2191, 2192, 2193, 2194, 2140, 2140, 2140, 2140, 2140, 2140, 1654, 406, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2143, 2196, 2197, 2198, 2199, 2200, 2195, 2144, 2144, 2144, 2144, 2144, 2144, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2765, 2196, 2197, 2198, 2199, 2200, 2765, 2144, 2144, 2144, 2144, 2144, 2144, 406, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 1828, 2201, 2202, 2203, 2204, 2205, 2207, 2150, 2150, 2150, 2150, 2150, 2150, 2156, 2156, 2156, 2156, 2156, 2157, 2158, 2158, 406, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2201, 2202, 2203, 2204, 2205, 2207, 2150, 2150, 2150, 2150, 2150, 2150, 2017, 406, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2153, 2765, 2208, 2209, 2218, 2219, 2220, 2154, 2154, 2154, 2154, 2154, 2154, 406, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 406, 2159, 2159, 2159, 2159, 2159, 2159, 1427, 1427, 2208, 2209, 2218, 2219, 2220, 2154, 2154, 2154, 2154, 2154, 2154, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2160, 2161, 2162, 2163, 2163, 2163, 2163, 2163, 2006, 2765, 1838, 1838, 1838, 1838, 1838, 1838, 1838, 1838, 2006, 2765, 1838, 1838, 1838, 1838, 1838, 1838, 1838, 1838, 2006, 2765, 1838, 1838, 1838, 1838, 1838, 1838, 2164, 2165, 2166, 2167, 2167, 2167, 2167, 2167, 2010, 2765, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 2010, 2765, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 2010, 2765, 1842, 1842, 1842, 1842, 1842, 1842, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1656, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1656, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1656, 2168, 2169, 2170, 2171, 2171, 2171, 2171, 2171, 406, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2019, 2221, 2224, 2225, 2226, 2227, 2228, 2173, 2173, 2173, 2173, 2173, 2173, 2174, 2175, 2176, 2177, 2177, 2177, 2177, 2177, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2765, 2221, 2224, 2225, 2226, 2227, 2228, 2173, 2173, 2173, 2173, 2173, 2173, 2017, 165, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 151, 151, 2765, 2069, 2210, 2213, 151, 143, 151, 165, 151, 2070, 2211, 2070, 2229, 165, 2765, 2230, 2765, 208, 2215, 151, 151, 151, 151, 143, 2073, 2183, 2074, 2231, 2182, 143, 1170, 1170, 2074, 2232, 2233, 1170, 2765, 2765, 2765, 2765, 2214, 2229, 2072, 2212, 2230, 165, 2234, 2765, 2765, 2217, 151, 151, 151, 2765, 2183, 2216, 2231, 2182, 151, 151, 165, 143, 2232, 2233, 151, 2075, 151, 165, 151, 2214, 2235, 2072, 2212, 2223, 2236, 2234, 143, 208, 2217, 151, 151, 151, 151, 143, 2216, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2313, 156, 2075, 2222, 2765, 165, 2765, 2235, 2765, 2765, 2223, 2236, 2312, 2312, 2312, 2312, 2312, 2312, 151, 151, 151, 143, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2313, 156, 2765, 2222, 406, 2249, 2250, 2251, 2252, 2252, 2252, 2252, 2252, 2315, 2317, 2318, 2319, 2320, 2321, 2322, 2253, 2253, 2253, 2253, 2253, 2253, 2256, 2257, 2258, 2259, 2259, 2259, 2259, 2259, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2315, 2317, 2318, 2319, 2320, 2321, 2322, 2253, 2253, 2253, 2253, 2253, 2253, 406, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2122, 2765, 2765, 2765, 2323, 2324, 2325, 2255, 2255, 2255, 2255, 2255, 2255, 675, 2765, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1807, 2323, 2324, 2325, 2255, 2255, 2255, 2255, 2255, 2255, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1807, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1807, 406, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2133, 2327, 156, 156, 2332, 2334, 156, 2264, 2264, 2264, 2264, 2264, 2264, 2265, 2266, 2267, 2268, 2268, 2268, 2268, 2268, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2765, 2327, 156, 156, 2332, 2334, 156, 2264, 2264, 2264, 2264, 2264, 2264, 1194, 2765, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1818, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1818, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1818, 406, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2143, 2336, 2341, 2342, 2343, 156, 2345, 2273, 2273, 2273, 2273, 2273, 2273, 2274, 2275, 2276, 2277, 2277, 2277, 2277, 2277, 2279, 2279, 2279, 2279, 2279, 2279, 2279, 2279, 2765, 2336, 2341, 2342, 2343, 156, 2345, 2273, 2273, 2273, 2273, 2273, 2273, 1654, 2765, 2280, 2280, 2280, 2280, 2280, 2280, 2280, 2280, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1828, 406, 674, 674, 674, 674, 674, 674, 674, 674, 1828, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1828, 406, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2153, 2346, 156, 2348, 2350, 2352, 156, 2282, 2282, 2282, 2282, 2282, 2282, 2283, 2284, 2285, 2286, 2286, 2286, 2286, 2286, 2288, 2288, 2288, 2288, 2288, 2288, 2288, 2288, 2765, 2346, 156, 2348, 2350, 2352, 156, 2282, 2282, 2282, 2282, 2282, 2282, 2017, 2765, 2289, 2289, 2289, 2289, 2289, 2289, 2289, 2289, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 406, 2291, 2291, 2291, 2291, 2291, 2292, 2293, 2293, 406, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2294, 2765, 2295, 2295, 2295, 2295, 2295, 2295, 2295, 2295, 2294, 2765, 2296, 2296, 2296, 2296, 2296, 2297, 2164, 2164, 2294, 2765, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2298, 2765, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2298, 2765, 2300, 2300, 2300, 2300, 2300, 2301, 2168, 2168, 2298, 2765, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 406, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2019, 2349, 2353, 2356, 156, 156, 156, 2303, 2303, 2303, 2303, 2303, 2303, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2309, 2309, 2309, 2309, 2309, 2309, 2309, 2309, 2765, 2349, 2353, 2356, 156, 156, 156, 2303, 2303, 2303, 2303, 2303, 2303, 2305, 406, 2306, 2306, 2306, 2306, 2306, 2306, 2306, 2306, 2307, 156, 2355, 2358, 2765, 2360, 2333, 2308, 2308, 2308, 2308, 2308, 2308, 2310, 2310, 2310, 2310, 2310, 2311, 2312, 2312, 2339, 2765, 2765, 156, 2326, 2765, 2337, 2765, 2211, 156, 2355, 2358, 156, 2360, 2333, 2308, 2308, 2308, 2308, 2308, 2308, 151, 151, 2335, 156, 2765, 2765, 151, 2210, 151, 165, 151, 156, 2326, 156, 2337, 2211, 2340, 2765, 2361, 208, 156, 151, 151, 151, 151, 143, 2338, 2765, 2344, 2359, 2765, 2335, 156, 156, 156, 165, 156, 156, 2363, 156, 2357, 2351, 156, 2314, 2765, 2340, 156, 2361, 2212, 2441, 2765, 143, 151, 151, 151, 2338, 156, 2344, 2359, 2354, 2347, 2445, 156, 156, 156, 156, 156, 2363, 156, 2357, 2351, 2765, 2314, 151, 151, 156, 2765, 2212, 2441, 151, 2765, 151, 165, 151, 2765, 156, 2446, 2447, 2354, 2347, 2445, 2765, 208, 156, 151, 151, 151, 151, 143, 2765, 2362, 2765, 2362, 2362, 2244, 1130, 2244, 2244, 2765, 2245, 2765, 2765, 2765, 2245, 2765, 2446, 2447, 2448, 2316, 2377, 2377, 2377, 2377, 2377, 2377, 151, 151, 151, 1131, 2374, 2374, 2374, 2374, 2374, 2374, 2374, 2374, 2375, 2375, 2375, 2375, 2375, 2376, 2377, 2377, 2765, 2448, 2316, 2449, 2450, 2765, 156, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2381, 2381, 2381, 2381, 2381, 2381, 2381, 2381, 2385, 2385, 2385, 2385, 2385, 2385, 2385, 2385, 2765, 2449, 2450, 2765, 156, 2365, 2366, 2367, 2368, 2368, 2368, 2368, 2368, 2369, 2388, 2388, 2388, 2388, 2388, 2388, 2370, 2370, 2370, 2370, 2370, 2370, 2386, 2386, 2386, 2386, 2386, 2387, 2388, 2388, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2398, 2398, 2398, 2398, 2398, 2398, 2765, 2370, 2370, 2370, 2370, 2370, 2370, 675, 406, 2371, 2371, 2371, 2371, 2371, 2371, 2371, 2371, 2372, 2408, 2408, 2408, 2408, 2408, 2408, 2373, 2373, 2373, 2373, 2373, 2373, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2396, 2396, 2396, 2396, 2396, 2397, 2398, 2398, 2418, 2418, 2418, 2418, 2418, 2418, 2765, 2373, 2373, 2373, 2373, 2373, 2373, 406, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2122, 156, 2451, 2452, 156, 2459, 156, 2380, 2380, 2380, 2380, 2380, 2380, 2401, 2401, 2401, 2401, 2401, 2401, 2401, 2401, 2405, 2405, 2405, 2405, 2405, 2405, 2405, 2405, 2461, 156, 2451, 2452, 156, 2459, 156, 2380, 2380, 2380, 2380, 2380, 2380, 1194, 406, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2383, 156, 156, 156, 2466, 2458, 2461, 2384, 2384, 2384, 2384, 2384, 2384, 2406, 2406, 2406, 2406, 2406, 2407, 2408, 2408, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2765, 156, 156, 156, 2466, 2458, 2765, 2384, 2384, 2384, 2384, 2384, 2384, 406, 2389, 2389, 2389, 2389, 2389, 2389, 2389, 2389, 2133, 2467, 156, 2469, 156, 156, 2470, 2390, 2390, 2390, 2390, 2390, 2390, 2415, 2415, 2415, 2415, 2415, 2415, 2415, 2415, 2416, 2416, 2416, 2416, 2416, 2417, 2418, 2418, 156, 2467, 156, 2469, 156, 156, 2470, 2390, 2390, 2390, 2390, 2390, 2390, 1654, 406, 2392, 2392, 2392, 2392, 2392, 2392, 2392, 2392, 2393, 2765, 2530, 2534, 2535, 2536, 156, 2394, 2394, 2394, 2394, 2394, 2394, 406, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 406, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2530, 2534, 2535, 2536, 2765, 2394, 2394, 2394, 2394, 2394, 2394, 406, 2399, 2399, 2399, 2399, 2399, 2399, 2399, 2399, 2143, 2479, 2479, 2479, 2479, 2479, 2479, 2400, 2400, 2400, 2400, 2400, 2400, 406, 2419, 2419, 2419, 2419, 2419, 2419, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2765, 2765, 2765, 2765, 2765, 2400, 2400, 2400, 2400, 2400, 2400, 2017, 406, 2402, 2402, 2402, 2402, 2402, 2402, 2402, 2402, 2403, 2529, 2529, 2529, 2529, 2529, 2529, 2404, 2404, 2404, 2404, 2404, 2404, 2420, 2421, 2422, 2423, 2423, 2423, 2423, 2423, 2294, 2460, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2765, 2765, 2765, 2765, 2765, 2404, 2404, 2404, 2404, 2404, 2404, 406, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2153, 2765, 2545, 2546, 156, 2550, 2608, 2410, 2410, 2410, 2410, 2410, 2410, 2294, 2765, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2294, 2612, 2164, 2164, 2164, 2164, 2164, 2164, 2545, 2546, 156, 2550, 2608, 2410, 2410, 2410, 2410, 2410, 2410, 2305, 406, 2412, 2412, 2412, 2412, 2412, 2412, 2412, 2412, 2413, 2612, 2613, 2614, 156, 2618, 2619, 2414, 2414, 2414, 2414, 2414, 2414, 2424, 2425, 2426, 2427, 2427, 2427, 2427, 2427, 2298, 2765, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2613, 2614, 156, 2618, 2619, 2414, 2414, 2414, 2414, 2414, 2414, 2298, 2765, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2298, 2765, 2168, 2168, 2168, 2168, 2168, 2168, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2019, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2019, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2019, 2428, 2429, 2430, 2431, 2431, 2431, 2431, 2431, 406, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2307, 2362, 2615, 2362, 2362, 156, 1130, 2433, 2433, 2433, 2433, 2433, 2433, 2434, 2435, 2436, 2437, 2437, 2437, 2437, 2437, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 1362, 2765, 2615, 2765, 2765, 156, 2765, 2433, 2433, 2433, 2433, 2433, 2433, 2305, 165, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 151, 151, 156, 156, 2765, 156, 151, 143, 151, 165, 151, 156, 156, 2454, 165, 2765, 2765, 156, 2453, 208, 2455, 151, 151, 151, 151, 143, 2443, 2457, 2462, 156, 143, 156, 156, 2463, 156, 156, 2765, 156, 2765, 2765, 156, 156, 2454, 156, 2464, 2442, 156, 2453, 2765, 2455, 2620, 2465, 151, 151, 151, 2443, 2457, 2462, 156, 2468, 2765, 165, 2463, 2765, 156, 2471, 156, 2471, 2471, 2765, 1355, 2765, 156, 2464, 2442, 151, 151, 143, 2765, 2620, 2465, 151, 2765, 151, 165, 151, 2765, 2362, 2468, 2362, 2362, 2765, 1130, 1356, 208, 2611, 151, 151, 151, 151, 143, 156, 2548, 156, 2473, 2444, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2475, 1362, 2477, 2477, 2477, 2477, 2477, 2478, 2479, 2479, 2611, 2765, 2765, 151, 151, 151, 156, 2548, 156, 2765, 2444, 406, 2480, 2480, 2480, 2480, 2480, 2480, 2480, 2480, 2765, 2765, 2617, 156, 2665, 156, 2666, 2481, 2481, 2481, 2481, 2481, 2481, 2485, 2485, 2485, 2485, 2485, 2485, 2485, 2485, 675, 2765, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 2617, 156, 2665, 156, 2666, 2481, 2481, 2481, 2481, 2481, 2481, 406, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2372, 2765, 2765, 2765, 2669, 2670, 156, 2483, 2483, 2483, 2483, 2483, 2483, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2122, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2122, 2669, 2670, 156, 2483, 2483, 2483, 2483, 2483, 2483, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2122, 406, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2383, 2765, 2622, 2673, 2674, 2718, 156, 2488, 2488, 2488, 2488, 2488, 2488, 2490, 2490, 2490, 2490, 2490, 2490, 2490, 2490, 1194, 2765, 2491, 2491, 2491, 2491, 2491, 2491, 2491, 2491, 2622, 2673, 2674, 2718, 156, 2488, 2488, 2488, 2488, 2488, 2488, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2133, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2133, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2133, 406, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2393, 2765, 156, 2715, 156, 2667, 156, 2493, 2493, 2493, 2493, 2493, 2493, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 1654, 2765, 2496, 2496, 2496, 2496, 2496, 2496, 2496, 2496, 156, 2715, 156, 2667, 156, 2493, 2493, 2493, 2493, 2493, 2493, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2143, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2143, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2143, 406, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2403, 2765, 2671, 156, 156, 156, 156, 2498, 2498, 2498, 2498, 2498, 2498, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2017, 2765, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2671, 156, 156, 156, 156, 2498, 2498, 2498, 2498, 2498, 2498, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2153, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2153, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2153, 406, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2413, 2765, 2672, 156, 2737, 2748, 156, 2503, 2503, 2503, 2503, 2503, 2503, 2505, 2505, 2505, 2505, 2505, 2505, 2505, 2505, 2305, 2765, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2672, 156, 2737, 2748, 156, 2503, 2503, 2503, 2503, 2503, 2503, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 406, 2508, 2508, 2508, 2508, 2508, 2509, 2510, 2510, 406, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2511, 2765, 2512, 2512, 2512, 2512, 2512, 2512, 2512, 2512, 2511, 2765, 2513, 2513, 2513, 2513, 2513, 2514, 2424, 2424, 2511, 2765, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2515, 2765, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2515, 2765, 2517, 2517, 2517, 2517, 2517, 2518, 2428, 2428, 2515, 2765, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 406, 2519, 2519, 2519, 2519, 2519, 2519, 2519, 2519, 2307, 2471, 2757, 2471, 2471, 2758, 1355, 2520, 2520, 2520, 2520, 2520, 2520, 2521, 2521, 2521, 2521, 2521, 2521, 2521, 2521, 2526, 2526, 2526, 2526, 2526, 2526, 2526, 2526, 1582, 2471, 2757, 2471, 2471, 2758, 1355, 2520, 2520, 2520, 2520, 2520, 2520, 2522, 406, 2523, 2523, 2523, 2523, 2523, 2523, 2523, 2523, 2524, 2714, 2762, 2764, 156, 156, 1582, 2525, 2525, 2525, 2525, 2525, 2525, 2527, 2527, 2527, 2527, 2527, 2528, 2529, 2529, 2554, 2555, 2556, 2557, 2557, 2557, 2557, 2557, 2765, 2714, 2762, 2764, 156, 156, 2765, 2525, 2525, 2525, 2525, 2525, 2525, 151, 151, 156, 2541, 156, 2765, 151, 156, 151, 165, 151, 2765, 156, 156, 156, 156, 2542, 156, 2543, 208, 156, 151, 151, 151, 151, 143, 2668, 2553, 156, 2765, 156, 156, 2541, 156, 2531, 2765, 156, 156, 2765, 2765, 156, 156, 156, 156, 156, 2542, 156, 2543, 2765, 156, 2616, 2765, 151, 151, 151, 2668, 2553, 156, 2765, 156, 2765, 156, 2765, 2531, 151, 151, 156, 156, 156, 156, 151, 156, 151, 165, 151, 2544, 2765, 156, 156, 2616, 2765, 2547, 2549, 208, 156, 151, 151, 151, 151, 143, 156, 2551, 2765, 2765, 156, 2532, 156, 156, 156, 2765, 156, 2765, 2765, 2765, 2544, 2533, 156, 156, 156, 2765, 2547, 2549, 2552, 156, 1402, 1402, 151, 151, 151, 1402, 2551, 2765, 2765, 156, 2532, 2765, 2511, 156, 2424, 2424, 2424, 2424, 2424, 2424, 2533, 2765, 2765, 156, 2765, 2765, 2473, 2552, 2561, 2561, 2561, 2561, 2561, 2561, 2561, 2561, 2475, 406, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2765, 2621, 2765, 2621, 2621, 2765, 1764, 2563, 2563, 2563, 2563, 2563, 2563, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2567, 2567, 2567, 2567, 2567, 2567, 2567, 2567, 1933, 1403, 1403, 2765, 2765, 2765, 1403, 2563, 2563, 2563, 2563, 2563, 2563, 406, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2372, 2621, 2765, 2621, 2621, 2765, 1764, 2566, 2566, 2566, 2566, 2566, 2566, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 1933, 1617, 1617, 2765, 2765, 2765, 1617, 2566, 2566, 2566, 2566, 2566, 2566, 406, 2568, 2568, 2568, 2568, 2568, 2568, 2568, 2568, 2713, 2765, 2765, 2765, 2765, 2765, 156, 2569, 2569, 2569, 2569, 2569, 2569, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2713, 2765, 2765, 2765, 2765, 2765, 156, 2569, 2569, 2569, 2569, 2569, 2569, 406, 2570, 2570, 2570, 2570, 2570, 2570, 2570, 2570, 2383, 1618, 1618, 2765, 2765, 2765, 1618, 2571, 2571, 2571, 2571, 2571, 2571, 406, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 406, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 2765, 2765, 2765, 2765, 2765, 2571, 2571, 2571, 2571, 2571, 2571, 406, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 1803, 1803, 2765, 2765, 2765, 1803, 2765, 2574, 2574, 2574, 2574, 2574, 2574, 406, 2590, 2590, 2590, 2590, 2590, 2590, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2765, 2765, 2765, 2765, 2765, 2574, 2574, 2574, 2574, 2574, 2574, 406, 2575, 2575, 2575, 2575, 2575, 2575, 2575, 2575, 2393, 1804, 1804, 2765, 2765, 2765, 1804, 2576, 2576, 2576, 2576, 2576, 2576, 2591, 2592, 2593, 2594, 2594, 2594, 2594, 2594, 2511, 2765, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2765, 2765, 2765, 2765, 2765, 2576, 2576, 2576, 2576, 2576, 2576, 406, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 1967, 1967, 2765, 2765, 2765, 1967, 2765, 2579, 2579, 2579, 2579, 2579, 2579, 2511, 2765, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2595, 2596, 2597, 2598, 2598, 2598, 2598, 2598, 2765, 2765, 2765, 2765, 2765, 2579, 2579, 2579, 2579, 2579, 2579, 406, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2403, 1968, 1968, 2765, 2765, 2765, 1968, 2581, 2581, 2581, 2581, 2581, 2581, 2515, 2765, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2515, 2765, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2765, 2765, 2765, 2581, 2581, 2581, 2581, 2581, 2581, 406, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2118, 2118, 2765, 2765, 2765, 2118, 2765, 2584, 2584, 2584, 2584, 2584, 2584, 2515, 2765, 2428, 2428, 2428, 2428, 2428, 2428, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2307, 2765, 2765, 2765, 2765, 2765, 2584, 2584, 2584, 2584, 2584, 2584, 406, 2585, 2585, 2585, 2585, 2585, 2585, 2585, 2585, 2413, 2119, 2119, 2765, 2765, 2765, 2119, 2586, 2586, 2586, 2586, 2586, 2586, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2307, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2307, 2765, 2765, 2765, 2586, 2586, 2586, 2586, 2586, 2586, 406, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 156, 2765, 2765, 2765, 2765, 2765, 2761, 2589, 2589, 2589, 2589, 2589, 2589, 2599, 2600, 2601, 2602, 2602, 2602, 2602, 2602, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 156, 2765, 2765, 2765, 2765, 2765, 2761, 2589, 2589, 2589, 2589, 2589, 2589, 406, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2524, 2246, 2246, 2765, 2765, 2765, 2246, 2604, 2604, 2604, 2604, 2604, 2604, 2522, 2765, 2607, 2607, 2607, 2607, 2607, 2607, 2607, 2607, 2765, 156, 2765, 2765, 2765, 2621, 2763, 2621, 2621, 2765, 1764, 2765, 2765, 2604, 2604, 2604, 2604, 2604, 2604, 151, 151, 2247, 2247, 2765, 2765, 151, 2247, 151, 165, 151, 156, 2364, 2364, 1765, 2765, 2763, 2364, 2765, 208, 2765, 151, 151, 151, 151, 143, 156, 2765, 2765, 2765, 2623, 2609, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2623, 2765, 2625, 2625, 2625, 2625, 2625, 2626, 2554, 2554, 2765, 2765, 151, 151, 151, 156, 2765, 2765, 2472, 2472, 2609, 151, 151, 2472, 2765, 2765, 2765, 151, 2765, 151, 165, 151, 2632, 2632, 2632, 2632, 2632, 2632, 2632, 2632, 208, 2765, 151, 151, 151, 151, 143, 2558, 2558, 2765, 2765, 2765, 2558, 2765, 2623, 2610, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 406, 674, 674, 674, 674, 674, 674, 674, 674, 151, 151, 151, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2610, 406, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2559, 2559, 2765, 2765, 2765, 2559, 2765, 2629, 2629, 2629, 2629, 2629, 2629, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2372, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2372, 2765, 2765, 2765, 2629, 2629, 2629, 2629, 2629, 2629, 406, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2627, 2627, 2765, 2765, 2765, 2627, 2765, 2631, 2631, 2631, 2631, 2631, 2631, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2372, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2383, 2765, 2765, 2765, 2631, 2631, 2631, 2631, 2631, 2631, 406, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2634, 2634, 2634, 2634, 2634, 2634, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2383, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2383, 2765, 2765, 2765, 2634, 2634, 2634, 2634, 2634, 2634, 406, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2637, 2637, 2637, 2637, 2637, 2637, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2393, 2765, 2765, 2765, 2765, 2765, 2637, 2637, 2637, 2637, 2637, 2637, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2393, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2393, 406, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2640, 2640, 2640, 2640, 2640, 2640, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2403, 2765, 2765, 2765, 2765, 2765, 2640, 2640, 2640, 2640, 2640, 2640, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2403, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2403, 406, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2643, 2643, 2643, 2643, 2643, 2643, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2413, 2765, 2765, 2765, 2765, 2765, 2643, 2643, 2643, 2643, 2643, 2643, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2413, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2413, 406, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2646, 2646, 2646, 2646, 2646, 2646, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2765, 2765, 2765, 2765, 2765, 2765, 2646, 2646, 2646, 2646, 2646, 2646, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 406, 2649, 2649, 2649, 2649, 2649, 2650, 2651, 2651, 406, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2652, 2765, 2653, 2653, 2653, 2653, 2653, 2653, 2653, 2653, 2652, 2765, 2654, 2654, 2654, 2654, 2654, 2655, 2595, 2595, 2652, 2765, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2656, 2765, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2656, 2765, 2658, 2658, 2658, 2658, 2658, 2659, 2599, 2599, 2656, 2765, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 406, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2524, 2765, 2765, 2765, 2765, 2765, 2765, 2661, 2661, 2661, 2661, 2661, 2661, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2765, 2765, 2765, 2765, 2765, 156, 2676, 2677, 2678, 2679, 2679, 2679, 2679, 2679, 2675, 2661, 2661, 2661, 2661, 2661, 2661, 406, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2765, 2765, 2765, 2765, 156, 2765, 2765, 2664, 2664, 2664, 2664, 2664, 2664, 2675, 2623, 2765, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2623, 2765, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2765, 2765, 2664, 2664, 2664, 2664, 2664, 2664, 2623, 2765, 2554, 2554, 2554, 2554, 2554, 2554, 406, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2681, 2681, 2681, 2681, 2681, 2681, 2682, 2682, 2682, 2682, 2682, 2682, 2682, 2682, 2685, 2685, 2685, 2685, 2685, 2685, 2685, 2685, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2681, 2681, 2681, 2681, 2681, 2681, 406, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2684, 2684, 2684, 2684, 2684, 2684, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2684, 2684, 2684, 2684, 2684, 2684, 406, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2687, 2687, 2687, 2687, 2687, 2687, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2687, 2687, 2687, 2687, 2687, 2687, 406, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2690, 2690, 2690, 2690, 2690, 2690, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 406, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2765, 2765, 2765, 2765, 2765, 2765, 2690, 2690, 2690, 2690, 2690, 2690, 406, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2693, 2693, 2693, 2693, 2693, 2693, 406, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 406, 2701, 2701, 2701, 2701, 2701, 2701, 1427, 1427, 2765, 2765, 2765, 2765, 2765, 2693, 2693, 2693, 2693, 2693, 2693, 406, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2696, 2696, 2696, 2696, 2696, 2696, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2702, 2703, 2704, 2705, 2705, 2705, 2705, 2705, 2765, 2765, 2765, 2765, 2765, 2765, 2696, 2696, 2696, 2696, 2696, 2696, 406, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2765, 2765, 2765, 2765, 2765, 156, 2765, 2699, 2699, 2699, 2699, 2699, 2699, 2652, 2716, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2652, 2765, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2765, 156, 2765, 2699, 2699, 2699, 2699, 2699, 2699, 2652, 2716, 2595, 2595, 2595, 2595, 2595, 2595, 2706, 2707, 2708, 2709, 2709, 2709, 2709, 2709, 2656, 2765, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2656, 2765, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2656, 2765, 2599, 2599, 2599, 2599, 2599, 2599, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2524, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2524, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2524, 406, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2711, 2711, 2711, 2711, 2711, 2711, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 156, 2724, 2724, 2724, 2724, 2724, 2724, 2724, 2724, 2717, 2765, 2765, 2765, 2765, 2765, 2711, 2711, 2711, 2711, 2711, 2711, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2719, 156, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2717, 2719, 2765, 2721, 2721, 2721, 2721, 2721, 2722, 2676, 2676, 2719, 2765, 2676, 2676, 2676, 2676, 2676, 2676, 2676, 2676, 406, 2723, 2723, 2723, 2723, 2723, 2723, 2723, 2723, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2560, 2560, 2560, 2560, 2560, 2560, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2765, 2765, 2765, 2765, 2765, 2560, 2560, 2560, 2560, 2560, 2560, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 406, 2726, 2726, 2726, 2726, 2726, 2727, 2728, 2728, 406, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2729, 2765, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2729, 2765, 2731, 2731, 2731, 2731, 2731, 2732, 2706, 2706, 2729, 2765, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 406, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2734, 2734, 2734, 2734, 2734, 2734, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2736, 2765, 2765, 2765, 2765, 2765, 2765, 2719, 156, 2676, 2676, 2676, 2676, 2676, 2676, 2734, 2734, 2734, 2734, 2734, 2734, 2738, 2739, 2740, 2741, 2741, 2741, 2741, 2741, 2736, 2765, 2765, 2765, 2765, 2765, 2765, 2719, 156, 2676, 2676, 2676, 2676, 2676, 2676, 2676, 2676, 2719, 2765, 2676, 2676, 2676, 2676, 2676, 2676, 2676, 2676, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 406, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 406, 2742, 2742, 2742, 2742, 2742, 2742, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 2743, 2744, 2745, 2746, 2746, 2746, 2746, 2746, 2729, 2765, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 2729, 2765, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 2729, 2765, 2706, 2706, 2706, 2706, 2706, 2706, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 156, 406, 674, 674, 674, 674, 674, 674, 674, 674, 2765, 2747, 406, 2749, 2749, 2749, 2749, 2749, 2749, 2749, 2749, 2474, 2765, 2474, 2474, 2765, 2765, 2765, 2474, 156, 406, 2750, 2750, 2750, 2750, 2750, 2751, 2752, 2752, 2765, 2747, 406, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 674, 674, 674, 674, 674, 674, 674, 674, 406, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 406, 2754, 2754, 2754, 2754, 2754, 2755, 2756, 2756, 406, 2756, 2756, 2756, 2756, 2756, 2756, 2756, 2756, 406, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 406, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 406, 2759, 2759, 2759, 2759, 2759, 2759, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 406, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 406, 2760, 2760, 2760, 2760, 2760, 2760, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 406, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 141, 141, 2765, 2765, 2765, 141, 2765, 141, 141, 141, 2765, 141, 141, 141, 141, 141, 141, 141, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 149, 149, 2765, 2765, 2765, 149, 2765, 149, 149, 149, 2765, 149, 149, 149, 149, 149, 149, 149, 302, 2765, 2765, 302, 2765, 302, 2765, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 317, 317, 2765, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 2765, 2765, 2765, 318, 2765, 318, 318, 318, 2765, 318, 318, 2765, 318, 318, 318, 318, 319, 319, 2765, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 322, 322, 2765, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 323, 323, 2765, 2765, 2765, 323, 2765, 323, 323, 323, 2765, 323, 323, 2765, 323, 323, 323, 323, 324, 324, 2765, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 325, 325, 325, 325, 2765, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 2765, 325, 325, 325, 325, 325, 325, 329, 329, 329, 329, 2765, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 332, 332, 332, 332, 2765, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 2765, 332, 332, 332, 332, 332, 332, 334, 334, 334, 334, 2765, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 337, 337, 337, 337, 2765, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 2765, 337, 337, 337, 337, 337, 337, 339, 339, 339, 339, 2765, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 342, 342, 342, 342, 2765, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 2765, 342, 342, 342, 342, 342, 342, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 2765, 344, 2765, 344, 344, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 2765, 345, 345, 345, 345, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 2765, 346, 346, 346, 346, 347, 347, 2765, 2765, 2765, 347, 2765, 347, 347, 347, 2765, 347, 347, 2765, 347, 347, 347, 347, 348, 348, 2765, 2765, 2765, 348, 2765, 348, 348, 348, 2765, 348, 348, 2765, 348, 348, 348, 348, 349, 349, 2765, 2765, 2765, 349, 2765, 349, 349, 349, 2765, 349, 349, 2765, 349, 349, 349, 349, 350, 2765, 2765, 2765, 2765, 350, 350, 350, 350, 350, 350, 350, 350, 2765, 350, 350, 350, 350, 350, 350, 350, 350, 350, 2765, 2765, 350, 350, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 362, 2765, 362, 362, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 362, 362, 2765, 2765, 362, 365, 2765, 2765, 2765, 365, 365, 365, 365, 365, 365, 365, 365, 365, 2765, 365, 365, 365, 365, 365, 365, 365, 365, 365, 2765, 2765, 365, 365, 369, 369, 2765, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 2765, 369, 369, 369, 2765, 369, 369, 369, 369, 369, 369, 2765, 369, 369, 374, 2765, 2765, 2765, 2765, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 376, 376, 2765, 2765, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 378, 378, 2765, 2765, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 141, 141, 2765, 2765, 2765, 141, 2765, 141, 141, 141, 2765, 141, 141, 141, 141, 141, 141, 141, 387, 387, 2765, 2765, 2765, 387, 2765, 387, 387, 387, 2765, 387, 387, 387, 387, 387, 387, 387, 388, 388, 2765, 2765, 2765, 388, 2765, 388, 388, 388, 2765, 388, 388, 2765, 388, 388, 388, 388, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 149, 149, 2765, 2765, 2765, 149, 2765, 149, 149, 149, 2765, 149, 149, 149, 149, 149, 149, 149, 393, 393, 2765, 2765, 2765, 393, 2765, 393, 393, 393, 2765, 393, 393, 393, 393, 393, 393, 393, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 394, 394, 2765, 2765, 2765, 394, 2765, 394, 394, 394, 2765, 394, 394, 394, 394, 394, 394, 394, 302, 2765, 2765, 302, 2765, 302, 2765, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 2765, 2765, 2765, 318, 2765, 318, 318, 318, 2765, 318, 318, 2765, 318, 318, 318, 318, 319, 319, 2765, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 323, 323, 2765, 2765, 2765, 323, 2765, 323, 323, 323, 2765, 323, 323, 2765, 323, 323, 323, 323, 324, 324, 2765, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 325, 325, 325, 325, 2765, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 2765, 325, 325, 325, 325, 325, 325, 631, 631, 631, 631, 2765, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 2765, 631, 631, 2765, 631, 631, 631, 631, 631, 631, 329, 329, 329, 329, 2765, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 632, 632, 632, 632, 2765, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 331, 331, 2765, 2765, 2765, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 332, 332, 332, 332, 2765, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 2765, 332, 332, 332, 332, 332, 332, 633, 633, 633, 633, 2765, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 2765, 633, 633, 633, 633, 633, 633, 334, 334, 334, 334, 2765, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 634, 634, 634, 634, 2765, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 336, 336, 2765, 2765, 2765, 336, 336, 2765, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 2765, 336, 336, 336, 336, 336, 336, 336, 337, 337, 337, 337, 2765, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 339, 339, 339, 339, 2765, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 636, 636, 636, 636, 2765, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 341, 341, 2765, 2765, 2765, 341, 341, 2765, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 342, 342, 342, 342, 2765, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 2765, 342, 342, 342, 342, 342, 342, 638, 638, 638, 638, 2765, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 2765, 638, 638, 638, 638, 638, 638, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 2765, 344, 2765, 344, 344, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 2765, 345, 345, 345, 345, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 2765, 346, 346, 346, 346, 347, 347, 347, 2765, 2765, 2765, 347, 2765, 347, 347, 347, 2765, 347, 347, 2765, 347, 347, 347, 347, 348, 348, 2765, 2765, 2765, 348, 2765, 348, 348, 348, 2765, 348, 348, 2765, 348, 348, 348, 348, 349, 349, 2765, 349, 2765, 349, 2765, 349, 349, 349, 2765, 349, 349, 2765, 349, 349, 349, 349, 350, 2765, 2765, 2765, 2765, 350, 350, 350, 350, 350, 350, 350, 350, 2765, 350, 350, 350, 350, 350, 350, 350, 350, 350, 2765, 2765, 350, 350, 356, 356, 356, 356, 356, 356, 2765, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 2765, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 362, 2765, 362, 362, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 362, 362, 2765, 2765, 362, 365, 2765, 2765, 2765, 365, 365, 365, 365, 365, 365, 365, 365, 365, 2765, 365, 365, 365, 365, 365, 365, 365, 365, 365, 2765, 2765, 365, 365, 369, 369, 2765, 2765, 369, 369, 369, 369, 369, 369, 369, 369, 369, 2765, 369, 369, 369, 2765, 369, 369, 369, 369, 369, 369, 2765, 369, 369, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 374, 2765, 2765, 2765, 2765, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 376, 376, 2765, 2765, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 377, 377, 2765, 2765, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 378, 378, 2765, 2765, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 379, 379, 2765, 2765, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 387, 387, 2765, 2765, 2765, 387, 2765, 387, 387, 387, 2765, 387, 387, 387, 387, 387, 387, 387, 388, 388, 2765, 2765, 2765, 388, 2765, 388, 388, 388, 2765, 388, 388, 2765, 388, 388, 388, 388, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 141, 141, 2765, 2765, 2765, 141, 2765, 141, 141, 141, 2765, 141, 141, 141, 141, 141, 141, 141, 393, 393, 2765, 2765, 2765, 393, 2765, 393, 393, 393, 2765, 393, 393, 393, 393, 393, 393, 393, 394, 394, 2765, 2765, 2765, 394, 2765, 394, 394, 394, 2765, 394, 394, 394, 394, 394, 394, 394, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 319, 319, 2765, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 324, 324, 2765, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 631, 631, 631, 631, 2765, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 2765, 631, 631, 631, 631, 631, 631, 631, 631, 631, 632, 632, 632, 632, 2765, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 633, 633, 633, 633, 2765, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 2765, 633, 633, 633, 633, 633, 633, 634, 634, 634, 634, 2765, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 636, 636, 636, 636, 2765, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 325, 325, 325, 325, 2765, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 2765, 325, 325, 325, 325, 325, 325, 638, 638, 638, 638, 2765, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, 639, 2765, 2765, 2765, 2765, 639, 2765, 639, 639, 2765, 2765, 2765, 639, 639, 2765, 639, 350, 2765, 2765, 2765, 2765, 350, 350, 350, 350, 350, 350, 350, 350, 2765, 350, 350, 350, 350, 350, 350, 350, 350, 350, 2765, 2765, 350, 350, 906, 2765, 906, 906, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 906, 906, 2765, 2765, 906, 650, 650, 650, 650, 650, 650, 2765, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 2765, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, 374, 2765, 2765, 2765, 2765, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 141, 141, 2765, 2765, 2765, 141, 2765, 141, 141, 141, 2765, 141, 141, 141, 141, 141, 141, 141, 394, 394, 2765, 2765, 2765, 394, 2765, 394, 394, 394, 2765, 394, 394, 394, 394, 394, 394, 394, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 331, 331, 2765, 2765, 2765, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 336, 336, 2765, 2765, 2765, 336, 336, 2765, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 2765, 336, 336, 336, 336, 336, 336, 336, 341, 341, 2765, 2765, 2765, 341, 341, 2765, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 906, 2765, 906, 906, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 906, 906, 2765, 2765, 906, 1393, 2765, 1393, 1393, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1393, 1393, 2765, 2765, 1393, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 1393, 2765, 1393, 1393, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1393, 1393, 2765, 2765, 1393, 141, 141, 2765, 2765, 2765, 141, 2765, 141, 141, 141, 2765, 141, 141, 141, 141, 141, 141, 141, 394, 394, 2765, 2765, 2765, 394, 2765, 394, 394, 394, 2765, 394, 394, 394, 394, 394, 394, 394, 1801, 2765, 1801, 1801, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1801, 1801, 2765, 2765, 1801, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1955, 1955, 2765, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1801, 2765, 1801, 1801, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 1801, 1801, 2765, 2765, 1801, 394, 394, 2765, 2765, 2765, 394, 2765, 394, 394, 394, 2765, 394, 394, 394, 394, 394, 394, 394, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1955, 1955, 2765, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2117, 2765, 2117, 2117, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2117, 2117, 2765, 2765, 2117, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1955, 1955, 2765, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2117, 2765, 2117, 2117, 2765, 2117, 2765, 2765, 2765, 2117, 2765, 2117, 2117, 2765, 2765, 2117, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 156, 156, 2765, 2765, 2765, 156, 2765, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 151, 151, 2765, 2765, 2765, 151, 2765, 151, 151, 151, 2765, 151, 151, 151, 151, 151, 151, 151, 23, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765 } ; static const flex_int16_t yy_chk[19187] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 135, 3, 28, 32, 118, 3, 4, 4, 4, 4, 32, 4, 2706, 28, 154, 4, 5, 5, 5, 5, 5, 5, 5, 154, 30, 5, 5, 5, 5, 67, 5, 67, 67, 118, 681, 681, 15, 15, 15, 15, 30, 15, 5, 5, 34, 15, 15, 15, 5, 15, 21, 21, 21, 21, 40, 21, 924, 924, 135, 21, 34, 65, 15, 16, 16, 16, 16, 40, 16, 41, 40, 2365, 16, 16, 16, 65, 16, 19, 19, 19, 19, 2365, 41, 127, 42, 41, 127, 19, 19, 16, 19, 65, 129, 169, 15, 129, 15, 42, 141, 2676, 42, 129, 19, 19, 5, 5, 6, 6, 6, 6, 6, 6, 6, 149, 141, 6, 6, 6, 6, 2627, 6, 16, 169, 16, 33, 22, 22, 22, 22, 149, 22, 2908, 6, 6, 22, 19, 2908, 19, 6, 69, 33, 69, 69, 87, 87, 25, 134, 25, 25, 146, 134, 20, 20, 20, 20, 25, 25, 146, 25, 33, 33, 20, 20, 2607, 20, 71, 71, 87, 71, 375, 71, 25, 375, 87, 71, 151, 20, 20, 36, 36, 36, 36, 36, 36, 36, 36, 2599, 162, 33, 33, 78, 151, 78, 78, 6, 6, 7, 7, 7, 7, 7, 7, 7, 162, 163, 7, 7, 7, 7, 20, 7, 20, 37, 37, 37, 37, 37, 37, 37, 37, 163, 380, 7, 7, 84, 380, 84, 84, 7, 38, 38, 38, 38, 38, 38, 38, 38, 72, 72, 72, 72, 73, 73, 73, 73, 1723, 382, 72, 72, 84, 72, 73, 73, 170, 73, 77, 77, 77, 77, 86, 1723, 86, 86, 72, 1723, 77, 77, 73, 77, 90, 90, 90, 90, 90, 90, 90, 90, 164, 423, 96, 96, 77, 170, 2595, 7, 7, 8, 8, 8, 8, 8, 8, 8, 164, 423, 8, 8, 8, 8, 171, 8, 52, 53, 53, 382, 52, 53, 96, 1200, 1200, 53, 2558, 8, 8, 128, 52, 53, 128, 8, 128, 52, 53, 173, 56, 89, 89, 2554, 56, 171, 89, 52, 53, 53, 173, 52, 53, 56, 56, 115, 53, 115, 115, 56, 746, 52, 53, 1410, 1410, 89, 52, 53, 173, 56, 89, 89, 116, 56, 116, 116, 746, 2529, 303, 173, 303, 303, 56, 56, 91, 91, 2506, 1259, 56, 91, 1259, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 91, 9, 9, 2501, 59, 2496, 91, 59, 59, 1421, 1421, 9, 9, 9, 9, 9, 9, 9, 59, 174, 63, 64, 59, 59, 63, 64, 147, 177, 63, 64, 2491, 97, 97, 59, 63, 64, 59, 59, 64, 63, 64, 178, 147, 182, 9, 9, 9, 59, 174, 63, 64, 59, 59, 63, 64, 768, 177, 63, 64, 97, 2486, 147, 2475, 63, 64, 185, 2474, 64, 63, 64, 178, 768, 182, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 147, 10, 10, 784, 185, 108, 108, 108, 108, 2472, 108, 10, 10, 10, 10, 10, 10, 10, 108, 784, 187, 106, 2440, 106, 106, 110, 106, 110, 110, 389, 106, 106, 106, 188, 106, 110, 110, 389, 110, 109, 109, 109, 109, 191, 10, 10, 10, 106, 109, 187, 376, 110, 109, 376, 1264, 376, 111, 1264, 111, 111, 1660, 1660, 188, 108, 2438, 108, 111, 111, 304, 111, 304, 304, 191, 10, 10, 11, 11, 11, 11, 11, 11, 192, 111, 117, 117, 117, 117, 117, 117, 117, 117, 123, 2370, 123, 123, 911, 123, 109, 194, 109, 123, 11, 2370, 11, 196, 11, 120, 11, 120, 120, 192, 911, 122, 2428, 122, 122, 120, 120, 130, 120, 130, 130, 122, 122, 148, 122, 175, 194, 130, 130, 2916, 130, 120, 196, 11, 2916, 11, 122, 122, 2424, 148, 2418, 175, 159, 130, 159, 159, 159, 159, 159, 159, 155, 148, 155, 155, 155, 155, 155, 155, 155, 155, 175, 2408, 11, 11, 12, 12, 12, 12, 12, 12, 152, 152, 152, 152, 152, 152, 152, 152, 1722, 321, 148, 321, 321, 2398, 152, 1722, 168, 197, 198, 175, 12, 199, 12, 168, 12, 157, 12, 157, 157, 157, 157, 157, 157, 157, 157, 158, 2388, 158, 158, 158, 158, 158, 158, 158, 158, 168, 197, 198, 2377, 200, 199, 186, 168, 12, 1885, 12, 166, 1885, 166, 166, 166, 166, 166, 166, 166, 166, 1811, 1811, 181, 2364, 184, 186, 181, 204, 184, 166, 181, 184, 200, 206, 186, 2312, 12, 12, 13, 13, 13, 13, 13, 13, 13, 1162, 166, 13, 13, 13, 13, 181, 13, 184, 186, 181, 204, 184, 166, 181, 184, 1162, 206, 2289, 13, 13, 207, 193, 203, 210, 13, 212, 203, 216, 167, 166, 167, 167, 167, 167, 167, 167, 167, 167, 176, 193, 176, 176, 176, 176, 176, 176, 176, 176, 167, 207, 193, 203, 210, 2920, 212, 203, 216, 179, 2920, 179, 179, 179, 179, 179, 179, 179, 179, 1476, 193, 211, 218, 2287, 211, 176, 176, 1476, 179, 167, 219, 1163, 13, 13, 14, 14, 14, 14, 14, 14, 14, 179, 1883, 14, 14, 14, 14, 1163, 14, 1883, 211, 218, 201, 211, 176, 176, 201, 179, 205, 219, 14, 14, 220, 201, 195, 222, 14, 195, 205, 180, 179, 180, 180, 180, 180, 180, 180, 180, 180, 195, 223, 201, 215, 215, 195, 201, 217, 205, 217, 225, 228, 220, 201, 195, 222, 378, 195, 205, 378, 229, 1395, 230, 231, 180, 378, 232, 233, 233, 195, 223, 234, 215, 215, 195, 2280, 217, 1395, 217, 225, 228, 1822, 1822, 14, 14, 17, 17, 17, 17, 229, 17, 230, 231, 180, 17, 232, 233, 233, 242, 2278, 234, 2271, 17, 17, 17, 17, 17, 17, 17, 17, 183, 202, 213, 202, 183, 244, 213, 202, 183, 17, 305, 305, 2269, 305, 183, 305, 213, 242, 202, 305, 235, 246, 241, 202, 241, 328, 235, 328, 328, 183, 202, 213, 202, 183, 244, 213, 202, 183, 17, 18, 18, 18, 18, 183, 18, 213, 247, 202, 18, 235, 246, 241, 202, 241, 243, 235, 18, 18, 18, 18, 18, 18, 18, 18, 243, 249, 248, 251, 243, 248, 253, 256, 259, 18, 2262, 247, 1396, 314, 314, 314, 314, 254, 360, 243, 360, 360, 2260, 254, 1929, 262, 314, 1929, 1396, 243, 249, 248, 251, 243, 248, 253, 256, 259, 18, 29, 29, 29, 29, 29, 29, 29, 254, 255, 29, 29, 29, 29, 254, 29, 262, 29, 258, 190, 190, 1479, 2479, 258, 255, 224, 190, 29, 29, 1479, 190, 224, 2479, 29, 190, 237, 263, 224, 255, 190, 237, 224, 224, 265, 224, 240, 237, 258, 190, 190, 237, 240, 258, 255, 224, 190, 268, 240, 240, 190, 224, 29, 1397, 190, 237, 263, 224, 270, 190, 237, 224, 224, 265, 224, 240, 237, 2247, 1741, 1397, 237, 240, 361, 272, 361, 361, 268, 240, 240, 2561, 29, 29, 35, 35, 1741, 1832, 1832, 270, 35, 2561, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 272, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 43, 2246, 43, 43, 43, 43, 43, 43, 43, 43, 257, 260, 261, 264, 261, 261, 273, 276, 274, 43, 43, 260, 274, 278, 279, 2180, 257, 257, 43, 264, 43, 276, 43, 280, 43, 43, 43, 43, 2178, 257, 260, 261, 264, 261, 261, 273, 276, 274, 43, 43, 260, 274, 278, 279, 267, 257, 257, 43, 264, 43, 276, 43, 280, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 250, 267, 2168, 281, 2164, 269, 267, 44, 275, 282, 277, 277, 275, 250, 269, 2158, 269, 284, 250, 250, 269, 277, 269, 285, 2023, 2023, 286, 44, 2148, 250, 267, 44, 281, 271, 269, 271, 44, 275, 282, 277, 277, 275, 250, 269, 271, 269, 284, 250, 250, 269, 277, 269, 285, 283, 271, 286, 44, 283, 287, 1927, 44, 45, 271, 2138, 271, 327, 288, 327, 327, 289, 283, 290, 2127, 271, 291, 1927, 293, 45, 291, 295, 296, 45, 283, 271, 45, 45, 283, 287, 45, 297, 327, 45, 45, 299, 45, 288, 45, 45, 289, 283, 290, 45, 2119, 291, 292, 293, 45, 291, 295, 296, 45, 294, 292, 45, 45, 294, 300, 45, 297, 294, 45, 45, 299, 45, 298, 45, 45, 301, 329, 329, 45, 46, 2054, 292, 298, 2054, 2126, 2126, 345, 345, 294, 292, 1482, 910, 294, 300, 910, 46, 294, 364, 1482, 46, 329, 298, 417, 46, 301, 2118, 329, 910, 46, 46, 315, 298, 315, 315, 345, 46, 415, 46, 419, 46, 315, 315, 2085, 315, 46, 415, 364, 362, 46, 362, 362, 417, 46, 330, 330, 426, 315, 46, 46, 2024, 309, 309, 309, 309, 46, 415, 46, 419, 46, 47, 309, 309, 2091, 309, 415, 2091, 2217, 330, 310, 310, 310, 310, 2001, 330, 426, 47, 309, 47, 310, 310, 433, 310, 2217, 433, 339, 339, 47, 1999, 47, 339, 457, 47, 334, 334, 310, 47, 47, 334, 47, 47, 311, 311, 311, 311, 47, 471, 47, 475, 339, 433, 311, 311, 433, 311, 339, 47, 334, 47, 1992, 457, 47, 334, 334, 391, 47, 47, 311, 47, 47, 48, 312, 312, 312, 312, 471, 1990, 475, 335, 335, 391, 312, 312, 335, 312, 1983, 48, 1483, 313, 313, 313, 313, 391, 477, 48, 1483, 1981, 312, 313, 313, 48, 313, 335, 48, 48, 48, 48, 335, 335, 1969, 48, 1968, 372, 372, 313, 48, 372, 645, 1967, 645, 645, 391, 477, 48, 372, 355, 355, 355, 355, 48, 355, 1956, 48, 48, 48, 48, 372, 1913, 355, 48, 49, 1854, 49, 49, 49, 49, 49, 49, 49, 49, 49, 2449, 478, 316, 2449, 316, 316, 49, 49, 49, 49, 49, 49, 316, 316, 49, 316, 320, 1852, 320, 320, 372, 49, 421, 49, 1842, 49, 320, 320, 316, 320, 478, 421, 355, 1688, 355, 49, 49, 49, 49, 49, 49, 1688, 320, 49, 370, 2222, 370, 370, 392, 370, 49, 421, 49, 370, 49, 50, 50, 429, 480, 50, 421, 2222, 416, 50, 392, 429, 340, 340, 416, 50, 50, 340, 50, 485, 50, 338, 338, 338, 338, 338, 338, 338, 338, 392, 50, 50, 429, 480, 50, 338, 340, 416, 50, 1838, 429, 2927, 340, 416, 50, 50, 2927, 50, 485, 50, 51, 418, 51, 51, 51, 51, 51, 418, 392, 491, 422, 425, 51, 51, 51, 51, 422, 425, 51, 51, 363, 363, 363, 363, 363, 363, 363, 363, 1833, 51, 418, 51, 51, 51, 51, 51, 418, 507, 491, 422, 425, 51, 51, 51, 51, 422, 425, 51, 51, 54, 420, 488, 54, 54, 420, 1823, 906, 54, 906, 906, 488, 54, 351, 54, 351, 351, 507, 351, 54, 2137, 2137, 351, 351, 351, 354, 351, 354, 354, 54, 420, 488, 54, 54, 420, 354, 354, 54, 354, 351, 488, 54, 517, 54, 2147, 2147, 373, 373, 54, 55, 55, 354, 55, 55, 373, 2157, 2157, 55, 373, 543, 424, 55, 427, 55, 424, 55, 427, 55, 55, 430, 373, 517, 446, 55, 359, 446, 359, 359, 55, 55, 430, 55, 55, 2443, 359, 359, 55, 359, 543, 424, 55, 427, 55, 424, 55, 427, 55, 55, 430, 2443, 359, 446, 55, 57, 446, 373, 558, 57, 57, 430, 357, 357, 357, 357, 57, 432, 57, 57, 57, 357, 57, 432, 57, 357, 371, 1812, 371, 371, 367, 371, 367, 367, 57, 371, 1692, 558, 57, 57, 367, 367, 1693, 367, 1692, 57, 432, 57, 57, 57, 1693, 57, 432, 57, 58, 483, 367, 436, 58, 1804, 58, 431, 58, 434, 434, 436, 431, 483, 58, 58, 357, 58, 357, 58, 399, 399, 399, 399, 399, 399, 399, 399, 2450, 58, 483, 2450, 436, 58, 399, 58, 431, 58, 434, 434, 436, 431, 483, 58, 58, 438, 58, 435, 58, 60, 437, 435, 563, 60, 437, 438, 60, 60, 440, 2548, 60, 60, 440, 60, 60, 441, 1803, 60, 60, 60, 441, 60, 2928, 60, 438, 2548, 435, 2928, 60, 437, 435, 563, 60, 437, 438, 60, 60, 440, 442, 60, 60, 440, 60, 60, 441, 442, 60, 60, 60, 441, 60, 439, 60, 61, 443, 61, 439, 61, 1802, 443, 61, 61, 439, 444, 61, 445, 61, 61, 448, 445, 444, 1160, 61, 1160, 1160, 442, 448, 61, 2311, 2311, 439, 1787, 61, 443, 61, 439, 61, 442, 443, 61, 61, 439, 444, 61, 445, 61, 61, 448, 445, 444, 368, 61, 368, 368, 442, 448, 61, 62, 449, 62, 368, 368, 62, 368, 458, 62, 442, 62, 449, 62, 458, 62, 62, 2376, 2376, 368, 368, 406, 406, 406, 406, 406, 406, 406, 406, 1731, 62, 449, 62, 2387, 2387, 62, 1661, 458, 62, 1642, 62, 449, 62, 458, 62, 62, 88, 88, 88, 88, 487, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 487, 88, 88, 408, 408, 408, 408, 408, 408, 408, 408, 88, 88, 88, 88, 88, 88, 395, 487, 395, 395, 395, 395, 395, 395, 395, 395, 1640, 454, 487, 564, 454, 396, 395, 396, 396, 396, 396, 396, 396, 396, 396, 1633, 566, 88, 88, 88, 397, 396, 397, 397, 397, 397, 397, 397, 397, 397, 454, 1631, 564, 454, 1619, 401, 397, 401, 401, 401, 401, 401, 401, 401, 401, 566, 88, 88, 92, 92, 92, 92, 2932, 92, 92, 92, 92, 2932, 92, 92, 92, 92, 92, 92, 398, 92, 398, 398, 398, 398, 398, 398, 398, 398, 92, 92, 92, 92, 92, 92, 398, 409, 409, 409, 409, 409, 409, 409, 409, 410, 410, 410, 410, 410, 410, 411, 1618, 411, 411, 411, 411, 411, 411, 411, 411, 521, 521, 92, 92, 92, 412, 1617, 412, 412, 412, 412, 412, 412, 412, 412, 1440, 414, 1438, 414, 414, 414, 414, 414, 414, 414, 414, 412, 578, 1428, 521, 521, 92, 92, 137, 137, 137, 137, 137, 137, 137, 2397, 2397, 137, 137, 137, 137, 451, 137, 452, 137, 414, 460, 452, 453, 451, 412, 578, 456, 460, 137, 137, 453, 456, 453, 428, 137, 428, 428, 428, 428, 428, 428, 428, 428, 1423, 451, 1422, 452, 1411, 414, 460, 452, 453, 451, 459, 428, 456, 460, 459, 582, 453, 456, 453, 137, 672, 672, 672, 672, 672, 672, 500, 447, 500, 447, 447, 447, 447, 447, 447, 447, 447, 1403, 1878, 459, 428, 2407, 2407, 459, 582, 500, 1878, 137, 137, 138, 138, 138, 138, 138, 138, 138, 447, 476, 138, 138, 138, 138, 450, 138, 450, 450, 450, 450, 450, 450, 450, 450, 455, 476, 500, 138, 138, 465, 461, 450, 1402, 138, 455, 462, 463, 447, 461, 465, 462, 463, 464, 466, 476, 463, 468, 466, 464, 468, 909, 588, 1201, 455, 909, 909, 2417, 2417, 465, 461, 450, 138, 1185, 455, 462, 463, 909, 461, 465, 462, 463, 464, 466, 476, 463, 468, 466, 464, 468, 467, 588, 467, 467, 467, 467, 467, 467, 467, 467, 138, 138, 139, 139, 139, 139, 139, 139, 139, 470, 538, 139, 139, 139, 139, 467, 139, 469, 472, 470, 473, 469, 472, 474, 473, 481, 474, 479, 139, 139, 538, 481, 482, 1183, 139, 479, 484, 486, 470, 492, 482, 484, 486, 531, 467, 492, 469, 472, 470, 473, 469, 472, 474, 473, 481, 474, 479, 531, 1171, 538, 481, 482, 139, 1758, 479, 484, 486, 1881, 492, 482, 484, 486, 531, 1758, 492, 1881, 489, 2941, 490, 1758, 493, 494, 2941, 489, 494, 490, 531, 493, 495, 1170, 139, 139, 140, 140, 140, 140, 140, 140, 140, 495, 497, 140, 140, 140, 140, 489, 140, 490, 140, 493, 494, 497, 489, 494, 490, 496, 493, 495, 140, 140, 496, 498, 499, 501, 140, 498, 502, 504, 495, 497, 499, 503, 506, 502, 505, 513, 520, 503, 504, 501, 497, 505, 506, 508, 496, 508, 520, 513, 594, 496, 498, 499, 140, 1169, 498, 502, 504, 540, 501, 499, 503, 506, 502, 505, 513, 520, 503, 504, 2478, 2478, 505, 506, 508, 540, 508, 520, 513, 594, 2528, 2528, 140, 140, 153, 153, 2885, 2885, 540, 501, 153, 2885, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 540, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 156, 523, 156, 156, 156, 156, 156, 156, 156, 156, 156, 512, 515, 523, 512, 515, 940, 156, 156, 156, 156, 156, 156, 937, 937, 937, 937, 937, 937, 938, 523, 2045, 510, 522, 547, 547, 522, 510, 509, 2045, 512, 515, 523, 512, 515, 509, 156, 156, 156, 156, 156, 156, 161, 161, 161, 161, 161, 161, 161, 161, 161, 510, 522, 547, 547, 522, 510, 509, 161, 161, 161, 161, 161, 161, 509, 670, 670, 670, 670, 670, 670, 670, 670, 928, 511, 514, 925, 511, 516, 525, 511, 514, 1393, 525, 1393, 1393, 917, 161, 161, 161, 161, 161, 161, 189, 516, 189, 189, 189, 189, 189, 189, 189, 189, 511, 514, 579, 511, 518, 525, 511, 514, 519, 525, 516, 189, 518, 524, 519, 526, 528, 526, 524, 527, 519, 529, 530, 527, 579, 529, 189, 528, 526, 916, 530, 189, 1610, 518, 1610, 1610, 682, 519, 668, 516, 189, 518, 524, 519, 526, 528, 526, 524, 527, 519, 529, 530, 527, 579, 529, 189, 528, 526, 532, 530, 189, 266, 532, 266, 266, 533, 534, 266, 667, 534, 266, 535, 533, 266, 536, 535, 266, 266, 605, 266, 266, 997, 652, 997, 997, 536, 997, 532, 650, 640, 266, 532, 266, 266, 533, 534, 266, 537, 534, 266, 535, 533, 266, 536, 535, 266, 266, 605, 266, 266, 332, 332, 332, 332, 536, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, 539, 332, 332, 541, 539, 537, 544, 541, 544, 537, 542, 332, 332, 332, 332, 332, 332, 639, 545, 542, 545, 546, 548, 551, 575, 548, 551, 575, 548, 539, 548, 546, 541, 539, 537, 544, 541, 544, 537, 542, 637, 552, 631, 552, 332, 332, 332, 545, 542, 545, 546, 548, 551, 575, 548, 551, 575, 548, 2942, 548, 546, 549, 630, 2942, 556, 608, 571, 549, 571, 556, 552, 549, 552, 332, 332, 333, 333, 333, 333, 628, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 549, 333, 333, 556, 608, 571, 549, 571, 556, 553, 549, 333, 333, 333, 333, 333, 333, 405, 550, 553, 554, 555, 557, 559, 557, 560, 550, 559, 561, 609, 568, 554, 555, 561, 562, 557, 560, 565, 553, 583, 562, 565, 568, 583, 333, 333, 333, 550, 553, 554, 555, 557, 559, 557, 560, 550, 559, 561, 609, 568, 554, 555, 561, 562, 557, 560, 565, 613, 583, 562, 565, 568, 583, 333, 333, 342, 342, 342, 342, 403, 342, 342, 342, 342, 570, 342, 342, 342, 342, 342, 342, 567, 342, 570, 572, 567, 613, 573, 567, 572, 402, 342, 342, 342, 342, 342, 342, 394, 569, 573, 584, 576, 577, 570, 569, 569, 576, 580, 614, 569, 567, 584, 570, 572, 567, 577, 573, 567, 572, 587, 580, 592, 592, 587, 342, 342, 342, 569, 573, 584, 576, 577, 393, 569, 569, 576, 580, 614, 569, 387, 584, 379, 581, 1008, 577, 618, 1008, 581, 587, 580, 592, 592, 587, 342, 342, 343, 343, 343, 343, 1008, 343, 343, 343, 343, 377, 343, 343, 343, 343, 343, 343, 581, 343, 585, 618, 599, 581, 365, 358, 599, 585, 343, 343, 343, 343, 343, 343, 356, 574, 586, 596, 591, 620, 596, 574, 586, 590, 574, 591, 586, 574, 349, 585, 595, 599, 590, 593, 590, 599, 585, 595, 597, 593, 597, 343, 343, 343, 574, 586, 596, 591, 620, 596, 574, 586, 590, 574, 591, 586, 574, 589, 347, 595, 589, 590, 593, 590, 337, 325, 595, 597, 593, 597, 343, 343, 383, 383, 383, 383, 383, 383, 383, 611, 598, 383, 383, 383, 383, 611, 383, 600, 601, 589, 598, 602, 600, 601, 604, 602, 603, 589, 383, 383, 603, 324, 607, 2050, 383, 606, 607, 604, 611, 598, 589, 2050, 610, 606, 611, 622, 600, 601, 589, 598, 602, 600, 601, 604, 602, 603, 589, 610, 615, 603, 615, 607, 383, 2943, 606, 607, 604, 2052, 2943, 589, 612, 610, 606, 2197, 622, 2052, 612, 2951, 617, 616, 322, 2197, 2951, 617, 624, 624, 610, 615, 616, 615, 383, 383, 384, 384, 384, 384, 384, 384, 384, 612, 619, 384, 384, 384, 384, 612, 384, 617, 616, 621, 619, 623, 617, 624, 624, 625, 646, 616, 384, 384, 621, 623, 319, 317, 384, 306, 625, 632, 632, 619, 634, 634, 636, 636, 239, 634, 238, 636, 621, 619, 623, 691, 686, 690, 625, 646, 686, 690, 227, 621, 623, 632, 384, 665, 634, 625, 636, 632, 209, 634, 634, 208, 636, 657, 165, 649, 649, 160, 665, 649, 691, 686, 690, 692, 658, 686, 690, 649, 709, 657, 384, 384, 385, 385, 385, 385, 385, 385, 385, 649, 658, 385, 385, 385, 385, 2198, 385, 665, 651, 651, 684, 657, 692, 2198, 150, 2213, 651, 709, 385, 385, 651, 144, 658, 2213, 385, 684, 1074, 142, 1074, 1074, 2215, 1074, 651, 132, 649, 684, 689, 689, 2215, 687, 657, 659, 659, 659, 659, 659, 659, 659, 659, 119, 687, 658, 385, 85, 684, 659, 660, 660, 660, 660, 660, 660, 660, 660, 684, 689, 689, 651, 687, 83, 660, 671, 671, 671, 671, 671, 671, 671, 671, 687, 385, 385, 386, 386, 386, 386, 386, 386, 386, 39, 27, 386, 386, 386, 386, 661, 386, 661, 661, 661, 661, 661, 661, 661, 661, 23, 0, 0, 386, 386, 699, 661, 699, 662, 386, 662, 662, 662, 662, 662, 662, 662, 662, 1801, 0, 1801, 1801, 0, 663, 662, 663, 663, 663, 663, 663, 663, 663, 663, 0, 699, 720, 699, 386, 673, 663, 673, 673, 673, 673, 673, 673, 673, 673, 674, 674, 674, 674, 674, 674, 674, 674, 675, 675, 675, 675, 675, 675, 675, 675, 720, 386, 386, 400, 400, 1362, 0, 1362, 1362, 400, 1362, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 0, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 404, 404, 404, 404, 404, 404, 404, 404, 404, 693, 694, 694, 725, 700, 693, 700, 404, 404, 404, 404, 404, 404, 677, 677, 677, 677, 677, 677, 677, 677, 678, 678, 678, 678, 678, 678, 678, 678, 693, 694, 694, 725, 700, 693, 700, 404, 404, 404, 404, 404, 404, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 698, 702, 726, 727, 698, 702, 407, 407, 407, 407, 407, 407, 0, 1364, 0, 1364, 1364, 664, 1364, 664, 664, 664, 664, 664, 664, 664, 664, 664, 0, 698, 702, 726, 727, 698, 702, 407, 407, 407, 407, 407, 407, 413, 664, 413, 413, 413, 413, 413, 413, 413, 413, 413, 701, 729, 710, 730, 703, 701, 413, 413, 413, 413, 413, 413, 703, 710, 413, 0, 0, 0, 679, 664, 679, 679, 679, 679, 679, 679, 679, 679, 0, 701, 729, 710, 730, 703, 701, 413, 413, 413, 413, 413, 413, 703, 710, 413, 633, 633, 633, 633, 1905, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, 0, 633, 633, 695, 1905, 688, 696, 733, 1905, 2328, 0, 633, 633, 633, 633, 633, 633, 2328, 685, 688, 697, 696, 742, 704, 685, 706, 697, 695, 704, 706, 696, 685, 704, 695, 688, 705, 733, 695, 707, 708, 705, 0, 707, 708, 633, 633, 633, 685, 688, 697, 696, 742, 704, 685, 706, 697, 695, 704, 706, 696, 685, 704, 695, 711, 705, 0, 695, 707, 708, 705, 711, 707, 708, 633, 633, 638, 638, 638, 638, 0, 638, 638, 638, 638, 713, 638, 638, 638, 638, 638, 638, 714, 638, 718, 713, 714, 716, 715, 0, 718, 716, 638, 638, 638, 638, 638, 638, 638, 715, 719, 717, 722, 711, 713, 717, 735, 719, 743, 744, 0, 714, 0, 718, 713, 714, 716, 715, 722, 718, 716, 0, 735, 721, 744, 638, 638, 638, 715, 719, 717, 722, 711, 0, 717, 735, 719, 743, 721, 728, 731, 734, 728, 731, 0, 0, 1966, 722, 1966, 1966, 721, 735, 734, 744, 638, 638, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 721, 728, 731, 734, 728, 731, 669, 669, 669, 669, 669, 669, 721, 1164, 734, 2959, 1164, 1164, 1164, 0, 2959, 0, 723, 732, 2330, 752, 732, 723, 736, 1164, 736, 736, 2330, 736, 756, 669, 669, 669, 669, 669, 669, 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, 723, 732, 737, 752, 732, 723, 676, 676, 676, 676, 676, 676, 756, 737, 724, 739, 738, 736, 739, 0, 0, 724, 738, 748, 741, 741, 745, 748, 736, 736, 741, 737, 761, 0, 745, 676, 676, 676, 676, 676, 676, 712, 737, 724, 739, 738, 736, 739, 740, 712, 724, 738, 748, 741, 741, 745, 748, 736, 736, 741, 747, 761, 749, 745, 750, 740, 0, 747, 766, 740, 0, 750, 751, 749, 754, 751, 712, 712, 753, 753, 753, 767, 0, 712, 754, 753, 0, 760, 712, 747, 712, 749, 712, 750, 740, 755, 747, 766, 740, 760, 750, 751, 749, 754, 751, 712, 712, 753, 753, 753, 767, 758, 712, 754, 753, 757, 760, 712, 757, 712, 758, 712, 763, 759, 773, 762, 755, 755, 760, 762, 763, 769, 755, 759, 764, 765, 771, 775, 765, 769, 758, 770, 755, 764, 757, 0, 771, 757, 770, 758, 776, 763, 759, 773, 762, 755, 755, 778, 762, 763, 769, 755, 759, 764, 765, 771, 775, 765, 769, 774, 770, 755, 764, 772, 772, 771, 777, 770, 779, 776, 774, 2339, 780, 781, 777, 785, 778, 782, 782, 2339, 783, 781, 785, 786, 772, 787, 783, 789, 774, 790, 791, 786, 788, 789, 787, 777, 792, 779, 780, 774, 788, 791, 781, 777, 785, 793, 782, 782, 780, 783, 781, 785, 786, 772, 787, 783, 789, 797, 790, 791, 786, 788, 789, 787, 798, 792, 795, 780, 794, 788, 791, 794, 795, 801, 793, 796, 796, 780, 799, 801, 800, 802, 799, 800, 803, 804, 797, 809, 805, 804, 802, 806, 807, 798, 811, 795, 0, 794, 808, 806, 794, 795, 801, 805, 796, 796, 808, 799, 801, 800, 802, 799, 800, 803, 804, 810, 809, 805, 804, 802, 806, 815, 812, 811, 810, 807, 813, 808, 806, 812, 814, 820, 805, 816, 813, 808, 814, 816, 817, 819, 819, 0, 817, 818, 810, 818, 818, 823, 818, 824, 815, 812, 824, 810, 807, 813, 817, 821, 812, 814, 820, 821, 816, 813, 825, 814, 816, 817, 819, 819, 822, 817, 827, 826, 822, 826, 823, 828, 824, 830, 831, 824, 828, 818, 829, 817, 821, 829, 832, 831, 821, 834, 826, 825, 832, 833, 835, 837, 0, 822, 835, 827, 836, 822, 838, 0, 828, 833, 830, 831, 837, 828, 818, 829, 838, 0, 829, 832, 831, 842, 834, 826, 839, 832, 833, 835, 837, 842, 836, 835, 841, 840, 839, 838, 836, 841, 833, 840, 843, 837, 844, 845, 847, 838, 844, 0, 846, 2341, 842, 848, 847, 839, 846, 845, 843, 2341, 842, 836, 849, 841, 840, 839, 849, 836, 841, 848, 840, 843, 850, 844, 845, 847, 852, 844, 850, 846, 851, 852, 848, 847, 853, 846, 845, 843, 853, 851, 854, 849, 855, 856, 857, 849, 858, 856, 848, 854, 859, 850, 855, 860, 859, 852, 861, 850, 864, 851, 852, 860, 864, 853, 862, 869, 869, 853, 851, 854, 863, 855, 856, 857, 862, 858, 856, 0, 854, 859, 863, 855, 860, 859, 865, 861, 869, 864, 868, 866, 860, 864, 865, 862, 866, 867, 870, 2960, 867, 863, 868, 0, 2960, 862, 871, 875, 873, 870, 871, 863, 873, 2342, 0, 865, 0, 869, 879, 868, 866, 2342, 871, 865, 874, 866, 877, 870, 874, 880, 877, 868, 867, 867, 881, 871, 875, 873, 870, 871, 872, 873, 872, 872, 876, 872, 878, 879, 886, 884, 876, 871, 882, 874, 0, 877, 878, 874, 880, 877, 882, 867, 867, 881, 883, 893, 885, 893, 872, 885, 883, 884, 887, 876, 883, 878, 889, 886, 888, 876, 872, 882, 887, 888, 889, 878, 890, 872, 891, 882, 890, 872, 891, 883, 893, 885, 893, 892, 885, 883, 884, 887, 892, 883, 896, 889, 900, 888, 898, 872, 900, 887, 888, 889, 898, 890, 872, 891, 894, 890, 872, 891, 895, 894, 897, 895, 892, 897, 899, 907, 945, 892, 948, 896, 899, 900, 954, 898, 2064, 900, 2064, 2064, 2452, 898, 950, 951, 956, 894, 0, 0, 2452, 895, 894, 897, 895, 0, 897, 899, 907, 945, 954, 948, 912, 899, 912, 912, 912, 912, 912, 912, 912, 912, 0, 950, 951, 956, 970, 913, 912, 913, 913, 913, 913, 913, 913, 913, 913, 0, 2206, 954, 2206, 2206, 914, 913, 914, 914, 914, 914, 914, 914, 914, 914, 971, 0, 0, 970, 0, 915, 914, 915, 915, 915, 915, 915, 915, 915, 915, 920, 920, 920, 920, 920, 920, 920, 920, 2336, 0, 2336, 2336, 0, 953, 971, 915, 921, 921, 921, 921, 921, 921, 921, 921, 922, 953, 922, 922, 922, 922, 922, 922, 922, 922, 927, 927, 927, 927, 927, 927, 927, 927, 953, 0, 915, 918, 918, 918, 918, 918, 918, 918, 918, 918, 953, 0, 0, 0, 974, 975, 976, 918, 918, 918, 918, 918, 918, 929, 0, 929, 929, 929, 929, 929, 929, 929, 929, 930, 0, 930, 930, 930, 930, 930, 930, 930, 930, 974, 975, 976, 918, 918, 918, 918, 918, 918, 919, 919, 919, 919, 919, 919, 919, 919, 919, 919, 0, 943, 978, 979, 982, 943, 919, 919, 919, 919, 919, 919, 931, 0, 931, 931, 931, 931, 931, 931, 931, 931, 933, 933, 933, 933, 933, 933, 933, 933, 943, 978, 979, 982, 943, 919, 919, 919, 919, 919, 919, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 942, 957, 983, 988, 957, 942, 932, 932, 932, 932, 932, 932, 935, 935, 935, 935, 935, 935, 935, 935, 936, 936, 936, 936, 936, 936, 936, 936, 0, 942, 957, 983, 988, 957, 942, 932, 932, 932, 932, 932, 932, 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, 0, 947, 941, 944, 946, 947, 934, 934, 934, 934, 934, 934, 941, 944, 946, 949, 952, 955, 958, 2459, 959, 952, 949, 958, 959, 0, 960, 2459, 955, 960, 947, 941, 944, 946, 947, 934, 934, 934, 934, 934, 934, 941, 944, 946, 949, 952, 955, 958, 963, 959, 952, 949, 958, 959, 961, 962, 964, 955, 965, 966, 994, 963, 967, 961, 962, 967, 960, 968, 964, 965, 966, 984, 0, 968, 969, 981, 960, 963, 980, 969, 981, 984, 0, 961, 962, 964, 980, 965, 966, 994, 963, 967, 961, 962, 967, 960, 968, 964, 965, 966, 984, 977, 968, 969, 981, 960, 977, 980, 969, 981, 984, 977, 985, 986, 996, 980, 987, 985, 989, 987, 991, 986, 990, 989, 991, 990, 992, 993, 995, 999, 977, 993, 992, 1000, 2961, 977, 995, 1003, 0, 2961, 977, 985, 986, 996, 1000, 987, 985, 989, 987, 991, 986, 990, 989, 991, 990, 992, 993, 995, 999, 1001, 993, 992, 1000, 1002, 1004, 995, 1003, 1005, 1010, 1001, 1006, 1004, 1005, 1000, 1002, 1007, 1006, 1012, 1009, 1007, 1009, 1012, 1011, 1013, 1010, 1011, 1013, 1014, 1001, 1018, 1019, 1016, 1002, 1004, 0, 1016, 1005, 1010, 1001, 1006, 1004, 1005, 1021, 1002, 1007, 1006, 1012, 1009, 1007, 1009, 1012, 1011, 1015, 1010, 1011, 1022, 1014, 1017, 1018, 1019, 1016, 1015, 1020, 1013, 1016, 1017, 1023, 1025, 1020, 1024, 1023, 1021, 1026, 1024, 1028, 1027, 1030, 1026, 0, 1028, 1029, 1015, 1033, 1029, 1022, 1027, 1017, 0, 1034, 1035, 1015, 1020, 1013, 1033, 1017, 1023, 1025, 1020, 1024, 1023, 1032, 1026, 1024, 1028, 1027, 1030, 1026, 1031, 1028, 1029, 1031, 1033, 1029, 1036, 1027, 1037, 1032, 1034, 1035, 1040, 1043, 1038, 1033, 1036, 1038, 2539, 1039, 1041, 1037, 1032, 1039, 1041, 1045, 2539, 1042, 1040, 1031, 1042, 1044, 1031, 1046, 1040, 1036, 1052, 1037, 1032, 1046, 1044, 1045, 1043, 1038, 0, 1036, 1038, 1052, 1039, 1041, 1037, 1047, 1039, 1041, 1045, 1048, 1042, 1048, 0, 1042, 1044, 1049, 1046, 1040, 1050, 1052, 1049, 1047, 1046, 1044, 1045, 1051, 1053, 1054, 1050, 1051, 1052, 1055, 1054, 1056, 1047, 1057, 1059, 1058, 1048, 1060, 1048, 1055, 1053, 1061, 1049, 1057, 1058, 1050, 1060, 1049, 1047, 1063, 0, 1065, 1051, 1053, 1054, 1050, 1051, 0, 1055, 1054, 1056, 1081, 1057, 1059, 1058, 1062, 1060, 1064, 1055, 1053, 1061, 1066, 1057, 1058, 1062, 1060, 1067, 1066, 1063, 1064, 1065, 1068, 1070, 1069, 1071, 1072, 1068, 1067, 1069, 1071, 1081, 1073, 1077, 1070, 1062, 1077, 1064, 1073, 1072, 1076, 1066, 1083, 1084, 1062, 0, 1067, 1066, 1076, 1064, 1078, 1068, 1070, 1069, 1071, 1072, 1068, 1067, 1069, 1071, 1086, 1073, 1077, 1070, 1080, 1077, 1078, 1073, 1072, 1076, 1079, 1083, 1084, 1082, 1080, 1079, 1082, 1076, 1085, 1078, 1087, 1088, 1089, 1090, 1091, 1094, 0, 1088, 1087, 1086, 1085, 1092, 1089, 1080, 1093, 1078, 1092, 1095, 1093, 1079, 1091, 1097, 1082, 1080, 1079, 1082, 1097, 1085, 1095, 1087, 1088, 1089, 1090, 1096, 1094, 1091, 1088, 1087, 1098, 1085, 1092, 1089, 1099, 1093, 1096, 1092, 1095, 1093, 1100, 1098, 1097, 1101, 1103, 1104, 1102, 1097, 1105, 1095, 1100, 1102, 1101, 1103, 1096, 1106, 1091, 1108, 1107, 1098, 1099, 1110, 1108, 1099, 1105, 1096, 1107, 1109, 1111, 1100, 1098, 1114, 1101, 1103, 1104, 1102, 1116, 1105, 1109, 1100, 1102, 1101, 1103, 1112, 1106, 1117, 1108, 1107, 1113, 1099, 1110, 1108, 1099, 1105, 1113, 1107, 1109, 1111, 1112, 1115, 1114, 1118, 1120, 1119, 1121, 1116, 1122, 1109, 1123, 1124, 1115, 1125, 1112, 1119, 1117, 2962, 1128, 1113, 1127, 1123, 2962, 1127, 2456, 1113, 2456, 2456, 1128, 1112, 1115, 0, 1118, 1120, 1119, 1121, 1133, 1122, 0, 1123, 1124, 1115, 1125, 1126, 1119, 1126, 1126, 1128, 1126, 1127, 1123, 1129, 1127, 1129, 1129, 1132, 1129, 1128, 1131, 0, 1131, 1131, 1134, 1131, 1132, 1133, 1135, 1137, 1134, 0, 1135, 1126, 1136, 1131, 1136, 0, 1139, 1138, 1137, 1129, 1138, 1139, 1140, 1126, 1132, 0, 1126, 1140, 1141, 1131, 1126, 1134, 1146, 1132, 1126, 1135, 1137, 1134, 1129, 1135, 1141, 1136, 1142, 1136, 1144, 1139, 1138, 1137, 1145, 1138, 1139, 1140, 1126, 1142, 1145, 1126, 1140, 1141, 1148, 1126, 1149, 1146, 1148, 1126, 1143, 1143, 1143, 1129, 1147, 1141, 1150, 1142, 1151, 1147, 1152, 1144, 1153, 1145, 1150, 1155, 1159, 1144, 1142, 1145, 1154, 1144, 1143, 1148, 1156, 1149, 1154, 1148, 1153, 1157, 1156, 1161, 1203, 1147, 1157, 1150, 1158, 1151, 1147, 1152, 1144, 1153, 0, 1150, 1155, 1159, 1144, 1204, 1158, 1154, 1144, 1143, 1208, 1156, 0, 1154, 0, 1153, 1157, 1156, 1161, 1203, 1211, 1157, 1205, 1158, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 0, 1205, 1204, 1158, 1208, 1166, 1165, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 0, 0, 1211, 0, 1205, 1167, 1166, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1205, 0, 0, 1208, 0, 1168, 1167, 1168, 1168, 1168, 1168, 1168, 1168, 1173, 1173, 1173, 1173, 1173, 1173, 1173, 1173, 1168, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1175, 1175, 1175, 1175, 1175, 1175, 1172, 1172, 1172, 1172, 1172, 1172, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1176, 0, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 0, 0, 0, 0, 0, 1172, 1172, 1172, 1172, 1172, 1172, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1182, 1182, 1182, 1182, 1182, 1182, 1177, 1177, 1177, 1177, 1177, 1177, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1180, 1213, 1437, 1437, 1437, 1437, 1437, 1437, 1177, 1177, 1177, 1177, 1177, 1177, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1207, 1215, 1222, 1226, 1207, 1213, 1179, 1179, 1179, 1179, 1179, 1179, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 0, 1207, 1215, 1222, 1226, 1207, 0, 1179, 1179, 1179, 1179, 1179, 1179, 1188, 0, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1189, 0, 1189, 1189, 1189, 1189, 1189, 1189, 1189, 1189, 1190, 0, 1190, 1190, 1190, 1190, 1190, 1190, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1220, 1229, 0, 1230, 1220, 1202, 1195, 1195, 1195, 1195, 1195, 1195, 1196, 1196, 1196, 1196, 1196, 1196, 1196, 1196, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 0, 1220, 1229, 1217, 1230, 1220, 0, 1195, 1195, 1195, 1195, 1195, 1195, 1198, 1202, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1206, 1209, 1210, 1212, 1214, 1216, 1219, 1231, 1232, 1221, 1206, 1210, 1217, 1209, 1212, 1214, 0, 1217, 1219, 1221, 1202, 1223, 1224, 1216, 0, 1233, 1224, 0, 1223, 1206, 1209, 1210, 1212, 1214, 1227, 1219, 1231, 1232, 1221, 1206, 1210, 1217, 1209, 1212, 1214, 1227, 1217, 1219, 1221, 1228, 1223, 1224, 1216, 1218, 1233, 1224, 1218, 1223, 1225, 1235, 1228, 0, 1234, 1227, 1236, 1225, 1240, 1235, 1237, 0, 1241, 0, 1236, 1238, 1227, 1238, 1237, 0, 1228, 1246, 1252, 0, 1239, 0, 0, 0, 1242, 1225, 1218, 1228, 1218, 1234, 1218, 1239, 1225, 1240, 1242, 1236, 1218, 1241, 1218, 1243, 1238, 1218, 1238, 1237, 1235, 1248, 1246, 1252, 1236, 1239, 1243, 1244, 1245, 1242, 1244, 1218, 1245, 1218, 1247, 1218, 1239, 1255, 0, 1242, 1236, 1218, 1247, 1218, 1243, 1255, 1218, 1249, 1237, 1235, 1250, 1256, 1251, 1236, 1250, 1243, 1251, 1245, 1248, 1249, 1257, 1245, 1253, 1247, 1254, 1257, 1255, 1244, 1258, 1253, 0, 1247, 1260, 1261, 1255, 1254, 1249, 1244, 1258, 1250, 1256, 1251, 1260, 1250, 1261, 1251, 1263, 1248, 1249, 1257, 1269, 1253, 0, 1254, 1257, 1263, 1244, 1258, 1253, 1266, 1262, 1260, 1261, 1265, 1254, 1266, 1244, 1258, 1265, 1267, 1268, 1260, 1262, 1261, 1268, 1263, 1270, 1267, 1271, 1269, 1272, 1270, 1273, 1274, 1263, 1275, 1273, 1276, 1266, 1262, 1278, 1275, 1265, 1279, 1266, 1276, 0, 1265, 1267, 1268, 1281, 1262, 1284, 1268, 1279, 1270, 1267, 1271, 1277, 1272, 1270, 1273, 1274, 1277, 1275, 1273, 1276, 1280, 1285, 1278, 1275, 1282, 1279, 1282, 1276, 1280, 1283, 1286, 1287, 1281, 1283, 1284, 1290, 1279, 1285, 1288, 1286, 1277, 1292, 1289, 1288, 1294, 1277, 1290, 1291, 1291, 1280, 1293, 1297, 1285, 1282, 1293, 1282, 1289, 1280, 1283, 1286, 1287, 1295, 1283, 1298, 1290, 1295, 1301, 1288, 1286, 1298, 1292, 1289, 1288, 1294, 1296, 1290, 1291, 1291, 1299, 1293, 1297, 1285, 1300, 1293, 1296, 1289, 0, 1302, 1304, 1300, 1295, 1303, 1298, 1303, 1295, 1301, 1305, 1306, 1298, 1304, 1307, 1308, 1310, 1296, 1309, 1312, 1305, 0, 1306, 1308, 1309, 1300, 1313, 1296, 1311, 1299, 1302, 1304, 1300, 1314, 1303, 1317, 1303, 1315, 1311, 1305, 1306, 1315, 1304, 1307, 1308, 1310, 1316, 1309, 1312, 1305, 1313, 1306, 1308, 1309, 1319, 1316, 1313, 1311, 1299, 1318, 1313, 1320, 1314, 1318, 1317, 1322, 1315, 1311, 1321, 1322, 1315, 1324, 1320, 1323, 1327, 1316, 1325, 1323, 1321, 1313, 1325, 1326, 0, 1319, 1316, 1313, 1324, 1326, 1318, 1313, 1320, 1332, 1318, 0, 1322, 1328, 1335, 1321, 1322, 1330, 1324, 1320, 1323, 1327, 1334, 1325, 1323, 1321, 1330, 1325, 1326, 1328, 1335, 1336, 1329, 1324, 1326, 1329, 1331, 1333, 1332, 1338, 1331, 1333, 1337, 1328, 1339, 1338, 1330, 1340, 1341, 1343, 1335, 1334, 1342, 1337, 1339, 1330, 1344, 2966, 1340, 1343, 1336, 1329, 2966, 1342, 1329, 1331, 1333, 0, 1338, 1331, 1333, 1337, 1328, 1339, 1338, 1345, 1340, 1341, 1343, 1335, 1348, 1342, 1337, 1339, 1348, 1344, 1345, 1340, 1343, 1346, 1347, 1346, 1342, 1349, 1351, 1352, 1350, 1347, 1357, 1359, 0, 1353, 1360, 1361, 1345, 1349, 1350, 1353, 0, 1348, 0, 0, 2971, 1348, 0, 1345, 1363, 2971, 1346, 1347, 1346, 1369, 1349, 1351, 1352, 1350, 1347, 1357, 1359, 1358, 1353, 1360, 1361, 1370, 1349, 1350, 1353, 1354, 1358, 1354, 1354, 1356, 1354, 1356, 1356, 1363, 1356, 1365, 1366, 1367, 1369, 1371, 1366, 1365, 1368, 0, 1356, 1374, 1358, 1368, 1367, 1372, 1370, 1373, 1376, 1354, 1375, 1358, 1374, 1372, 1377, 1378, 1356, 1373, 1375, 1379, 1365, 1366, 1367, 1385, 1371, 1366, 1365, 1368, 1354, 1379, 1374, 1380, 1368, 1367, 1372, 1387, 1373, 1376, 1380, 1375, 1383, 1374, 1372, 1377, 1378, 1381, 1373, 1375, 1379, 1381, 1382, 1383, 1385, 1391, 1441, 1384, 1382, 1354, 1379, 1384, 1380, 1386, 1389, 1388, 1387, 1386, 1389, 1380, 1388, 1383, 1390, 1442, 1390, 1443, 1381, 1392, 2906, 2906, 1381, 1382, 1383, 2906, 1391, 1441, 1384, 1382, 1392, 1442, 1384, 1447, 1386, 1389, 1388, 0, 1386, 1389, 0, 1388, 1445, 1390, 1442, 1390, 1443, 1448, 1392, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1398, 1445, 1392, 1442, 1452, 1447, 1450, 1398, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 1399, 0, 0, 1448, 1445, 1453, 1450, 1399, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1452, 0, 1450, 0, 0, 1454, 1400, 1401, 1401, 1401, 1401, 1401, 1401, 1401, 1401, 1401, 1445, 1453, 1450, 0, 0, 0, 1401, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1444, 1449, 1454, 1444, 1449, 1456, 1457, 1404, 1404, 1404, 1404, 1404, 1404, 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1406, 1407, 1407, 1407, 1407, 1407, 1407, 1407, 1407, 1444, 1449, 0, 1444, 1449, 1456, 1457, 1404, 1404, 1404, 1404, 1404, 1404, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 1405, 0, 0, 0, 1458, 1459, 1460, 1405, 1405, 1405, 1405, 1405, 1405, 1408, 0, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1413, 1413, 1413, 1413, 1413, 1413, 1413, 1413, 1413, 1413, 1458, 1459, 1460, 1405, 1405, 1405, 1405, 1405, 1405, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1455, 1461, 1463, 1468, 1455, 1461, 1416, 1416, 1416, 1416, 1416, 1416, 1417, 1417, 1417, 1417, 1417, 1417, 1417, 1417, 1418, 1418, 1418, 1418, 1418, 1418, 1418, 1418, 0, 1455, 1461, 1463, 1468, 1455, 1461, 1416, 1416, 1416, 1416, 1416, 1416, 1419, 0, 1419, 1419, 1419, 1419, 1419, 1419, 1419, 1419, 1424, 0, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1425, 0, 1425, 1425, 1425, 1425, 1425, 1425, 1425, 1425, 1426, 0, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1427, 1429, 0, 1429, 1429, 1429, 1429, 1429, 1429, 1429, 1429, 1430, 0, 1430, 1430, 1430, 1430, 1430, 1430, 1430, 1430, 1431, 0, 1431, 1431, 1431, 1431, 1431, 1431, 1431, 1431, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1462, 1464, 1469, 1470, 1464, 1462, 1432, 1432, 1432, 1432, 1432, 1432, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1433, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 0, 1462, 1464, 1469, 1470, 1464, 1462, 1432, 1432, 1432, 1432, 1432, 1432, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1466, 1467, 0, 1471, 1466, 1467, 1434, 1434, 1434, 1434, 1434, 1434, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1446, 1451, 1472, 1473, 1474, 1475, 1465, 1451, 0, 1466, 1467, 1446, 1471, 1466, 1467, 1434, 1434, 1434, 1434, 1434, 1434, 1465, 1481, 1485, 1486, 1487, 1489, 1495, 1486, 1446, 1451, 1472, 1473, 1474, 1475, 1465, 1451, 1478, 1488, 0, 1446, 1490, 1488, 1491, 1490, 1478, 1491, 0, 0, 1493, 1465, 1481, 1485, 1486, 1487, 1489, 1492, 1486, 0, 1492, 1493, 1494, 0, 1500, 1496, 1497, 1494, 1488, 1496, 1497, 1498, 1488, 1498, 1498, 1495, 1498, 1499, 1501, 1493, 1500, 1502, 0, 1501, 1491, 1504, 1478, 1507, 1490, 1499, 1493, 1494, 1502, 1500, 1496, 1497, 1494, 1492, 1496, 1497, 1506, 1505, 1503, 1506, 1495, 1505, 1499, 1501, 1503, 1500, 1502, 1498, 1501, 1491, 1504, 1478, 1507, 1490, 1499, 1510, 1508, 1502, 1508, 1509, 1510, 1512, 1492, 1514, 1513, 1506, 1505, 1503, 1506, 1517, 1505, 1509, 1522, 1503, 1511, 1513, 1498, 1515, 1511, 1519, 1516, 1515, 1518, 1519, 1510, 1508, 1516, 1508, 1509, 1510, 1512, 1520, 1514, 1513, 1523, 1518, 0, 1526, 1517, 1526, 1509, 1522, 1520, 1511, 1513, 1523, 1515, 1511, 1519, 1516, 1515, 1518, 1519, 1524, 1521, 1516, 1532, 1525, 0, 1527, 1520, 1521, 0, 1523, 1518, 1530, 1526, 1527, 1526, 1524, 1525, 1520, 1528, 1529, 1523, 1531, 1528, 1529, 1534, 1535, 1530, 1531, 1533, 1536, 1537, 1532, 1525, 1524, 1527, 1538, 1533, 1521, 1539, 1540, 1536, 1541, 1527, 1544, 1541, 1525, 1538, 1528, 1529, 1542, 1531, 1528, 1529, 1534, 1535, 1530, 1531, 1533, 1536, 1537, 1542, 1548, 1524, 1545, 1538, 1533, 1521, 1539, 1540, 1536, 1541, 1543, 1544, 1541, 1547, 1538, 1546, 1543, 1542, 1545, 1549, 1546, 1550, 1551, 1552, 1548, 1547, 1550, 1551, 1542, 1553, 1554, 1555, 0, 1556, 0, 1557, 2972, 1545, 0, 1543, 1556, 2972, 1547, 1559, 1546, 1543, 1559, 0, 1549, 1546, 1550, 1551, 1552, 1548, 1547, 1550, 1551, 1558, 1553, 1554, 1555, 1557, 1556, 1558, 1565, 1560, 1545, 1558, 1558, 1556, 1562, 1561, 1559, 1563, 1562, 1559, 1564, 0, 1571, 1566, 1565, 1560, 1563, 1566, 1572, 1564, 1558, 1561, 1567, 0, 1557, 1567, 1558, 1560, 1568, 1565, 1558, 1558, 1568, 1562, 1561, 1579, 1563, 1562, 1574, 1564, 1569, 1571, 1566, 1574, 1569, 1563, 1566, 1572, 1564, 1575, 1561, 1567, 1573, 1575, 1567, 1576, 1560, 1568, 1565, 0, 1570, 1568, 1570, 1570, 1579, 1570, 1577, 1574, 1573, 1569, 1580, 0, 1574, 1569, 0, 1577, 1578, 1581, 1575, 1583, 1589, 1573, 1575, 0, 1578, 2907, 2907, 0, 1570, 0, 2907, 1582, 1576, 1582, 1582, 1577, 1582, 1573, 1585, 1580, 1570, 0, 1585, 1576, 1577, 1578, 1581, 1570, 1583, 1589, 1570, 1570, 1584, 1578, 1584, 1584, 1586, 1584, 1590, 1587, 1590, 1576, 1586, 1587, 1595, 1588, 1591, 1585, 1588, 1570, 1591, 1585, 1576, 1593, 1596, 1592, 1570, 1593, 1594, 1570, 1570, 1594, 1597, 1598, 1599, 1586, 1597, 1590, 1587, 1590, 1592, 1586, 1587, 1595, 1588, 1591, 1600, 1588, 1606, 1591, 1601, 1605, 1593, 1596, 1601, 1605, 1593, 1594, 1600, 1607, 1594, 1597, 1598, 1599, 1602, 1597, 1602, 1603, 1608, 1592, 1609, 1604, 1608, 1603, 1662, 1600, 1604, 1606, 0, 1601, 1605, 2914, 2914, 1601, 1605, 2973, 2914, 1600, 1607, 1933, 2973, 1933, 1933, 1602, 1933, 1602, 1603, 1608, 0, 1609, 1604, 1608, 1603, 1662, 0, 1604, 1611, 1611, 1611, 1611, 1611, 1611, 1611, 1611, 1623, 1623, 1623, 1623, 1623, 1623, 1611, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1630, 1630, 1630, 1630, 1630, 1630, 1612, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1639, 1639, 1639, 1639, 1639, 1639, 1613, 1614, 1614, 1614, 1614, 1614, 1614, 1614, 1614, 1614, 0, 0, 0, 0, 1666, 1666, 1614, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1665, 0, 0, 0, 0, 0, 1615, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1665, 1666, 1666, 0, 0, 0, 1616, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1667, 1668, 1665, 1667, 1670, 1671, 1620, 1620, 1620, 1620, 1620, 1620, 1621, 1621, 1621, 1621, 1621, 1621, 1621, 1621, 1622, 1622, 1622, 1622, 1622, 1622, 1622, 1622, 0, 1667, 1668, 1665, 1667, 1670, 1671, 1620, 1620, 1620, 1620, 1620, 1620, 1624, 0, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1669, 1672, 1674, 1675, 1676, 1669, 1625, 1625, 1625, 1625, 1625, 1625, 1626, 1626, 1626, 1626, 1626, 1626, 1626, 1626, 1628, 1628, 1628, 1628, 1628, 1628, 1628, 1628, 1677, 1669, 1672, 1674, 1675, 1676, 1669, 1625, 1625, 1625, 1625, 1625, 1625, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1678, 1679, 1685, 1686, 1687, 1677, 1627, 1627, 1627, 1627, 1627, 1627, 1629, 1629, 1629, 1629, 1629, 1629, 1629, 1629, 1635, 1635, 1635, 1635, 1635, 1635, 1635, 1635, 0, 1678, 1679, 1685, 1686, 1687, 0, 1627, 1627, 1627, 1627, 1627, 1627, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1634, 1680, 1683, 1689, 1680, 1683, 1690, 1634, 1634, 1634, 1634, 1634, 1634, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1691, 1680, 1683, 1689, 1680, 1683, 1690, 1634, 1634, 1634, 1634, 1634, 1634, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 1636, 0, 1696, 1697, 1699, 1701, 1691, 1636, 1636, 1636, 1636, 1636, 1636, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1644, 0, 1644, 1644, 1644, 1644, 1644, 1644, 1644, 1644, 1696, 1697, 1699, 1701, 0, 1636, 1636, 1636, 1636, 1636, 1636, 1645, 0, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1646, 0, 1646, 1646, 1646, 1646, 1646, 1646, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1647, 1648, 0, 1648, 1648, 1648, 1648, 1648, 1648, 1648, 1648, 1649, 0, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1649, 1650, 0, 1650, 1650, 1650, 1650, 1650, 1650, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1651, 1652, 1652, 1652, 1652, 1652, 1652, 1652, 1652, 1652, 1652, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1654, 1654, 1654, 1654, 1654, 1654, 1654, 1654, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1655, 1695, 0, 1700, 1700, 0, 1695, 1655, 1655, 1655, 1655, 1655, 1655, 1656, 1656, 1656, 1656, 1656, 1656, 1656, 1656, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 0, 1695, 1698, 1700, 1700, 1698, 1695, 1655, 1655, 1655, 1655, 1655, 1655, 1658, 1704, 1658, 1658, 1658, 1658, 1658, 1658, 1658, 1658, 1663, 1663, 1681, 1684, 0, 1673, 1663, 1682, 1663, 1663, 1663, 1673, 1684, 1702, 1682, 1705, 1681, 1706, 1714, 1663, 1704, 1663, 1663, 1663, 1663, 1663, 1694, 0, 1702, 1698, 1703, 1681, 1684, 1694, 1673, 0, 1682, 1707, 1707, 1703, 1673, 1684, 1702, 1682, 1705, 1681, 1706, 1714, 0, 1709, 0, 0, 1663, 1663, 1663, 1664, 1664, 1702, 1698, 1703, 1694, 1664, 1712, 1664, 1664, 1664, 1707, 1707, 1703, 1708, 1709, 1711, 1712, 1715, 1664, 1694, 1664, 1664, 1664, 1664, 1664, 1708, 1710, 1709, 1711, 1717, 1664, 0, 1710, 1694, 0, 1712, 1713, 1713, 1716, 1716, 1718, 1718, 1708, 1709, 1711, 1712, 1715, 1724, 1694, 1719, 1719, 1664, 1664, 1664, 1708, 1710, 1709, 1711, 1717, 1664, 1720, 1710, 1721, 1721, 1725, 1713, 1713, 1716, 1716, 1718, 1718, 1726, 1726, 1727, 1728, 1729, 1724, 1730, 1719, 1719, 1725, 1720, 1734, 1737, 1733, 1738, 1728, 1735, 1732, 1739, 1735, 1721, 1721, 1725, 1720, 1736, 1729, 1732, 1733, 1740, 1726, 1726, 1727, 1728, 1742, 0, 1730, 1740, 1736, 1729, 1720, 1734, 1737, 1733, 1738, 1728, 1735, 1732, 1739, 1735, 1743, 1744, 1725, 1720, 1736, 1729, 1732, 1733, 1740, 1745, 1746, 1747, 1747, 1742, 1743, 1748, 1740, 1736, 1729, 1746, 1749, 1750, 1751, 1752, 1754, 1751, 1753, 1756, 1757, 1743, 1744, 1748, 1755, 1759, 1755, 1749, 1759, 1761, 1745, 1746, 1747, 1747, 1753, 1743, 0, 1762, 0, 1748, 1746, 1749, 1750, 1751, 1752, 1754, 1751, 1760, 1756, 1757, 1760, 1762, 1767, 1755, 1759, 1755, 1749, 1759, 1761, 1753, 1770, 0, 1763, 1766, 1763, 1763, 1762, 1763, 1748, 1765, 1768, 1765, 1765, 1768, 1765, 1766, 1760, 1769, 1773, 1760, 1762, 1767, 1771, 1771, 1765, 1777, 1769, 1778, 1753, 1770, 1763, 1772, 1766, 1774, 1772, 1776, 1774, 1775, 1775, 1768, 1765, 1779, 1768, 0, 1766, 1784, 1769, 1773, 1776, 1763, 1780, 1771, 1771, 1780, 1777, 1769, 1778, 1781, 1781, 1789, 1772, 1785, 1774, 1772, 1776, 1774, 1775, 1775, 1782, 1782, 1779, 1783, 1783, 1785, 1784, 1786, 1791, 1776, 1763, 1780, 1792, 1788, 1780, 1788, 1786, 1790, 1781, 1781, 1789, 1793, 1785, 1795, 1795, 1797, 1794, 1790, 1796, 1782, 1782, 1798, 1783, 1783, 1785, 1794, 1786, 1791, 1855, 1861, 1796, 1792, 1788, 0, 1788, 1786, 1790, 1799, 1800, 0, 1793, 0, 1795, 1795, 1797, 1794, 1790, 1796, 1860, 1860, 1798, 1799, 1800, 0, 1794, 0, 0, 1855, 1861, 1796, 1851, 1851, 1851, 1851, 1851, 1851, 1799, 1800, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1857, 1860, 1860, 0, 1799, 1800, 1805, 1805, 1805, 1805, 1805, 1805, 1805, 1805, 1805, 0, 1857, 1857, 1862, 1863, 1864, 1865, 1805, 1805, 1805, 1805, 1805, 1805, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1809, 0, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1857, 1862, 1863, 1864, 1865, 1805, 1805, 1805, 1805, 1805, 1805, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 0, 0, 0, 1866, 1867, 1869, 1806, 1806, 1806, 1806, 1806, 1806, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1866, 1867, 1869, 1806, 1806, 1806, 1806, 1806, 1806, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1816, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1868, 1871, 1873, 1873, 1868, 1877, 1817, 1817, 1817, 1817, 1817, 1817, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 0, 1868, 1871, 1873, 1873, 1868, 1877, 1817, 1817, 1817, 1817, 1817, 1817, 1820, 0, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1825, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1827, 1874, 1880, 1882, 1886, 1888, 1874, 1827, 1827, 1827, 1827, 1827, 1827, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1829, 1829, 1829, 1829, 1829, 1829, 1829, 1829, 0, 1874, 1880, 1882, 1886, 1888, 1874, 1827, 1827, 1827, 1827, 1827, 1827, 1830, 0, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1839, 0, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1840, 0, 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1841, 0, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1843, 0, 1843, 1843, 1843, 1843, 1843, 1843, 1843, 1843, 1844, 1894, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1845, 0, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1846, 1890, 1896, 1890, 1897, 1899, 1894, 1846, 1846, 1846, 1846, 1846, 1846, 1847, 1847, 1847, 1847, 1847, 1847, 1847, 1847, 1849, 1849, 1849, 1849, 1849, 1849, 1849, 1849, 1901, 1890, 1896, 1890, 1897, 1899, 1894, 1846, 1846, 1846, 1846, 1846, 1846, 1848, 1848, 1848, 1848, 1848, 1848, 1848, 1848, 1848, 1848, 1848, 0, 1904, 0, 0, 0, 1901, 1848, 1848, 1848, 1848, 1848, 1848, 1850, 1850, 1850, 1850, 1850, 1850, 1850, 1850, 0, 1903, 0, 1870, 1875, 1876, 0, 1859, 1916, 1870, 1904, 1875, 1872, 1876, 0, 1848, 1848, 1848, 1848, 1848, 1848, 1856, 1856, 1859, 0, 1872, 1884, 1856, 0, 1856, 1856, 1856, 1870, 1884, 0, 1903, 1859, 1916, 1870, 1918, 1856, 1872, 1856, 1856, 1856, 1856, 1856, 1876, 1887, 1856, 1906, 2974, 1859, 1875, 1872, 1884, 2974, 1891, 1906, 0, 0, 1892, 1884, 1887, 1903, 1921, 1892, 1889, 1918, 1906, 1891, 0, 0, 1856, 1856, 1856, 1876, 1887, 1856, 1858, 1858, 1889, 1875, 1893, 1911, 1858, 1891, 1858, 1858, 1858, 1892, 1906, 1887, 1893, 1921, 1892, 1889, 1895, 1858, 1891, 1858, 1858, 1858, 1858, 1858, 1898, 1898, 1895, 1900, 1902, 1889, 1908, 1893, 1900, 1909, 1909, 1902, 1907, 1911, 0, 1906, 1920, 1893, 1858, 1910, 1907, 1895, 1908, 1908, 0, 1915, 1858, 1858, 1858, 1898, 1898, 1895, 1900, 1902, 1910, 1915, 1914, 1900, 1909, 1909, 1902, 1914, 1911, 1917, 1923, 1923, 1922, 1858, 1910, 1917, 1920, 1922, 1908, 1907, 1915, 1924, 1926, 0, 1925, 1925, 1928, 1934, 1926, 1910, 1915, 1914, 1930, 1930, 0, 0, 1914, 1924, 1917, 1923, 1923, 1922, 2975, 1931, 1917, 1920, 1922, 2975, 1907, 1931, 1932, 1926, 1924, 1925, 1925, 1928, 1934, 1926, 1937, 1941, 1932, 1930, 1930, 1935, 1937, 1935, 1935, 1936, 1935, 1938, 1939, 1936, 1931, 1943, 1938, 1940, 1940, 1942, 1931, 1932, 1944, 1924, 1945, 1942, 1946, 1939, 1947, 1937, 1941, 1932, 1948, 1948, 1951, 1937, 1949, 1949, 1936, 1950, 1938, 1939, 1936, 1950, 1943, 1938, 1940, 1940, 1942, 1952, 1957, 1944, 1953, 1945, 1942, 1946, 1939, 1947, 1954, 1958, 1954, 1948, 1948, 1951, 1960, 1949, 1949, 1963, 1950, 1964, 1953, 1965, 1950, 1961, 1961, 1962, 1962, 2980, 1952, 1957, 0, 1953, 2980, 0, 2827, 2827, 2827, 1954, 1958, 1954, 2827, 0, 2117, 1960, 2117, 2117, 1963, 2117, 1964, 1953, 1965, 2117, 1961, 1961, 1962, 1962, 1970, 1970, 1970, 1970, 1970, 1970, 1970, 1970, 1970, 1970, 1970, 1973, 1973, 1973, 1973, 1973, 1973, 1970, 1970, 1970, 1970, 1970, 1970, 1971, 1971, 1971, 1971, 1971, 1971, 1971, 1971, 1972, 1972, 1972, 1972, 1972, 1972, 1972, 1972, 1980, 1980, 1980, 1980, 1980, 1980, 0, 1970, 1970, 1970, 1970, 1970, 1970, 1974, 0, 1974, 1974, 1974, 1974, 1974, 1974, 1974, 1974, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1989, 1989, 1989, 1989, 1989, 1989, 1975, 1975, 1975, 1975, 1975, 1975, 1976, 1976, 1976, 1976, 1976, 1976, 1976, 1976, 1978, 1978, 1978, 1978, 1978, 1978, 1978, 1978, 1998, 1998, 1998, 1998, 1998, 1998, 0, 1975, 1975, 1975, 1975, 1975, 1975, 1977, 1977, 1977, 1977, 1977, 1977, 1977, 1977, 1977, 1977, 1977, 2025, 2029, 2030, 2031, 2032, 2033, 1977, 1977, 1977, 1977, 1977, 1977, 1979, 1979, 1979, 1979, 1979, 1979, 1979, 1979, 1985, 1985, 1985, 1985, 1985, 1985, 1985, 1985, 0, 2025, 2029, 2030, 2031, 2032, 2033, 1977, 1977, 1977, 1977, 1977, 1977, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 1984, 2035, 2037, 2038, 2039, 2040, 2041, 1984, 1984, 1984, 1984, 1984, 1984, 1987, 1987, 1987, 1987, 1987, 1987, 1987, 1987, 1988, 1988, 1988, 1988, 1988, 1988, 1988, 1988, 2042, 2035, 2037, 2038, 2039, 2040, 2041, 1984, 1984, 1984, 1984, 1984, 1984, 1986, 1986, 1986, 1986, 1986, 1986, 1986, 1986, 1986, 1986, 1986, 2047, 2048, 2049, 2053, 2055, 2042, 1986, 1986, 1986, 1986, 1986, 1986, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1996, 1996, 1996, 1996, 1996, 1996, 1996, 1996, 0, 2047, 2048, 2049, 2053, 2055, 0, 1986, 1986, 1986, 1986, 1986, 1986, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 2059, 2060, 2061, 2062, 2063, 2066, 1993, 1993, 1993, 1993, 1993, 1993, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2059, 2060, 2061, 2062, 2063, 2066, 1993, 1993, 1993, 1993, 1993, 1993, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 0, 2067, 2068, 2080, 2081, 2082, 1995, 1995, 1995, 1995, 1995, 1995, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2067, 2068, 2080, 2081, 2082, 1995, 1995, 1995, 1995, 1995, 1995, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2007, 0, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2008, 0, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2009, 0, 2009, 2009, 2009, 2009, 2009, 2009, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2011, 0, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2012, 0, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2013, 0, 2013, 2013, 2013, 2013, 2013, 2013, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2083, 2089, 2090, 2093, 2094, 2095, 2018, 2018, 2018, 2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 0, 2083, 2089, 2090, 2093, 2094, 2095, 2018, 2018, 2018, 2018, 2018, 2018, 2021, 2027, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2026, 2026, 0, 2069, 2071, 2072, 2026, 2027, 2026, 2026, 2026, 2069, 2071, 2072, 2096, 2076, 0, 2097, 0, 2026, 2075, 2026, 2026, 2026, 2026, 2026, 2073, 2027, 2075, 2100, 2026, 2076, 2915, 2915, 2073, 2101, 2102, 2915, 0, 0, 0, 0, 2072, 2096, 2069, 2071, 2097, 2088, 2103, 0, 0, 2076, 2026, 2026, 2026, 0, 2027, 2075, 2100, 2026, 2028, 2028, 2084, 2088, 2101, 2102, 2028, 2073, 2028, 2028, 2028, 2072, 2104, 2069, 2071, 2088, 2106, 2103, 2084, 2028, 2076, 2028, 2028, 2028, 2028, 2028, 2075, 2108, 2109, 2110, 2111, 2112, 2114, 2115, 2181, 2185, 2073, 2084, 0, 2183, 0, 2104, 0, 0, 2088, 2106, 2177, 2177, 2177, 2177, 2177, 2177, 2028, 2028, 2028, 2183, 2108, 2109, 2110, 2111, 2112, 2114, 2115, 2181, 2185, 0, 2084, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2183, 2186, 2187, 2188, 2189, 2190, 2191, 2120, 2120, 2120, 2120, 2120, 2120, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2183, 2186, 2187, 2188, 2189, 2190, 2191, 2120, 2120, 2120, 2120, 2120, 2120, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 0, 0, 0, 2192, 2193, 2194, 2121, 2121, 2121, 2121, 2121, 2121, 2124, 0, 2124, 2124, 2124, 2124, 2124, 2124, 2124, 2124, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2192, 2193, 2194, 2121, 2121, 2121, 2121, 2121, 2121, 2130, 2130, 2130, 2130, 2130, 2130, 2130, 2130, 2130, 2130, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2196, 2199, 2201, 2202, 2204, 2202, 2132, 2132, 2132, 2132, 2132, 2132, 2133, 2133, 2133, 2133, 2133, 2133, 2133, 2133, 2134, 2134, 2134, 2134, 2134, 2134, 2134, 2134, 0, 2196, 2199, 2201, 2202, 2204, 2202, 2132, 2132, 2132, 2132, 2132, 2132, 2135, 0, 2135, 2135, 2135, 2135, 2135, 2135, 2135, 2135, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2207, 2214, 2216, 2218, 2218, 2220, 2142, 2142, 2142, 2142, 2142, 2142, 2143, 2143, 2143, 2143, 2143, 2143, 2143, 2143, 2144, 2144, 2144, 2144, 2144, 2144, 2144, 2144, 0, 2207, 2214, 2216, 2218, 2218, 2220, 2142, 2142, 2142, 2142, 2142, 2142, 2145, 0, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2221, 2224, 2224, 2226, 2228, 2221, 2152, 2152, 2152, 2152, 2152, 2152, 2153, 2153, 2153, 2153, 2153, 2153, 2153, 2153, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 0, 2221, 2224, 2224, 2226, 2228, 2221, 2152, 2152, 2152, 2152, 2152, 2152, 2155, 0, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2163, 2163, 2163, 2163, 2163, 2163, 2163, 2163, 2163, 2165, 0, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2166, 0, 2166, 2166, 2166, 2166, 2166, 2166, 2166, 2166, 2167, 0, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2169, 0, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2170, 0, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2171, 0, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2225, 2229, 2232, 2229, 2233, 2225, 2172, 2172, 2172, 2172, 2172, 2172, 2173, 2173, 2173, 2173, 2173, 2173, 2173, 2173, 2175, 2175, 2175, 2175, 2175, 2175, 2175, 2175, 0, 2225, 2229, 2232, 2229, 2233, 2225, 2172, 2172, 2172, 2172, 2172, 2172, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2231, 2231, 2236, 0, 2238, 2203, 2174, 2174, 2174, 2174, 2174, 2174, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2212, 0, 0, 2203, 2195, 0, 2208, 0, 2212, 2231, 2231, 2236, 2195, 2238, 2203, 2174, 2174, 2174, 2174, 2174, 2174, 2182, 2182, 2205, 2208, 0, 0, 2182, 2210, 2182, 2182, 2182, 2203, 2195, 2205, 2208, 2210, 2212, 0, 2239, 2182, 2195, 2182, 2182, 2182, 2182, 2182, 2209, 0, 2219, 2237, 0, 2205, 2208, 2209, 2219, 2223, 2237, 2241, 2242, 2243, 2234, 2227, 2205, 2182, 0, 2212, 2234, 2239, 2210, 2313, 0, 2223, 2182, 2182, 2182, 2209, 2227, 2219, 2237, 2230, 2223, 2317, 2209, 2219, 2230, 2237, 2241, 2242, 2243, 2234, 2227, 0, 2182, 2184, 2184, 2234, 0, 2210, 2313, 2184, 0, 2184, 2184, 2184, 0, 2227, 2319, 2320, 2230, 2223, 2317, 0, 2184, 2230, 2184, 2184, 2184, 2184, 2184, 0, 2240, 0, 2240, 2240, 2244, 2240, 2244, 2244, 0, 2244, 0, 0, 0, 2244, 0, 2319, 2320, 2321, 2184, 2252, 2252, 2252, 2252, 2252, 2252, 2184, 2184, 2184, 2240, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 0, 2321, 2184, 2322, 2323, 2253, 2240, 2253, 2253, 2253, 2253, 2253, 2253, 2253, 2253, 2255, 2255, 2255, 2255, 2255, 2255, 2255, 2255, 2257, 2257, 2257, 2257, 2257, 2257, 2257, 2257, 0, 2322, 2323, 0, 2240, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2259, 2259, 2259, 2259, 2259, 2259, 2248, 2248, 2248, 2248, 2248, 2248, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2268, 2268, 2268, 2268, 2268, 2268, 0, 2248, 2248, 2248, 2248, 2248, 2248, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2277, 2277, 2277, 2277, 2277, 2277, 2249, 2249, 2249, 2249, 2249, 2249, 2266, 2266, 2266, 2266, 2266, 2266, 2266, 2266, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2286, 2286, 2286, 2286, 2286, 2286, 0, 2249, 2249, 2249, 2249, 2249, 2249, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2325, 2326, 2327, 2332, 2340, 2343, 2254, 2254, 2254, 2254, 2254, 2254, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2275, 2275, 2275, 2275, 2275, 2275, 2275, 2275, 2345, 2325, 2326, 2327, 2332, 2340, 2343, 2254, 2254, 2254, 2254, 2254, 2254, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2338, 2350, 2351, 2352, 2338, 2345, 2256, 2256, 2256, 2256, 2256, 2256, 2276, 2276, 2276, 2276, 2276, 2276, 2276, 2276, 2282, 2282, 2282, 2282, 2282, 2282, 2282, 2282, 0, 2338, 2350, 2351, 2352, 2338, 0, 2256, 2256, 2256, 2256, 2256, 2256, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2353, 2355, 2355, 2357, 2353, 2358, 2263, 2263, 2263, 2263, 2263, 2263, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2360, 2353, 2355, 2355, 2357, 2353, 2358, 2263, 2263, 2263, 2263, 2263, 2263, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 0, 2441, 2445, 2446, 2447, 2360, 2265, 2265, 2265, 2265, 2265, 2265, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2441, 2445, 2446, 2447, 0, 2265, 2265, 2265, 2265, 2265, 2265, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2368, 2368, 2368, 2368, 2368, 2368, 2272, 2272, 2272, 2272, 2272, 2272, 2292, 2292, 2292, 2292, 2292, 2292, 2292, 2292, 2292, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 0, 0, 0, 0, 0, 2272, 2272, 2272, 2272, 2272, 2272, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2437, 2437, 2437, 2437, 2437, 2437, 2274, 2274, 2274, 2274, 2274, 2274, 2294, 2294, 2294, 2294, 2294, 2294, 2294, 2294, 2295, 2344, 2295, 2295, 2295, 2295, 2295, 2295, 2295, 2295, 0, 0, 0, 0, 0, 2274, 2274, 2274, 2274, 2274, 2274, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 0, 2460, 2461, 2344, 2466, 2530, 2281, 2281, 2281, 2281, 2281, 2281, 2296, 0, 2296, 2296, 2296, 2296, 2296, 2296, 2296, 2296, 2297, 2534, 2297, 2297, 2297, 2297, 2297, 2297, 2460, 2461, 2344, 2466, 2530, 2281, 2281, 2281, 2281, 2281, 2281, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2534, 2535, 2536, 2544, 2545, 2546, 2283, 2283, 2283, 2283, 2283, 2283, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2299, 0, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2535, 2536, 2544, 2545, 2546, 2283, 2283, 2283, 2283, 2283, 2283, 2300, 0, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2301, 0, 2301, 2301, 2301, 2301, 2301, 2301, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2306, 2306, 2306, 2306, 2306, 2306, 2306, 2306, 2306, 2306, 2361, 2541, 2361, 2361, 2541, 2361, 2306, 2306, 2306, 2306, 2306, 2306, 2307, 2307, 2307, 2307, 2307, 2307, 2307, 2307, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2361, 0, 2541, 0, 0, 2541, 0, 2306, 2306, 2306, 2306, 2306, 2306, 2309, 2315, 2309, 2309, 2309, 2309, 2309, 2309, 2309, 2309, 2314, 2314, 2333, 2334, 0, 2335, 2314, 2315, 2314, 2314, 2314, 2337, 2346, 2334, 2347, 0, 0, 2547, 2333, 2314, 2335, 2314, 2314, 2314, 2314, 2314, 2315, 2337, 2346, 2348, 2347, 2333, 2334, 2347, 2335, 2349, 0, 2549, 0, 0, 2337, 2346, 2334, 2354, 2348, 2314, 2547, 2333, 0, 2335, 2550, 2349, 2314, 2314, 2314, 2315, 2337, 2346, 2348, 2354, 0, 2463, 2347, 0, 2349, 2359, 2549, 2359, 2359, 0, 2359, 0, 2354, 2348, 2314, 2316, 2316, 2463, 0, 2550, 2349, 2316, 0, 2316, 2316, 2316, 0, 2362, 2354, 2362, 2362, 0, 2362, 2359, 2316, 2533, 2316, 2316, 2316, 2316, 2316, 2359, 2463, 2533, 2366, 2316, 2366, 2366, 2366, 2366, 2366, 2366, 2366, 2366, 2366, 2362, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 2533, 0, 0, 2316, 2316, 2316, 2359, 2463, 2533, 0, 2316, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 0, 0, 2543, 2552, 2608, 2543, 2609, 2369, 2369, 2369, 2369, 2369, 2369, 2373, 2373, 2373, 2373, 2373, 2373, 2373, 2373, 2374, 0, 2374, 2374, 2374, 2374, 2374, 2374, 2374, 2374, 2543, 2552, 2608, 2543, 2609, 2369, 2369, 2369, 2369, 2369, 2369, 2371, 2371, 2371, 2371, 2371, 2371, 2371, 2371, 2371, 2371, 0, 0, 0, 2612, 2614, 2616, 2371, 2371, 2371, 2371, 2371, 2371, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2612, 2614, 2616, 2371, 2371, 2371, 2371, 2371, 2371, 2381, 2381, 2381, 2381, 2381, 2381, 2381, 2381, 2381, 2381, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 0, 2553, 2618, 2619, 2673, 2553, 2382, 2382, 2382, 2382, 2382, 2382, 2384, 2384, 2384, 2384, 2384, 2384, 2384, 2384, 2385, 0, 2385, 2385, 2385, 2385, 2385, 2385, 2385, 2385, 2553, 2618, 2619, 2673, 2553, 2382, 2382, 2382, 2382, 2382, 2382, 2389, 2389, 2389, 2389, 2389, 2389, 2389, 2389, 2389, 2389, 2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390, 2390, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2392, 2392, 2392, 2392, 2392, 2392, 2392, 2392, 2392, 2392, 0, 2610, 2668, 2668, 2610, 2675, 2392, 2392, 2392, 2392, 2392, 2392, 2394, 2394, 2394, 2394, 2394, 2394, 2394, 2394, 2395, 0, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2610, 2668, 2668, 2610, 2675, 2392, 2392, 2392, 2392, 2392, 2392, 2399, 2399, 2399, 2399, 2399, 2399, 2399, 2399, 2399, 2399, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2401, 2401, 2401, 2401, 2401, 2401, 2401, 2401, 2401, 2401, 2402, 2402, 2402, 2402, 2402, 2402, 2402, 2402, 2402, 2402, 0, 2615, 2714, 2715, 2716, 2615, 2402, 2402, 2402, 2402, 2402, 2402, 2404, 2404, 2404, 2404, 2404, 2404, 2404, 2404, 2405, 0, 2405, 2405, 2405, 2405, 2405, 2405, 2405, 2405, 2615, 2714, 2715, 2716, 2615, 2402, 2402, 2402, 2402, 2402, 2402, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2412, 2412, 2412, 2412, 2412, 2412, 2412, 2412, 2412, 2412, 0, 2617, 2717, 2718, 2737, 2617, 2412, 2412, 2412, 2412, 2412, 2412, 2414, 2414, 2414, 2414, 2414, 2414, 2414, 2414, 2415, 0, 2415, 2415, 2415, 2415, 2415, 2415, 2415, 2415, 2617, 2717, 2718, 2737, 2617, 2412, 2412, 2412, 2412, 2412, 2412, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2425, 0, 2425, 2425, 2425, 2425, 2425, 2425, 2425, 2425, 2426, 0, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2427, 0, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2429, 0, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2430, 0, 2430, 2430, 2430, 2430, 2430, 2430, 2430, 2430, 2431, 0, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2470, 2747, 2470, 2470, 2748, 2470, 2432, 2432, 2432, 2432, 2432, 2432, 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2470, 2471, 2747, 2471, 2471, 2748, 2471, 2432, 2432, 2432, 2432, 2432, 2432, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2667, 2758, 2762, 2763, 2667, 2471, 2434, 2434, 2434, 2434, 2434, 2434, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2473, 2473, 2473, 2473, 2473, 2473, 2473, 2473, 0, 2667, 2758, 2762, 2763, 2667, 0, 2434, 2434, 2434, 2434, 2434, 2434, 2442, 2442, 2451, 2453, 2454, 0, 2442, 2455, 2442, 2442, 2442, 0, 2451, 2453, 2454, 2611, 2454, 2455, 2457, 2442, 2464, 2442, 2442, 2442, 2442, 2442, 2611, 2469, 2457, 0, 2464, 2451, 2453, 2454, 2442, 0, 2455, 2469, 0, 0, 2542, 2451, 2453, 2454, 2611, 2454, 2455, 2457, 0, 2464, 2542, 0, 2442, 2442, 2442, 2611, 2469, 2457, 0, 2464, 0, 2458, 0, 2442, 2444, 2444, 2469, 2462, 2465, 2542, 2444, 2458, 2444, 2444, 2444, 2458, 0, 2462, 2465, 2542, 0, 2462, 2465, 2444, 2467, 2444, 2444, 2444, 2444, 2444, 2458, 2467, 0, 0, 2467, 2444, 2462, 2465, 2468, 0, 2458, 0, 0, 0, 2458, 2444, 2462, 2465, 2468, 0, 2462, 2465, 2468, 2467, 2918, 2918, 2444, 2444, 2444, 2918, 2467, 0, 0, 2467, 2444, 0, 2514, 2468, 2514, 2514, 2514, 2514, 2514, 2514, 2444, 0, 0, 2468, 0, 0, 2476, 2468, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2480, 2480, 2480, 2480, 2480, 2480, 2480, 2480, 2480, 0, 2620, 0, 2620, 2620, 0, 2620, 2480, 2480, 2480, 2480, 2480, 2480, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2620, 2919, 2919, 0, 0, 0, 2919, 2480, 2480, 2480, 2480, 2480, 2480, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2621, 0, 2621, 2621, 0, 2621, 2482, 2482, 2482, 2482, 2482, 2482, 2488, 2488, 2488, 2488, 2488, 2488, 2488, 2488, 2493, 2493, 2493, 2493, 2493, 2493, 2493, 2493, 2621, 2925, 2925, 0, 0, 0, 2925, 2482, 2482, 2482, 2482, 2482, 2482, 2484, 2484, 2484, 2484, 2484, 2484, 2484, 2484, 2484, 2666, 0, 0, 0, 0, 0, 2666, 2484, 2484, 2484, 2484, 2484, 2484, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 2503, 2503, 2503, 2503, 2503, 2503, 2503, 2503, 2666, 0, 0, 0, 0, 0, 2666, 2484, 2484, 2484, 2484, 2484, 2484, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2926, 2926, 0, 0, 0, 2926, 2487, 2487, 2487, 2487, 2487, 2487, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 2508, 2508, 2508, 2508, 2508, 2508, 2508, 2508, 2508, 0, 0, 0, 0, 0, 2487, 2487, 2487, 2487, 2487, 2487, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2930, 2930, 0, 0, 0, 2930, 0, 2489, 2489, 2489, 2489, 2489, 2489, 2509, 2509, 2509, 2509, 2509, 2509, 2509, 2509, 2509, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 0, 0, 0, 0, 0, 2489, 2489, 2489, 2489, 2489, 2489, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2931, 2931, 0, 0, 0, 2931, 2492, 2492, 2492, 2492, 2492, 2492, 2511, 2511, 2511, 2511, 2511, 2511, 2511, 2511, 2512, 0, 2512, 2512, 2512, 2512, 2512, 2512, 2512, 2512, 0, 0, 0, 0, 0, 2492, 2492, 2492, 2492, 2492, 2492, 2494, 2494, 2494, 2494, 2494, 2494, 2494, 2494, 2494, 2939, 2939, 0, 0, 0, 2939, 0, 2494, 2494, 2494, 2494, 2494, 2494, 2513, 0, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 0, 0, 0, 0, 0, 2494, 2494, 2494, 2494, 2494, 2494, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2940, 2940, 0, 0, 0, 2940, 2497, 2497, 2497, 2497, 2497, 2497, 2516, 0, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2517, 0, 2517, 2517, 2517, 2517, 2517, 2517, 2517, 2517, 0, 0, 0, 2497, 2497, 2497, 2497, 2497, 2497, 2499, 2499, 2499, 2499, 2499, 2499, 2499, 2499, 2499, 2949, 2949, 0, 0, 0, 2949, 0, 2499, 2499, 2499, 2499, 2499, 2499, 2518, 0, 2518, 2518, 2518, 2518, 2518, 2518, 2519, 2519, 2519, 2519, 2519, 2519, 2519, 2519, 2519, 2519, 0, 0, 0, 0, 0, 2499, 2499, 2499, 2499, 2499, 2499, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2950, 2950, 0, 0, 0, 2950, 2502, 2502, 2502, 2502, 2502, 2502, 2520, 2520, 2520, 2520, 2520, 2520, 2520, 2520, 2520, 2520, 2521, 2521, 2521, 2521, 2521, 2521, 2521, 2521, 2521, 2521, 0, 0, 0, 2502, 2502, 2502, 2502, 2502, 2502, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2757, 0, 0, 0, 0, 0, 2757, 2504, 2504, 2504, 2504, 2504, 2504, 2522, 2522, 2522, 2522, 2522, 2522, 2522, 2522, 2525, 2525, 2525, 2525, 2525, 2525, 2525, 2525, 2757, 0, 0, 0, 0, 0, 2757, 2504, 2504, 2504, 2504, 2504, 2504, 2523, 2523, 2523, 2523, 2523, 2523, 2523, 2523, 2523, 2523, 2957, 2957, 0, 0, 0, 2957, 2523, 2523, 2523, 2523, 2523, 2523, 2526, 0, 2526, 2526, 2526, 2526, 2526, 2526, 2526, 2526, 0, 2761, 0, 0, 0, 2551, 2761, 2551, 2551, 0, 2551, 0, 0, 2523, 2523, 2523, 2523, 2523, 2523, 2531, 2531, 2958, 2958, 0, 0, 2531, 2958, 2531, 2531, 2531, 2761, 2965, 2965, 2551, 0, 2761, 2965, 0, 2531, 0, 2531, 2531, 2531, 2531, 2531, 2551, 0, 0, 0, 2555, 2531, 2555, 2555, 2555, 2555, 2555, 2555, 2555, 2555, 2556, 0, 2556, 2556, 2556, 2556, 2556, 2556, 2556, 2556, 0, 0, 2531, 2531, 2531, 2551, 0, 0, 2969, 2969, 2531, 2532, 2532, 2969, 0, 0, 0, 2532, 0, 2532, 2532, 2532, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2532, 0, 2532, 2532, 2532, 2532, 2532, 2978, 2978, 0, 0, 0, 2978, 0, 2557, 2532, 2557, 2557, 2557, 2557, 2557, 2557, 2557, 2557, 2560, 2560, 2560, 2560, 2560, 2560, 2560, 2560, 2560, 2532, 2532, 2532, 2569, 2569, 2569, 2569, 2569, 2569, 2569, 2569, 2532, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2979, 2979, 0, 0, 0, 2979, 0, 2559, 2559, 2559, 2559, 2559, 2559, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2566, 2566, 2566, 2566, 2566, 2566, 2566, 2566, 2566, 2566, 0, 0, 0, 2559, 2559, 2559, 2559, 2559, 2559, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2983, 2983, 0, 0, 0, 2983, 0, 2562, 2562, 2562, 2562, 2562, 2562, 2567, 2567, 2567, 2567, 2567, 2567, 2567, 2567, 2567, 2567, 2570, 2570, 2570, 2570, 2570, 2570, 2570, 2570, 2570, 2570, 0, 0, 0, 2562, 2562, 2562, 2562, 2562, 2562, 2568, 2568, 2568, 2568, 2568, 2568, 2568, 2568, 2568, 0, 0, 0, 0, 0, 0, 0, 2568, 2568, 2568, 2568, 2568, 2568, 2571, 2571, 2571, 2571, 2571, 2571, 2571, 2571, 2571, 2571, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 0, 0, 0, 2568, 2568, 2568, 2568, 2568, 2568, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 0, 0, 0, 0, 0, 0, 0, 2573, 2573, 2573, 2573, 2573, 2573, 2574, 2574, 2574, 2574, 2574, 2574, 2574, 2574, 2575, 2575, 2575, 2575, 2575, 2575, 2575, 2575, 2575, 2575, 0, 0, 0, 0, 0, 2573, 2573, 2573, 2573, 2573, 2573, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 0, 0, 0, 0, 0, 0, 0, 2578, 2578, 2578, 2578, 2578, 2578, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 0, 0, 0, 0, 0, 2578, 2578, 2578, 2578, 2578, 2578, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 0, 0, 0, 0, 0, 0, 0, 2583, 2583, 2583, 2583, 2583, 2583, 2584, 2584, 2584, 2584, 2584, 2584, 2584, 2584, 2585, 2585, 2585, 2585, 2585, 2585, 2585, 2585, 2585, 2585, 0, 0, 0, 0, 0, 2583, 2583, 2583, 2583, 2583, 2583, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 0, 0, 0, 0, 0, 0, 0, 2588, 2588, 2588, 2588, 2588, 2588, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 2590, 0, 0, 0, 0, 0, 0, 2588, 2588, 2588, 2588, 2588, 2588, 2591, 2591, 2591, 2591, 2591, 2591, 2591, 2591, 2591, 2592, 2592, 2592, 2592, 2592, 2592, 2592, 2592, 2592, 2593, 2593, 2593, 2593, 2593, 2593, 2593, 2593, 2593, 2594, 2594, 2594, 2594, 2594, 2594, 2594, 2594, 2594, 2596, 0, 2596, 2596, 2596, 2596, 2596, 2596, 2596, 2596, 2597, 0, 2597, 2597, 2597, 2597, 2597, 2597, 2597, 2597, 2598, 0, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2600, 0, 2600, 2600, 2600, 2600, 2600, 2600, 2600, 2600, 2601, 0, 2601, 2601, 2601, 2601, 2601, 2601, 2601, 2601, 2602, 0, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 0, 0, 0, 0, 0, 0, 2603, 2603, 2603, 2603, 2603, 2603, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 0, 0, 0, 0, 0, 2622, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2622, 2603, 2603, 2603, 2603, 2603, 2603, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 0, 0, 0, 0, 2622, 0, 0, 2605, 2605, 2605, 2605, 2605, 2605, 2622, 2624, 0, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2625, 0, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 0, 0, 2605, 2605, 2605, 2605, 2605, 2605, 2626, 0, 2626, 2626, 2626, 2626, 2626, 2626, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 0, 0, 0, 0, 0, 0, 0, 2628, 2628, 2628, 2628, 2628, 2628, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 0, 0, 0, 0, 0, 0, 0, 2628, 2628, 2628, 2628, 2628, 2628, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 0, 0, 0, 0, 0, 0, 0, 2630, 2630, 2630, 2630, 2630, 2630, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 0, 0, 0, 0, 0, 0, 0, 2630, 2630, 2630, 2630, 2630, 2630, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 0, 0, 0, 0, 0, 0, 0, 2633, 2633, 2633, 2633, 2633, 2633, 2640, 2640, 2640, 2640, 2640, 2640, 2640, 2640, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 0, 0, 0, 0, 0, 0, 0, 2633, 2633, 2633, 2633, 2633, 2633, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 0, 0, 0, 0, 0, 0, 0, 2636, 2636, 2636, 2636, 2636, 2636, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 0, 0, 0, 0, 0, 0, 2636, 2636, 2636, 2636, 2636, 2636, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 0, 0, 0, 0, 0, 0, 0, 2639, 2639, 2639, 2639, 2639, 2639, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 0, 0, 0, 0, 0, 2639, 2639, 2639, 2639, 2639, 2639, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 0, 0, 0, 0, 0, 0, 0, 2642, 2642, 2642, 2642, 2642, 2642, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2652, 2652, 2652, 2652, 2652, 2652, 2652, 2652, 0, 0, 0, 0, 0, 0, 2642, 2642, 2642, 2642, 2642, 2642, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 0, 0, 0, 0, 0, 2671, 0, 2645, 2645, 2645, 2645, 2645, 2645, 2653, 2671, 2653, 2653, 2653, 2653, 2653, 2653, 2653, 2653, 2654, 0, 2654, 2654, 2654, 2654, 2654, 2654, 2654, 2654, 0, 2671, 0, 2645, 2645, 2645, 2645, 2645, 2645, 2655, 2671, 2655, 2655, 2655, 2655, 2655, 2655, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 2657, 0, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2658, 0, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2659, 0, 2659, 2659, 2659, 2659, 2659, 2659, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 0, 0, 0, 0, 0, 0, 0, 2663, 2663, 2663, 2663, 2663, 2663, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2672, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2672, 0, 0, 0, 0, 0, 2663, 2663, 2663, 2663, 2663, 2663, 0, 0, 0, 0, 0, 0, 0, 2677, 2672, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2672, 2678, 0, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2679, 0, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 0, 0, 0, 0, 0, 0, 0, 2680, 2680, 2680, 2680, 2680, 2680, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 0, 0, 0, 0, 0, 2680, 2680, 2680, 2680, 2680, 2680, 2685, 2685, 2685, 2685, 2685, 2685, 2685, 2685, 2685, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2707, 0, 2707, 2707, 2707, 2707, 2707, 2707, 2707, 2707, 2708, 0, 2708, 2708, 2708, 2708, 2708, 2708, 2708, 2708, 2709, 0, 2709, 2709, 2709, 2709, 2709, 2709, 2709, 2709, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 0, 0, 0, 0, 0, 0, 0, 2710, 2710, 2710, 2710, 2710, 2710, 2711, 2711, 2711, 2711, 2711, 2711, 2711, 2711, 2713, 0, 0, 0, 0, 0, 0, 2722, 2713, 2722, 2722, 2722, 2722, 2722, 2722, 2710, 2710, 2710, 2710, 2710, 2710, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2713, 0, 0, 0, 0, 0, 0, 2720, 2713, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2721, 0, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2723, 2723, 2723, 2723, 2723, 2723, 2723, 2723, 2723, 2724, 2724, 2724, 2724, 2724, 2724, 2724, 2724, 2724, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2726, 2726, 2726, 2726, 2726, 2726, 2726, 2726, 2726, 2727, 2727, 2727, 2727, 2727, 2727, 2727, 2727, 2727, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2729, 2729, 2729, 2729, 2729, 2729, 2729, 2729, 2730, 0, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2731, 0, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2732, 0, 2732, 2732, 2732, 2732, 2732, 2732, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2736, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 0, 2736, 2739, 2739, 2739, 2739, 2739, 2739, 2739, 2739, 2739, 2970, 0, 2970, 2970, 0, 0, 0, 2970, 2736, 2740, 2740, 2740, 2740, 2740, 2740, 2740, 2740, 2740, 0, 2736, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2746, 2746, 2746, 2746, 2746, 2746, 2746, 2746, 2746, 2749, 2749, 2749, 2749, 2749, 2749, 2749, 2749, 2749, 2750, 2750, 2750, 2750, 2750, 2750, 2750, 2750, 2750, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2754, 2754, 2754, 2754, 2754, 2754, 2754, 2754, 2754, 2755, 2755, 2755, 2755, 2755, 2755, 2755, 2755, 2755, 2756, 2756, 2756, 2756, 2756, 2756, 2756, 2756, 2756, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 2760, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2766, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2767, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2769, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2772, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2774, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2776, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2778, 2778, 0, 0, 0, 2778, 0, 2778, 2778, 2778, 0, 2778, 2778, 2778, 2778, 2778, 2778, 2778, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2779, 2780, 2780, 0, 0, 0, 2780, 0, 2780, 2780, 2780, 0, 2780, 2780, 2780, 2780, 2780, 2780, 2780, 2781, 0, 0, 2781, 0, 2781, 0, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2782, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2784, 2784, 0, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2785, 2785, 0, 0, 0, 2785, 0, 2785, 2785, 2785, 0, 2785, 2785, 0, 2785, 2785, 2785, 2785, 2786, 2786, 0, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2786, 2787, 2787, 0, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2788, 2788, 0, 0, 0, 2788, 0, 2788, 2788, 2788, 0, 2788, 2788, 0, 2788, 2788, 2788, 2788, 2789, 2789, 0, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2790, 2790, 2790, 2790, 0, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 0, 2790, 2790, 2790, 2790, 2790, 2790, 2791, 2791, 2791, 2791, 0, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2792, 2792, 2792, 2792, 0, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 0, 2792, 2792, 2792, 2792, 2792, 2792, 2793, 2793, 2793, 2793, 0, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2793, 2794, 2794, 2794, 2794, 0, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 2794, 0, 2794, 2794, 2794, 2794, 2794, 2794, 2795, 2795, 2795, 2795, 0, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2795, 2796, 2796, 2796, 2796, 0, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 0, 2796, 2796, 2796, 2796, 2796, 2796, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 2797, 0, 2797, 0, 2797, 2797, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 0, 2798, 2798, 2798, 2798, 2799, 2799, 2799, 2799, 2799, 2799, 2799, 2799, 2799, 2799, 2799, 2799, 0, 2799, 2799, 2799, 2799, 2800, 2800, 0, 0, 0, 2800, 0, 2800, 2800, 2800, 0, 2800, 2800, 0, 2800, 2800, 2800, 2800, 2801, 2801, 0, 0, 0, 2801, 0, 2801, 2801, 2801, 0, 2801, 2801, 0, 2801, 2801, 2801, 2801, 2802, 2802, 0, 0, 0, 2802, 0, 2802, 2802, 2802, 0, 2802, 2802, 0, 2802, 2802, 2802, 2802, 2803, 0, 0, 0, 0, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 0, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 0, 0, 2803, 2803, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2806, 0, 2806, 2806, 0, 0, 0, 0, 0, 0, 0, 2806, 2806, 0, 0, 2806, 2807, 0, 0, 0, 2807, 2807, 2807, 2807, 2807, 2807, 2807, 2807, 2807, 0, 2807, 2807, 2807, 2807, 2807, 2807, 2807, 2807, 2807, 0, 0, 2807, 2807, 2808, 2808, 0, 2808, 2808, 2808, 2808, 2808, 2808, 2808, 2808, 2808, 2808, 0, 2808, 2808, 2808, 0, 2808, 2808, 2808, 2808, 2808, 2808, 0, 2808, 2808, 2809, 0, 0, 0, 0, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2809, 2810, 2810, 0, 0, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2810, 2811, 2811, 0, 0, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2811, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2812, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2815, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2816, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2818, 2818, 0, 0, 0, 2818, 0, 2818, 2818, 2818, 0, 2818, 2818, 2818, 2818, 2818, 2818, 2818, 2819, 2819, 0, 0, 0, 2819, 0, 2819, 2819, 2819, 0, 2819, 2819, 2819, 2819, 2819, 2819, 2819, 2820, 2820, 0, 0, 0, 2820, 0, 2820, 2820, 2820, 0, 2820, 2820, 0, 2820, 2820, 2820, 2820, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2821, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2823, 2823, 0, 0, 0, 2823, 0, 2823, 2823, 2823, 0, 2823, 2823, 2823, 2823, 2823, 2823, 2823, 2824, 2824, 0, 0, 0, 2824, 0, 2824, 2824, 2824, 0, 2824, 2824, 2824, 2824, 2824, 2824, 2824, 2825, 2825, 0, 0, 0, 2825, 0, 2825, 2825, 2825, 0, 2825, 2825, 2825, 2825, 2825, 2825, 2825, 2826, 2826, 0, 0, 0, 2826, 0, 2826, 2826, 2826, 0, 2826, 2826, 2826, 2826, 2826, 2826, 2826, 2828, 0, 0, 2828, 0, 2828, 0, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2828, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2829, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2830, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2831, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2832, 2833, 2833, 0, 0, 0, 2833, 0, 2833, 2833, 2833, 0, 2833, 2833, 0, 2833, 2833, 2833, 2833, 2834, 2834, 0, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2834, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2835, 2836, 2836, 0, 0, 0, 2836, 0, 2836, 2836, 2836, 0, 2836, 2836, 0, 2836, 2836, 2836, 2836, 2837, 2837, 0, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2837, 2838, 2838, 2838, 2838, 0, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 2838, 0, 2838, 2838, 2838, 2838, 2838, 2838, 2839, 2839, 2839, 2839, 0, 2839, 2839, 2839, 2839, 2839, 2839, 2839, 2839, 2839, 2839, 2839, 2839, 0, 2839, 2839, 0, 2839, 2839, 2839, 2839, 2839, 2839, 2840, 2840, 2840, 2840, 0, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2840, 2841, 2841, 2841, 2841, 0, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2841, 2842, 2842, 0, 0, 0, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2842, 2843, 2843, 2843, 2843, 0, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 0, 2843, 2843, 2843, 2843, 2843, 2843, 2844, 2844, 2844, 2844, 0, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 2844, 0, 2844, 2844, 2844, 2844, 2844, 2844, 2845, 2845, 2845, 2845, 0, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2845, 2846, 2846, 2846, 2846, 0, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2846, 2847, 2847, 0, 0, 0, 2847, 2847, 0, 2847, 2847, 2847, 2847, 2847, 2847, 2847, 2847, 2847, 2847, 2847, 0, 2847, 2847, 2847, 2847, 2847, 2847, 2847, 2848, 2848, 2848, 2848, 0, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2848, 2849, 2849, 2849, 2849, 0, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2849, 2850, 2850, 2850, 2850, 0, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2850, 2851, 2851, 0, 0, 0, 2851, 2851, 0, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2852, 2852, 2852, 2852, 0, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 2852, 0, 2852, 2852, 2852, 2852, 2852, 2852, 2853, 2853, 2853, 2853, 0, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 2853, 0, 2853, 2853, 2853, 2853, 2853, 2853, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 2854, 0, 2854, 0, 2854, 2854, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 2855, 0, 2855, 2855, 2855, 2855, 2856, 2856, 2856, 2856, 2856, 2856, 2856, 2856, 2856, 2856, 2856, 2856, 0, 2856, 2856, 2856, 2856, 2857, 2857, 2857, 0, 0, 0, 2857, 0, 2857, 2857, 2857, 0, 2857, 2857, 0, 2857, 2857, 2857, 2857, 2858, 2858, 0, 0, 0, 2858, 0, 2858, 2858, 2858, 0, 2858, 2858, 0, 2858, 2858, 2858, 2858, 2859, 2859, 0, 2859, 0, 2859, 0, 2859, 2859, 2859, 0, 2859, 2859, 0, 2859, 2859, 2859, 2859, 2860, 0, 0, 0, 0, 2860, 2860, 2860, 2860, 2860, 2860, 2860, 2860, 0, 2860, 2860, 2860, 2860, 2860, 2860, 2860, 2860, 2860, 0, 0, 2860, 2860, 2861, 2861, 2861, 2861, 2861, 2861, 0, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2861, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 0, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2862, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2863, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2864, 2865, 0, 2865, 2865, 0, 0, 0, 0, 0, 0, 0, 2865, 2865, 0, 0, 2865, 2866, 0, 0, 0, 2866, 2866, 2866, 2866, 2866, 2866, 2866, 2866, 2866, 0, 2866, 2866, 2866, 2866, 2866, 2866, 2866, 2866, 2866, 0, 0, 2866, 2866, 2867, 2867, 0, 0, 2867, 2867, 2867, 2867, 2867, 2867, 2867, 2867, 2867, 0, 2867, 2867, 2867, 0, 2867, 2867, 2867, 2867, 2867, 2867, 0, 2867, 2867, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2868, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2869, 2870, 0, 0, 0, 0, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2871, 2871, 0, 0, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2871, 2872, 2872, 0, 0, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2873, 2873, 0, 0, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2873, 2874, 2874, 0, 0, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2874, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2875, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2876, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2877, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2878, 2879, 2879, 0, 0, 0, 2879, 0, 2879, 2879, 2879, 0, 2879, 2879, 2879, 2879, 2879, 2879, 2879, 2880, 2880, 0, 0, 0, 2880, 0, 2880, 2880, 2880, 0, 2880, 2880, 0, 2880, 2880, 2880, 2880, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2881, 2882, 2882, 0, 0, 0, 2882, 0, 2882, 2882, 2882, 0, 2882, 2882, 2882, 2882, 2882, 2882, 2882, 2883, 2883, 0, 0, 0, 2883, 0, 2883, 2883, 2883, 0, 2883, 2883, 2883, 2883, 2883, 2883, 2883, 2884, 2884, 0, 0, 0, 2884, 0, 2884, 2884, 2884, 0, 2884, 2884, 2884, 2884, 2884, 2884, 2884, 2886, 2886, 0, 0, 0, 2886, 0, 2886, 2886, 2886, 0, 2886, 2886, 2886, 2886, 2886, 2886, 2886, 2887, 2887, 0, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2887, 2888, 2888, 0, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2889, 2889, 2889, 2889, 0, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 0, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2889, 2890, 2890, 2890, 2890, 0, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2890, 2891, 2891, 2891, 2891, 0, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 2891, 0, 2891, 2891, 2891, 2891, 2891, 2891, 2892, 2892, 2892, 2892, 0, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2893, 2893, 2893, 2893, 0, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2893, 2894, 2894, 2894, 2894, 0, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 2894, 0, 2894, 2894, 2894, 2894, 2894, 2894, 2895, 2895, 2895, 2895, 0, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2895, 2896, 0, 0, 0, 0, 2896, 0, 2896, 2896, 0, 0, 0, 2896, 2896, 0, 2896, 2897, 0, 0, 0, 0, 2897, 2897, 2897, 2897, 2897, 2897, 2897, 2897, 0, 2897, 2897, 2897, 2897, 2897, 2897, 2897, 2897, 2897, 0, 0, 2897, 2897, 2898, 0, 2898, 2898, 0, 0, 0, 0, 0, 0, 0, 2898, 2898, 0, 0, 2898, 2899, 2899, 2899, 2899, 2899, 2899, 0, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2899, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 0, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2900, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2901, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2902, 2903, 0, 0, 0, 0, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2903, 2904, 2904, 0, 0, 0, 2904, 0, 2904, 2904, 2904, 0, 2904, 2904, 2904, 2904, 2904, 2904, 2904, 2905, 2905, 0, 0, 0, 2905, 0, 2905, 2905, 2905, 0, 2905, 2905, 2905, 2905, 2905, 2905, 2905, 2909, 2909, 0, 0, 0, 2909, 0, 2909, 2909, 2909, 0, 2909, 2909, 2909, 2909, 2909, 2909, 2909, 2910, 2910, 0, 0, 0, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2910, 2911, 2911, 0, 0, 0, 2911, 2911, 0, 2911, 2911, 2911, 2911, 2911, 2911, 2911, 2911, 2911, 2911, 2911, 0, 2911, 2911, 2911, 2911, 2911, 2911, 2911, 2912, 2912, 0, 0, 0, 2912, 2912, 0, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2912, 2913, 0, 2913, 2913, 0, 0, 0, 0, 0, 0, 0, 2913, 2913, 0, 0, 2913, 2917, 0, 2917, 2917, 0, 0, 0, 0, 0, 0, 0, 2917, 2917, 0, 0, 2917, 2921, 2921, 0, 0, 0, 2921, 0, 2921, 2921, 2921, 0, 2921, 2921, 2921, 2921, 2921, 2921, 2921, 2922, 0, 2922, 2922, 0, 0, 0, 0, 0, 0, 0, 2922, 2922, 0, 0, 2922, 2923, 2923, 0, 0, 0, 2923, 0, 2923, 2923, 2923, 0, 2923, 2923, 2923, 2923, 2923, 2923, 2923, 2924, 2924, 0, 0, 0, 2924, 0, 2924, 2924, 2924, 0, 2924, 2924, 2924, 2924, 2924, 2924, 2924, 2929, 0, 2929, 2929, 0, 0, 0, 0, 0, 0, 0, 2929, 2929, 0, 0, 2929, 2933, 2933, 0, 0, 0, 2933, 0, 2933, 2933, 2933, 2933, 2933, 2933, 2933, 2933, 2933, 2933, 2933, 2934, 2934, 0, 0, 0, 2934, 0, 2934, 2934, 2934, 0, 2934, 2934, 2934, 2934, 2934, 2934, 2934, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2935, 2936, 2936, 0, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2937, 0, 2937, 2937, 0, 0, 0, 0, 0, 0, 0, 2937, 2937, 0, 0, 2937, 2938, 2938, 0, 0, 0, 2938, 0, 2938, 2938, 2938, 0, 2938, 2938, 2938, 2938, 2938, 2938, 2938, 2944, 2944, 0, 0, 0, 2944, 0, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2945, 2945, 0, 0, 0, 2945, 0, 2945, 2945, 2945, 0, 2945, 2945, 2945, 2945, 2945, 2945, 2945, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2946, 2947, 2947, 0, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2947, 2948, 0, 2948, 2948, 0, 0, 0, 0, 0, 0, 0, 2948, 2948, 0, 0, 2948, 2952, 2952, 0, 0, 0, 2952, 0, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2953, 2953, 0, 0, 0, 2953, 0, 2953, 2953, 2953, 0, 2953, 2953, 2953, 2953, 2953, 2953, 2953, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2954, 2955, 2955, 0, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2955, 2956, 0, 2956, 2956, 0, 2956, 0, 0, 0, 2956, 0, 2956, 2956, 0, 0, 2956, 2963, 2963, 0, 0, 0, 2963, 0, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2964, 2964, 0, 0, 0, 2964, 0, 2964, 2964, 2964, 0, 2964, 2964, 2964, 2964, 2964, 2964, 2964, 2967, 2967, 0, 0, 0, 2967, 0, 2967, 2967, 2967, 2967, 2967, 2967, 2967, 2967, 2967, 2967, 2967, 2968, 2968, 0, 0, 0, 2968, 0, 2968, 2968, 2968, 0, 2968, 2968, 2968, 2968, 2968, 2968, 2968, 2976, 2976, 0, 0, 0, 2976, 0, 2976, 2976, 2976, 2976, 2976, 2976, 2976, 2976, 2976, 2976, 2976, 2977, 2977, 0, 0, 0, 2977, 0, 2977, 2977, 2977, 0, 2977, 2977, 2977, 2977, 2977, 2977, 2977, 2981, 2981, 0, 0, 0, 2981, 0, 2981, 2981, 2981, 2981, 2981, 2981, 2981, 2981, 2981, 2981, 2981, 2982, 2982, 0, 0, 0, 2982, 0, 2982, 2982, 2982, 0, 2982, 2982, 2982, 2982, 2982, 2982, 2982, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765, 2765 } ; extern int yy_flex_debug; int yy_flex_debug = 0; static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; static char *yy_full_match; static int yy_lp; static int yy_looking_for_trail_begin = 0; static int yy_full_lp; static int *yy_full_state; #define YY_TRAILING_MASK 0x2000 #define YY_TRAILING_HEAD_MASK 0x4000 #define REJECT \ { \ *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ (yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \ (yy_state_ptr) = (yy_full_state); /* restore orig. state */ \ yy_current_state = *(yy_state_ptr); /* restore curr. state */ \ ++(yy_lp); \ goto find_rule; \ } #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "src/l.l" /* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #line 30 "src/l.l" /* Turn off unreachable code warnings for the entire generated lexer */ #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunreachable-code" #endif /* * DESCRIPTION * * Lexical grammar for tokenizing the control file. * */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_GLOB_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #include "monit.h" #include "y.tab.h" // libmonit #include "util/Str.h" // we don't use yyinput => do not generate it #define YY_NO_INPUT #define MAX_STACK_DEPTH 1024 int buffer_stack_ptr = 0; struct buffer_stack_s { int lineno; char *currentfile; YY_BUFFER_STATE buffer; } buffer_stack[MAX_STACK_DEPTH]; int lineno = 1; int arglineno = 1; char *currentfile = NULL; char *argcurrentfile = NULL; char *argyytext = NULL; typedef enum { Proc_State, File_State, FileSys_State, Dir_State, Host_State, System_State, Fifo_State, Program_State, Net_State, None_State } Check_State; static Check_State check_state = None_State; /* Prototypes */ extern void yyerror(const char *,...); extern void yyerror2(const char *,...); extern void yywarning(const char *,...); extern void yywarning2(const char *,...); static void steplinenobycr(char *); static void save_arg(void); static void include_file(char *); static char *handle_quoted_string(char *); static void push_buffer_state(YY_BUFFER_STATE, const char*); static int pop_buffer_state(void); static URL_T create_URL(char *proto); #line 6232 "src/lex.yy.c" #line 6234 "src/lex.yy.c" #define INITIAL 0 #define ARGUMENT_COND 1 #define DEPEND_COND 2 #define SERVICE_COND 3 #define URL_COND 4 #define ADDRESS_COND 5 #define STRING_COND 6 #define HOSTGROUP_COND 7 #define EVERY_COND 8 #define HTTP_HEADER_COND 9 #define INCLUDE 10 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy ( void ); int yyget_debug ( void ); void yyset_debug ( int debug_flag ); YY_EXTRA_TYPE yyget_extra ( void ); void yyset_extra ( YY_EXTRA_TYPE user_defined ); FILE *yyget_in ( void ); void yyset_in ( FILE * _in_str ); FILE *yyget_out ( void ); void yyset_out ( FILE * _out_str ); int yyget_leng ( void ); char *yyget_text ( void ); int yyget_lineno ( void ); void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap ( void ); #else extern int yywrap ( void ); #endif #endif #ifndef YY_NO_UNPUT static void yyunput ( int c, char *buf_ptr ); #endif #ifndef yytext_ptr static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput ( void ); #else static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif /* Create the reject buffer large enough to save one state per allowed character. */ if ( ! (yy_state_buf) ) (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE ); if ( ! (yy_state_buf) ) YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_load_buffer_state( ); } { #line 165 "src/l.l" #line 6470 "src/lex.yy.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); (yy_state_ptr) = (yy_state_buf); *(yy_state_ptr)++ = yy_current_state; yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 2766 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } while ( yy_base[yy_current_state] != 19096 ); yy_find_action: yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; find_rule: /* we branch to this label when backing up */ for ( ; ; ) /* until we find what rule we matched */ { if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) { yy_act = yy_acclist[(yy_lp)]; if ( yy_act & YY_TRAILING_HEAD_MASK || (yy_looking_for_trail_begin) ) { if ( yy_act == (yy_looking_for_trail_begin) ) { (yy_looking_for_trail_begin) = 0; yy_act &= ~YY_TRAILING_HEAD_MASK; break; } } else if ( yy_act & YY_TRAILING_MASK ) { (yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK; (yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK; } else { (yy_full_match) = yy_cp; (yy_full_state) = (yy_state_ptr); (yy_full_lp) = (yy_lp); break; } ++(yy_lp); goto find_rule; } --yy_cp; yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 1: YY_RULE_SETUP #line 167 "src/l.l" { /* Wide white space */ } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP #line 168 "src/l.l" { lineno++; } YY_BREAK case 3: YY_RULE_SETUP #line 170 "src/l.l" {/* EMPTY */} YY_BREAK case 4: YY_RULE_SETUP #line 171 "src/l.l" {/* EMPTY */} YY_BREAK case 5: YY_RULE_SETUP #line 172 "src/l.l" {/* EMPTY */} YY_BREAK case 6: YY_RULE_SETUP #line 173 "src/l.l" {/* EMPTY */} YY_BREAK case 7: YY_RULE_SETUP #line 174 "src/l.l" {/* EMPTY */} YY_BREAK case 8: YY_RULE_SETUP #line 175 "src/l.l" {/* EMPTY */} YY_BREAK case 9: YY_RULE_SETUP #line 176 "src/l.l" {/* EMPTY */} YY_BREAK case 10: YY_RULE_SETUP #line 177 "src/l.l" {/* EMPTY */} YY_BREAK case 11: YY_RULE_SETUP #line 178 "src/l.l" {/* EMPTY */} YY_BREAK case 12: YY_RULE_SETUP #line 179 "src/l.l" {/* EMPTY */} YY_BREAK case 13: YY_RULE_SETUP #line 180 "src/l.l" {/* EMPTY */} YY_BREAK case 14: YY_RULE_SETUP #line 181 "src/l.l" {/* EMPTY */} YY_BREAK case 15: YY_RULE_SETUP #line 182 "src/l.l" {/* EMPTY */} YY_BREAK case 16: YY_RULE_SETUP #line 183 "src/l.l" {/* EMPTY */} YY_BREAK case 17: YY_RULE_SETUP #line 184 "src/l.l" {/* EMPTY */} YY_BREAK case 18: YY_RULE_SETUP #line 185 "src/l.l" {/* EMPTY */} YY_BREAK case 19: YY_RULE_SETUP #line 186 "src/l.l" {/* EMPTY */} YY_BREAK case 20: YY_RULE_SETUP #line 187 "src/l.l" {/* EMPTY */} YY_BREAK case 21: YY_RULE_SETUP #line 188 "src/l.l" {/* EMPTY */} YY_BREAK case 22: YY_RULE_SETUP #line 189 "src/l.l" {/* EMPTY */} YY_BREAK case 23: YY_RULE_SETUP #line 190 "src/l.l" {/* EMPTY */} YY_BREAK case 24: YY_RULE_SETUP #line 191 "src/l.l" {/* EMPTY */} YY_BREAK case 25: YY_RULE_SETUP #line 192 "src/l.l" {/* EMPTY */} YY_BREAK case 26: YY_RULE_SETUP #line 193 "src/l.l" {/* EMPTY */} YY_BREAK case 27: YY_RULE_SETUP #line 194 "src/l.l" {/* EMPTY */} YY_BREAK case 28: YY_RULE_SETUP #line 195 "src/l.l" {/* EMPTY */} YY_BREAK case 29: YY_RULE_SETUP #line 196 "src/l.l" {/* EMPTY */} YY_BREAK case 30: YY_RULE_SETUP #line 197 "src/l.l" {/* EMPTY */} YY_BREAK case 31: YY_RULE_SETUP #line 198 "src/l.l" {/* EMPTY */} YY_BREAK case 32: YY_RULE_SETUP #line 199 "src/l.l" {/* EMPTY */} YY_BREAK case 33: YY_RULE_SETUP #line 200 "src/l.l" {/* EMPTY */} YY_BREAK case 34: YY_RULE_SETUP #line 201 "src/l.l" {/* EMPTY */} YY_BREAK case 35: YY_RULE_SETUP #line 203 "src/l.l" { BEGIN(ARGUMENT_COND); return START; } YY_BREAK case 36: YY_RULE_SETUP #line 204 "src/l.l" { BEGIN(ARGUMENT_COND); return STOP; } YY_BREAK case 37: YY_RULE_SETUP #line 205 "src/l.l" { BEGIN(ARGUMENT_COND); return RESTART; } YY_BREAK case 38: YY_RULE_SETUP #line 206 "src/l.l" { BEGIN(ARGUMENT_COND); return EXEC; } YY_BREAK case 39: YY_RULE_SETUP #line 207 "src/l.l" { if (check_state == Program_State) { BEGIN(ARGUMENT_COND); // Parse Path for program as arguments return PATHTOK; } else { unput('"'); return PATHTOK; } } YY_BREAK case 40: YY_RULE_SETUP #line 217 "src/l.l" { return IF; } YY_BREAK case 41: YY_RULE_SETUP #line 218 "src/l.l" { return THEN; } YY_BREAK case 42: YY_RULE_SETUP #line 219 "src/l.l" { return FAILED; } YY_BREAK case 43: YY_RULE_SETUP #line 220 "src/l.l" { return SSLTOKEN; } YY_BREAK case 44: YY_RULE_SETUP #line 221 "src/l.l" { return SSLTOKEN; } YY_BREAK case 45: YY_RULE_SETUP #line 222 "src/l.l" { return SSLTOKEN; } YY_BREAK case 46: YY_RULE_SETUP #line 223 "src/l.l" { return SSLTOKEN; } YY_BREAK case 47: YY_RULE_SETUP #line 224 "src/l.l" { return ENABLE; } YY_BREAK case 48: YY_RULE_SETUP #line 225 "src/l.l" { return DISABLE; } YY_BREAK case 49: YY_RULE_SETUP #line 226 "src/l.l" { return VERIFY; } YY_BREAK case 50: YY_RULE_SETUP #line 227 "src/l.l" { return VALID; } YY_BREAK case 51: YY_RULE_SETUP #line 228 "src/l.l" { return CERTIFICATE; } YY_BREAK case 52: YY_RULE_SETUP #line 229 "src/l.l" { return CACERTIFICATEFILE; } YY_BREAK case 53: YY_RULE_SETUP #line 230 "src/l.l" { return CACERTIFICATEPATH; } YY_BREAK case 54: YY_RULE_SETUP #line 231 "src/l.l" { return SET; } YY_BREAK case 55: YY_RULE_SETUP #line 232 "src/l.l" { return DAEMON; } YY_BREAK case 56: YY_RULE_SETUP #line 233 "src/l.l" { return DELAY; } YY_BREAK case 57: YY_RULE_SETUP #line 234 "src/l.l" { return TERMINAL; } YY_BREAK case 58: YY_RULE_SETUP #line 235 "src/l.l" { return BATCH; } YY_BREAK case 59: YY_RULE_SETUP #line 236 "src/l.l" { return LOGFILE; } YY_BREAK case 60: YY_RULE_SETUP #line 237 "src/l.l" { return LOGFILE; } YY_BREAK case 61: YY_RULE_SETUP #line 238 "src/l.l" { return SYSLOG; } YY_BREAK case 62: YY_RULE_SETUP #line 239 "src/l.l" { return FACILITY; } YY_BREAK case 63: YY_RULE_SETUP #line 240 "src/l.l" { return HTTPD; } YY_BREAK case 64: YY_RULE_SETUP #line 241 "src/l.l" { return ADDRESS; } YY_BREAK case 65: YY_RULE_SETUP #line 242 "src/l.l" { return INTERFACE; } YY_BREAK case 66: YY_RULE_SETUP #line 243 "src/l.l" { return LINK; } YY_BREAK case 67: YY_RULE_SETUP #line 244 "src/l.l" { return PACKET; } YY_BREAK case 68: YY_RULE_SETUP #line 245 "src/l.l" { return BYTEIN; } YY_BREAK case 69: YY_RULE_SETUP #line 246 "src/l.l" { return BYTEOUT; } YY_BREAK case 70: YY_RULE_SETUP #line 247 "src/l.l" { return PACKETIN; } YY_BREAK case 71: YY_RULE_SETUP #line 248 "src/l.l" { return PACKETOUT; } YY_BREAK case 72: YY_RULE_SETUP #line 249 "src/l.l" { return UPLOAD; } YY_BREAK case 73: YY_RULE_SETUP #line 250 "src/l.l" { return DOWNLOAD; } YY_BREAK case 74: YY_RULE_SETUP #line 251 "src/l.l" { return UP; } YY_BREAK case 75: YY_RULE_SETUP #line 252 "src/l.l" { return DOWN; } YY_BREAK case 76: YY_RULE_SETUP #line 253 "src/l.l" { return SATURATION; } YY_BREAK case 77: YY_RULE_SETUP #line 254 "src/l.l" { return SPEED; } YY_BREAK case 78: YY_RULE_SETUP #line 255 "src/l.l" { return TOTAL; } YY_BREAK case 79: YY_RULE_SETUP #line 256 "src/l.l" { return CLIENTPEMFILE; } YY_BREAK case 80: YY_RULE_SETUP #line 257 "src/l.l" { return ALLOWSELFCERTIFICATION; } YY_BREAK case 81: YY_RULE_SETUP #line 258 "src/l.l" { return SELFSIGNED; } YY_BREAK case 82: YY_RULE_SETUP #line 259 "src/l.l" { return CERTMD5; } YY_BREAK case 83: YY_RULE_SETUP #line 260 "src/l.l" { return PEMFILE; } YY_BREAK case 84: YY_RULE_SETUP #line 261 "src/l.l" { return PEMCHAIN; } YY_BREAK case 85: YY_RULE_SETUP #line 262 "src/l.l" { return PEMKEY; } YY_BREAK case 86: YY_RULE_SETUP #line 263 "src/l.l" { return RSAKEY; } YY_BREAK case 87: YY_RULE_SETUP #line 264 "src/l.l" { return INIT; } YY_BREAK case 88: YY_RULE_SETUP #line 265 "src/l.l" { return ALLOW; } YY_BREAK case 89: YY_RULE_SETUP #line 266 "src/l.l" { return REJECTOPT; } YY_BREAK case 90: YY_RULE_SETUP #line 267 "src/l.l" { return READONLY; } YY_BREAK case 91: YY_RULE_SETUP #line 268 "src/l.l" { return DISK; } YY_BREAK case 92: YY_RULE_SETUP #line 269 "src/l.l" { return READ; } YY_BREAK case 93: YY_RULE_SETUP #line 270 "src/l.l" { return WRITE; } YY_BREAK case 94: YY_RULE_SETUP #line 271 "src/l.l" { return SERVICETIME; } YY_BREAK case 95: YY_RULE_SETUP #line 272 "src/l.l" { return OPERATION; } YY_BREAK case 96: YY_RULE_SETUP #line 273 "src/l.l" { return PIDFILE; } YY_BREAK case 97: YY_RULE_SETUP #line 274 "src/l.l" { return IDFILE; } YY_BREAK case 98: YY_RULE_SETUP #line 275 "src/l.l" { return STATEFILE; } YY_BREAK case 99: YY_RULE_SETUP #line 276 "src/l.l" { return PATHTOK; } YY_BREAK case 100: YY_RULE_SETUP #line 277 "src/l.l" { return START; } YY_BREAK case 101: YY_RULE_SETUP #line 278 "src/l.l" { return STOP; } YY_BREAK case 102: YY_RULE_SETUP #line 279 "src/l.l" { return PORT; } YY_BREAK case 103: YY_RULE_SETUP #line 280 "src/l.l" { return UNIXSOCKET; } YY_BREAK case 104: YY_RULE_SETUP #line 281 "src/l.l" { return IPV4; } YY_BREAK case 105: YY_RULE_SETUP #line 282 "src/l.l" { return IPV6; } YY_BREAK case 106: YY_RULE_SETUP #line 283 "src/l.l" { return TYPE; } YY_BREAK case 107: YY_RULE_SETUP #line 284 "src/l.l" { return PROTOCOL; } YY_BREAK case 108: YY_RULE_SETUP #line 285 "src/l.l" { return TCP; } YY_BREAK case 109: YY_RULE_SETUP #line 286 "src/l.l" { return TCPSSL; } YY_BREAK case 110: YY_RULE_SETUP #line 287 "src/l.l" { return UDP; } YY_BREAK case 111: YY_RULE_SETUP #line 288 "src/l.l" { return ALERT; } YY_BREAK case 112: YY_RULE_SETUP #line 289 "src/l.l" { return NOALERT; } YY_BREAK case 113: YY_RULE_SETUP #line 290 "src/l.l" { return MAILFORMAT; } YY_BREAK case 114: YY_RULE_SETUP #line 291 "src/l.l" { return RESOURCE; } YY_BREAK case 115: YY_RULE_SETUP #line 292 "src/l.l" { return RESTART; } YY_BREAK case 116: YY_RULE_SETUP #line 293 "src/l.l" { return CYCLE; } YY_BREAK case 117: YY_RULE_SETUP #line 294 "src/l.l" { return TIMEOUT; } YY_BREAK case 118: YY_RULE_SETUP #line 295 "src/l.l" { return RETRY; } YY_BREAK case 119: YY_RULE_SETUP #line 296 "src/l.l" { return CHECKSUM; } YY_BREAK case 120: YY_RULE_SETUP #line 297 "src/l.l" { return MAILSERVER; } YY_BREAK case 121: YY_RULE_SETUP #line 298 "src/l.l" { return HOST; } YY_BREAK case 122: YY_RULE_SETUP #line 299 "src/l.l" { return HOSTHEADER; } YY_BREAK case 123: YY_RULE_SETUP #line 300 "src/l.l" { return METHOD; } YY_BREAK case 124: YY_RULE_SETUP #line 301 "src/l.l" { return GET; } YY_BREAK case 125: YY_RULE_SETUP #line 302 "src/l.l" { return HEAD; } YY_BREAK case 126: YY_RULE_SETUP #line 303 "src/l.l" { return STATUS; } YY_BREAK case 127: YY_RULE_SETUP #line 304 "src/l.l" { return DEFAULT; } YY_BREAK case 128: YY_RULE_SETUP #line 305 "src/l.l" { return HTTP; } YY_BREAK case 129: YY_RULE_SETUP #line 306 "src/l.l" { return HTTPS; } YY_BREAK case 130: YY_RULE_SETUP #line 307 "src/l.l" { return APACHESTATUS; } YY_BREAK case 131: YY_RULE_SETUP #line 308 "src/l.l" { return FTP; } YY_BREAK case 132: YY_RULE_SETUP #line 309 "src/l.l" { return SMTP; } YY_BREAK case 133: YY_RULE_SETUP #line 310 "src/l.l" { return SMTPS; } YY_BREAK case 134: YY_RULE_SETUP #line 311 "src/l.l" { return POSTFIXPOLICY; } YY_BREAK case 135: YY_RULE_SETUP #line 312 "src/l.l" { return POP; } YY_BREAK case 136: YY_RULE_SETUP #line 313 "src/l.l" { return POPS; } YY_BREAK case 137: YY_RULE_SETUP #line 314 "src/l.l" { return IMAP; } YY_BREAK case 138: YY_RULE_SETUP #line 315 "src/l.l" { return IMAPS; } YY_BREAK case 139: YY_RULE_SETUP #line 316 "src/l.l" { return CLAMAV; } YY_BREAK case 140: YY_RULE_SETUP #line 317 "src/l.l" { return DNS; } YY_BREAK case 141: YY_RULE_SETUP #line 318 "src/l.l" { return MYSQL; } YY_BREAK case 142: YY_RULE_SETUP #line 319 "src/l.l" { return MYSQLS; } YY_BREAK case 143: YY_RULE_SETUP #line 320 "src/l.l" { return NNTP; } YY_BREAK case 144: YY_RULE_SETUP #line 321 "src/l.l" { return NTP3; } YY_BREAK case 145: YY_RULE_SETUP #line 322 "src/l.l" { return SSH; } YY_BREAK case 146: YY_RULE_SETUP #line 323 "src/l.l" { return REDIS; } YY_BREAK case 147: YY_RULE_SETUP #line 324 "src/l.l" { return MONGODB; } YY_BREAK case 148: YY_RULE_SETUP #line 325 "src/l.l" { return FAIL2BAN; } YY_BREAK case 149: YY_RULE_SETUP #line 326 "src/l.l" { return SIEVE; } YY_BREAK case 150: YY_RULE_SETUP #line 327 "src/l.l" { return SPAMASSASSIN; } YY_BREAK case 151: YY_RULE_SETUP #line 328 "src/l.l" { return DWP; } YY_BREAK case 152: YY_RULE_SETUP #line 329 "src/l.l" { return LDAP2; } YY_BREAK case 153: YY_RULE_SETUP #line 330 "src/l.l" { return LDAP3; } YY_BREAK case 154: YY_RULE_SETUP #line 331 "src/l.l" { return RDATE; } YY_BREAK case 155: YY_RULE_SETUP #line 332 "src/l.l" { return LMTP; } YY_BREAK case 156: YY_RULE_SETUP #line 333 "src/l.l" { return RSYNC; } YY_BREAK case 157: YY_RULE_SETUP #line 334 "src/l.l" { return TNS; } YY_BREAK case 158: YY_RULE_SETUP #line 335 "src/l.l" { return PGSQL; } YY_BREAK case 159: YY_RULE_SETUP #line 336 "src/l.l" { return WEBSOCKET; } YY_BREAK case 160: YY_RULE_SETUP #line 337 "src/l.l" { return MQTT; } YY_BREAK case 161: YY_RULE_SETUP #line 338 "src/l.l" { return ORIGIN; } YY_BREAK case 162: YY_RULE_SETUP #line 339 "src/l.l" { return VERSIONOPT; } YY_BREAK case 163: YY_RULE_SETUP #line 340 "src/l.l" { return SIP; } YY_BREAK case 164: YY_RULE_SETUP #line 341 "src/l.l" { return GPS; } YY_BREAK case 165: YY_RULE_SETUP #line 342 "src/l.l" { return RADIUS; } YY_BREAK case 166: YY_RULE_SETUP #line 343 "src/l.l" { return MEMCACHE; } YY_BREAK case 167: YY_RULE_SETUP #line 344 "src/l.l" { return TARGET; } YY_BREAK case 168: YY_RULE_SETUP #line 345 "src/l.l" { return MAXFORWARD; } YY_BREAK case 169: YY_RULE_SETUP #line 346 "src/l.l" { return MODE; } YY_BREAK case 170: YY_RULE_SETUP #line 347 "src/l.l" { return ACTIVE; } YY_BREAK case 171: YY_RULE_SETUP #line 348 "src/l.l" { return PASSIVE; } YY_BREAK case 172: YY_RULE_SETUP #line 349 "src/l.l" { return MANUAL; } YY_BREAK case 173: YY_RULE_SETUP #line 350 "src/l.l" { return ONREBOOT; } YY_BREAK case 174: YY_RULE_SETUP #line 351 "src/l.l" { return NOSTART; } YY_BREAK case 175: YY_RULE_SETUP #line 352 "src/l.l" { return LASTSTATE; } YY_BREAK case 176: YY_RULE_SETUP #line 353 "src/l.l" { return UID; } YY_BREAK case 177: YY_RULE_SETUP #line 354 "src/l.l" { return EUID; } YY_BREAK case 178: YY_RULE_SETUP #line 355 "src/l.l" { return SECURITY; } YY_BREAK case 179: YY_RULE_SETUP #line 356 "src/l.l" { return ATTRIBUTE; } YY_BREAK case 180: YY_RULE_SETUP #line 357 "src/l.l" { return GID; } YY_BREAK case 181: YY_RULE_SETUP #line 358 "src/l.l" { return REQUEST; } YY_BREAK case 182: YY_RULE_SETUP #line 359 "src/l.l" { return SECRET; } YY_BREAK case 183: YY_RULE_SETUP #line 360 "src/l.l" { return LOGLIMIT; } YY_BREAK case 184: YY_RULE_SETUP #line 361 "src/l.l" { return CLOSELIMIT; } YY_BREAK case 185: YY_RULE_SETUP #line 362 "src/l.l" { return DNSLIMIT; } YY_BREAK case 186: YY_RULE_SETUP #line 363 "src/l.l" { return KEEPALIVELIMIT; } YY_BREAK case 187: YY_RULE_SETUP #line 364 "src/l.l" { return REPLYLIMIT; } YY_BREAK case 188: YY_RULE_SETUP #line 365 "src/l.l" { return REQUESTLIMIT; } YY_BREAK case 189: YY_RULE_SETUP #line 366 "src/l.l" { return STARTLIMIT; } YY_BREAK case 190: YY_RULE_SETUP #line 367 "src/l.l" { return WAITLIMIT; } YY_BREAK case 191: YY_RULE_SETUP #line 368 "src/l.l" { return GRACEFULLIMIT; } YY_BREAK case 192: YY_RULE_SETUP #line 369 "src/l.l" { return CLEANUPLIMIT; } YY_BREAK case 193: YY_RULE_SETUP #line 370 "src/l.l" { return MEMORY; } YY_BREAK case 194: YY_RULE_SETUP #line 371 "src/l.l" { return SWAP; } YY_BREAK case 195: YY_RULE_SETUP #line 372 "src/l.l" { return TOTALMEMORY; } YY_BREAK case 196: YY_RULE_SETUP #line 373 "src/l.l" { return CORE; } YY_BREAK case 197: YY_RULE_SETUP #line 374 "src/l.l" { return CPU; } YY_BREAK case 198: YY_RULE_SETUP #line 375 "src/l.l" { return TOTALCPU; } YY_BREAK case 199: YY_RULE_SETUP #line 376 "src/l.l" { return CHILDREN; } YY_BREAK case 200: YY_RULE_SETUP #line 377 "src/l.l" { return THREADS; } YY_BREAK case 201: YY_RULE_SETUP #line 378 "src/l.l" { return TIME; } YY_BREAK case 202: YY_RULE_SETUP #line 379 "src/l.l" { return CHANGED; } YY_BREAK case 203: YY_RULE_SETUP #line 380 "src/l.l" { return NOSSLV2; } YY_BREAK case 204: YY_RULE_SETUP #line 381 "src/l.l" { return NOSSLV3; } YY_BREAK case 205: YY_RULE_SETUP #line 382 "src/l.l" { return NOTLSV1; } YY_BREAK case 206: YY_RULE_SETUP #line 383 "src/l.l" { return NOTLSV11; } YY_BREAK case 207: YY_RULE_SETUP #line 384 "src/l.l" { return NOTLSV12; } YY_BREAK case 208: YY_RULE_SETUP #line 385 "src/l.l" { return NOTLSV13; } YY_BREAK case 209: YY_RULE_SETUP #line 386 "src/l.l" { return SSLV2; } YY_BREAK case 210: YY_RULE_SETUP #line 387 "src/l.l" { return SSLV3; } YY_BREAK case 211: YY_RULE_SETUP #line 388 "src/l.l" { return TLSV1; } YY_BREAK case 212: YY_RULE_SETUP #line 389 "src/l.l" { return TLSV11; } YY_BREAK case 213: YY_RULE_SETUP #line 390 "src/l.l" { return TLSV12; } YY_BREAK case 214: YY_RULE_SETUP #line 391 "src/l.l" { return TLSV13; } YY_BREAK case 215: YY_RULE_SETUP #line 392 "src/l.l" { return CIPHER; } YY_BREAK case 216: YY_RULE_SETUP #line 393 "src/l.l" { return AUTO; } YY_BREAK case 217: YY_RULE_SETUP #line 394 "src/l.l" { return AUTO; } YY_BREAK case 218: YY_RULE_SETUP #line 395 "src/l.l" { return INODE; } YY_BREAK case 219: YY_RULE_SETUP #line 396 "src/l.l" { return SPACE; } YY_BREAK case 220: YY_RULE_SETUP #line 397 "src/l.l" { return TFREE; } YY_BREAK case 221: YY_RULE_SETUP #line 398 "src/l.l" { return PERMISSION; } YY_BREAK case 222: YY_RULE_SETUP #line 399 "src/l.l" { return EXEC; } YY_BREAK case 223: YY_RULE_SETUP #line 400 "src/l.l" { return SIZE; } YY_BREAK case 224: YY_RULE_SETUP #line 401 "src/l.l" { return HARDLINK; } YY_BREAK case 225: YY_RULE_SETUP #line 402 "src/l.l" { return UPTIME; } YY_BREAK case 226: YY_RULE_SETUP #line 403 "src/l.l" { return RESPONSETIME; } YY_BREAK case 227: YY_RULE_SETUP #line 404 "src/l.l" { return BASEDIR; } YY_BREAK case 228: YY_RULE_SETUP #line 405 "src/l.l" { return SLOT; } YY_BREAK case 229: YY_RULE_SETUP #line 406 "src/l.l" { return EVENTQUEUE; } YY_BREAK case 230: YY_RULE_SETUP #line 407 "src/l.l" { return MATCH; } YY_BREAK case 231: YY_RULE_SETUP #line 408 "src/l.l" { return NOT; } YY_BREAK case 232: YY_RULE_SETUP #line 409 "src/l.l" { return IGNORE; } YY_BREAK case 233: YY_RULE_SETUP #line 410 "src/l.l" { return CONNECTION; } YY_BREAK case 234: YY_RULE_SETUP #line 411 "src/l.l" { return UNMONITOR; } YY_BREAK case 235: YY_RULE_SETUP #line 412 "src/l.l" { return ACTION; } YY_BREAK case 236: YY_RULE_SETUP #line 413 "src/l.l" { return ICMP; } YY_BREAK case 237: YY_RULE_SETUP #line 414 "src/l.l" { return PING; } YY_BREAK case 238: YY_RULE_SETUP #line 415 "src/l.l" { return PING4; } YY_BREAK case 239: YY_RULE_SETUP #line 416 "src/l.l" { return PING6; } YY_BREAK case 240: YY_RULE_SETUP #line 417 "src/l.l" { return ICMPECHO; } YY_BREAK case 241: YY_RULE_SETUP #line 418 "src/l.l" { return SEND; } YY_BREAK case 242: YY_RULE_SETUP #line 419 "src/l.l" { return EXPECT; } YY_BREAK case 243: YY_RULE_SETUP #line 420 "src/l.l" { return EXPECTBUFFER; } YY_BREAK case 244: YY_RULE_SETUP #line 421 "src/l.l" { return LIMITS; } YY_BREAK case 245: YY_RULE_SETUP #line 422 "src/l.l" { return SENDEXPECTBUFFER; } YY_BREAK case 246: YY_RULE_SETUP #line 423 "src/l.l" { return FILECONTENTBUFFER; } YY_BREAK case 247: YY_RULE_SETUP #line 424 "src/l.l" { return HTTPCONTENTBUFFER; } YY_BREAK case 248: YY_RULE_SETUP #line 425 "src/l.l" { return PROGRAMOUTPUT; } YY_BREAK case 249: YY_RULE_SETUP #line 426 "src/l.l" { return NETWORKTIMEOUT; } YY_BREAK case 250: YY_RULE_SETUP #line 427 "src/l.l" { return PROGRAMTIMEOUT; } YY_BREAK case 251: YY_RULE_SETUP #line 428 "src/l.l" { return STOPTIMEOUT; } YY_BREAK case 252: YY_RULE_SETUP #line 429 "src/l.l" { return STARTTIMEOUT; } YY_BREAK case 253: YY_RULE_SETUP #line 430 "src/l.l" { return RESTARTTIMEOUT; } YY_BREAK case 254: YY_RULE_SETUP #line 431 "src/l.l" { return EXECTIMEOUT; } YY_BREAK case 255: YY_RULE_SETUP #line 432 "src/l.l" { return CLEARTEXT; } YY_BREAK case 256: YY_RULE_SETUP #line 433 "src/l.l" { return MD5HASH; } YY_BREAK case 257: YY_RULE_SETUP #line 434 "src/l.l" { return SHA1HASH; } YY_BREAK case 258: YY_RULE_SETUP #line 435 "src/l.l" { return CRYPT; } YY_BREAK case 259: YY_RULE_SETUP #line 436 "src/l.l" { return SIGNATURE; } YY_BREAK case 260: YY_RULE_SETUP #line 437 "src/l.l" { return NONEXIST; } YY_BREAK case 261: YY_RULE_SETUP #line 438 "src/l.l" { return EXIST; } YY_BREAK case 262: YY_RULE_SETUP #line 439 "src/l.l" { return INVALID; } YY_BREAK case 263: YY_RULE_SETUP #line 440 "src/l.l" { return DATA; } YY_BREAK case 264: YY_RULE_SETUP #line 441 "src/l.l" { return RECOVERED; } YY_BREAK case 265: YY_RULE_SETUP #line 442 "src/l.l" { return PASSED; } YY_BREAK case 266: YY_RULE_SETUP #line 443 "src/l.l" { return SUCCEEDED; } YY_BREAK case 267: YY_RULE_SETUP #line 444 "src/l.l" { return ELSE; } YY_BREAK case 268: YY_RULE_SETUP #line 445 "src/l.l" { return MMONIT; } YY_BREAK case 269: YY_RULE_SETUP #line 446 "src/l.l" { return URL; } YY_BREAK case 270: YY_RULE_SETUP #line 447 "src/l.l" { return CONTENT; } YY_BREAK case 271: YY_RULE_SETUP #line 448 "src/l.l" { return PID; } YY_BREAK case 272: YY_RULE_SETUP #line 449 "src/l.l" { return PPID; } YY_BREAK case 273: YY_RULE_SETUP #line 450 "src/l.l" { return COUNT; } YY_BREAK case 274: YY_RULE_SETUP #line 451 "src/l.l" { return REPEAT; } YY_BREAK case 275: YY_RULE_SETUP #line 452 "src/l.l" { return REMINDER; } YY_BREAK case 276: YY_RULE_SETUP #line 453 "src/l.l" { return INSTANCE; } YY_BREAK case 277: YY_RULE_SETUP #line 454 "src/l.l" { return HOSTNAME; } YY_BREAK case 278: YY_RULE_SETUP #line 455 "src/l.l" { return USERNAME; } YY_BREAK case 279: YY_RULE_SETUP #line 456 "src/l.l" { return PASSWORD; } YY_BREAK case 280: YY_RULE_SETUP #line 457 "src/l.l" { return DATABASE; } YY_BREAK case 281: YY_RULE_SETUP #line 458 "src/l.l" { return CREDENTIALS; } YY_BREAK case 282: YY_RULE_SETUP #line 459 "src/l.l" { return REGISTER; } YY_BREAK case 283: YY_RULE_SETUP #line 460 "src/l.l" { return FSFLAG; } YY_BREAK case 284: YY_RULE_SETUP #line 461 "src/l.l" { return FIPS; } YY_BREAK case 285: YY_RULE_SETUP #line 462 "src/l.l" { return FILEDESCRIPTORS; } YY_BREAK case 286: YY_RULE_SETUP #line 463 "src/l.l" { return BYTE; } YY_BREAK case 287: YY_RULE_SETUP #line 464 "src/l.l" { return KILOBYTE; } YY_BREAK case 288: YY_RULE_SETUP #line 465 "src/l.l" { return MEGABYTE; } YY_BREAK case 289: YY_RULE_SETUP #line 466 "src/l.l" { return GIGABYTE; } YY_BREAK case 290: YY_RULE_SETUP #line 467 "src/l.l" { return LOADAVG1; } YY_BREAK case 291: YY_RULE_SETUP #line 468 "src/l.l" { return LOADAVG5; } YY_BREAK case 292: YY_RULE_SETUP #line 469 "src/l.l" { return LOADAVG15; } YY_BREAK case 293: YY_RULE_SETUP #line 470 "src/l.l" { return CPUUSER; } YY_BREAK case 294: YY_RULE_SETUP #line 471 "src/l.l" { return CPUSYSTEM; } YY_BREAK case 295: YY_RULE_SETUP #line 472 "src/l.l" { return CPUWAIT; } YY_BREAK case 296: YY_RULE_SETUP #line 473 "src/l.l" { return CPUNICE; } YY_BREAK case 297: YY_RULE_SETUP #line 474 "src/l.l" { return CPUHARDIRQ; } YY_BREAK case 298: YY_RULE_SETUP #line 475 "src/l.l" { return CPUSOFTIRQ; } YY_BREAK case 299: YY_RULE_SETUP #line 476 "src/l.l" { return CPUSTEAL; } YY_BREAK case 300: YY_RULE_SETUP #line 477 "src/l.l" { return CPUGUEST; } YY_BREAK case 301: YY_RULE_SETUP #line 478 "src/l.l" { return CPUGUESTNICE; } YY_BREAK case 302: YY_RULE_SETUP #line 479 "src/l.l" { return GREATER; } YY_BREAK case 303: YY_RULE_SETUP #line 480 "src/l.l" { return GREATEROREQUAL; } YY_BREAK case 304: YY_RULE_SETUP #line 481 "src/l.l" { return LESS; } YY_BREAK case 305: YY_RULE_SETUP #line 482 "src/l.l" { return LESSOREQUAL; } YY_BREAK case 306: YY_RULE_SETUP #line 483 "src/l.l" { return EQUAL; } YY_BREAK case 307: YY_RULE_SETUP #line 484 "src/l.l" { return NOTEQUAL; } YY_BREAK case 308: YY_RULE_SETUP #line 485 "src/l.l" { return MILLISECOND; } YY_BREAK case 309: YY_RULE_SETUP #line 486 "src/l.l" { return SECOND; } YY_BREAK case 310: YY_RULE_SETUP #line 487 "src/l.l" { return MINUTE; } YY_BREAK case 311: YY_RULE_SETUP #line 488 "src/l.l" { return HOUR; } YY_BREAK case 312: YY_RULE_SETUP #line 489 "src/l.l" { return DAY; } YY_BREAK case 313: YY_RULE_SETUP #line 490 "src/l.l" { return MONTH; } YY_BREAK case 314: YY_RULE_SETUP #line 491 "src/l.l" { return ATIME; } YY_BREAK case 315: YY_RULE_SETUP #line 492 "src/l.l" { return CTIME; } YY_BREAK case 316: YY_RULE_SETUP #line 493 "src/l.l" { return MTIME; } YY_BREAK case 317: YY_RULE_SETUP #line 495 "src/l.l" { BEGIN(INCLUDE); } YY_BREAK case 318: YY_RULE_SETUP #line 497 "src/l.l" { BEGIN(EVERY_COND); return NOTEVERY; } YY_BREAK case 319: YY_RULE_SETUP #line 502 "src/l.l" { BEGIN(EVERY_COND); return EVERY; } YY_BREAK case 320: YY_RULE_SETUP #line 507 "src/l.l" { BEGIN(DEPEND_COND); return DEPENDS; } YY_BREAK case 321: YY_RULE_SETUP #line 512 "src/l.l" { BEGIN(SERVICE_COND); check_state = Proc_State; return CHECKPROC; } YY_BREAK case 322: YY_RULE_SETUP #line 518 "src/l.l" { BEGIN(SERVICE_COND); check_state = Program_State; return CHECKPROGRAM; } YY_BREAK case 323: YY_RULE_SETUP #line 524 "src/l.l" { /* Filesystem alias for backward compatibility */ BEGIN(SERVICE_COND); check_state = FileSys_State; return CHECKFILESYS; } YY_BREAK case 324: YY_RULE_SETUP #line 530 "src/l.l" { BEGIN(SERVICE_COND); check_state = FileSys_State; return CHECKFILESYS; } YY_BREAK case 325: YY_RULE_SETUP #line 536 "src/l.l" { BEGIN(SERVICE_COND); check_state = File_State; return CHECKFILE; } YY_BREAK case 326: YY_RULE_SETUP #line 542 "src/l.l" { BEGIN(SERVICE_COND); check_state = Dir_State; return CHECKDIR; } YY_BREAK case 327: YY_RULE_SETUP #line 548 "src/l.l" { BEGIN(SERVICE_COND); check_state = Host_State; return CHECKHOST; } YY_BREAK case 328: YY_RULE_SETUP #line 554 "src/l.l" { BEGIN(SERVICE_COND); check_state = Net_State; return CHECKNET; } YY_BREAK case 329: YY_RULE_SETUP #line 560 "src/l.l" { BEGIN(SERVICE_COND); check_state = Fifo_State; return CHECKFIFO; } YY_BREAK case 330: YY_RULE_SETUP #line 566 "src/l.l" { BEGIN(SERVICE_COND); check_state = Program_State; return CHECKPROGRAM; } YY_BREAK case 331: YY_RULE_SETUP #line 572 "src/l.l" { BEGIN(SERVICE_COND); check_state = System_State; return CHECKSYSTEM; } YY_BREAK case 332: YY_RULE_SETUP #line 578 "src/l.l" { BEGIN(STRING_COND); return GROUP; } YY_BREAK case 333: YY_RULE_SETUP #line 583 "src/l.l" { BEGIN(HOSTGROUP_COND); return '['; } YY_BREAK case 334: YY_RULE_SETUP #line 588 "src/l.l" { BEGIN(HTTP_HEADER_COND); return '['; } YY_BREAK case 335: YY_RULE_SETUP #line 593 "src/l.l" { yylval.url = create_URL(Str_ndup(yytext, strlen(yytext)-3)); BEGIN(URL_COND); } YY_BREAK case 336: YY_RULE_SETUP #line 598 "src/l.l" { yylval.number = atoi(yytext); save_arg(); return NUMBER; } YY_BREAK case 337: YY_RULE_SETUP #line 604 "src/l.l" { yylval.real = atof(yytext); save_arg(); return REAL; } YY_BREAK case 338: YY_RULE_SETUP #line 610 "src/l.l" { return PERCENT; } YY_BREAK case 339: YY_RULE_SETUP #line 614 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 340: YY_RULE_SETUP #line 620 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return PATH; } YY_BREAK case 341: YY_RULE_SETUP #line 626 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return PATH; } YY_BREAK case 342: /* rule 342 can match eol */ YY_RULE_SETUP #line 632 "src/l.l" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } YY_BREAK case 343: /* rule 343 can match eol */ YY_RULE_SETUP #line 639 "src/l.l" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } YY_BREAK case 344: YY_RULE_SETUP #line 646 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return MAILADDR; } YY_BREAK case 345: YY_RULE_SETUP #line 652 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return PATH; } YY_BREAK case 346: YY_RULE_SETUP #line 658 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return PATH; } YY_BREAK case 347: YY_RULE_SETUP #line 664 "src/l.l" { yylval.address = Address_new(); BEGIN(ADDRESS_COND); return MAILFROM; } YY_BREAK case 348: YY_RULE_SETUP #line 670 "src/l.l" { yylval.address = Address_new(); BEGIN(ADDRESS_COND); return MAILREPLYTO; } YY_BREAK case 349: YY_RULE_SETUP #line 676 "src/l.l" { char *p = yytext+strlen("subject:"); yylval.string = Str_trim(Str_dup(p)); save_arg(); return MAILSUBJECT; } YY_BREAK case 350: /* rule 350 can match eol */ YY_RULE_SETUP #line 683 "src/l.l" { char *p = yytext+strlen("message:"); steplinenobycr(yytext); yylval.string = Str_trim(Str_dup(p)); save_arg(); return MAILBODY; } YY_BREAK case 351: YY_RULE_SETUP #line 691 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 352: YY_RULE_SETUP #line 697 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 353: YY_RULE_SETUP #line 703 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 354: YY_RULE_SETUP #line 709 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 355: YY_RULE_SETUP #line 715 "src/l.l" ; YY_BREAK case 356: /* rule 356 can match eol */ YY_RULE_SETUP #line 717 "src/l.l" { lineno++; } YY_BREAK case 357: YY_RULE_SETUP #line 721 "src/l.l" { yylval.string = Str_dup(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } YY_BREAK case 358: YY_RULE_SETUP #line 728 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } YY_BREAK case 359: YY_RULE_SETUP #line 735 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } YY_BREAK case 360: YY_RULE_SETUP #line 742 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 361: YY_RULE_SETUP #line 750 "src/l.l" ; YY_BREAK case 362: /* rule 362 can match eol */ YY_RULE_SETUP #line 752 "src/l.l" { lineno++; } YY_BREAK case 363: YY_RULE_SETUP #line 756 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return SERVICENAME; } YY_BREAK case 364: YY_RULE_SETUP #line 762 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return SERVICENAME; } YY_BREAK case 365: YY_RULE_SETUP #line 768 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return SERVICENAME; } YY_BREAK case 366: /* rule 366 can match eol */ YY_RULE_SETUP #line 774 "src/l.l" { steplinenobycr(yytext); unput(yytext[strlen(yytext)-1]); BEGIN(INITIAL); } YY_BREAK case 367: YY_RULE_SETUP #line 784 "src/l.l" ; YY_BREAK case 368: /* rule 368 can match eol */ YY_RULE_SETUP #line 786 "src/l.l" { lineno++; } YY_BREAK case 369: YY_RULE_SETUP #line 790 "src/l.l" { BEGIN(INITIAL); } YY_BREAK case 370: /* rule 370 can match eol */ YY_RULE_SETUP #line 794 "src/l.l" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } YY_BREAK case 371: YY_RULE_SETUP #line 801 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 372: YY_RULE_SETUP #line 805 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 373: /* rule 373 can match eol */ YY_RULE_SETUP #line 815 "src/l.l" { BEGIN(INITIAL); if (! yylval.url->hostname) yyerror("missing hostname in URL"); if (! yylval.url->path) yylval.url->path = Str_dup("/"); yylval.url->url = Str_cat("%s://[%s]:%d%s%s%s", yylval.url->protocol, /* possible credentials are hidden */ yylval.url->hostname, yylval.url->port, yylval.url->path, yylval.url->query ? "?" : "", yylval.url->query ? yylval.url->query : ""); save_arg(); return URLOBJECT; } YY_BREAK case 374: /* rule 374 can match eol */ YY_RULE_SETUP #line 833 "src/l.l" { yylval.url->user = Str_dup(yytext); } YY_BREAK case 375: /* rule 375 can match eol */ YY_RULE_SETUP #line 837 "src/l.l" { yytext++; size_t length = strlen(yytext); if (length > 0) yylval.url->password = Str_ndup(yytext, length - 1); } YY_BREAK case 376: YY_RULE_SETUP #line 844 "src/l.l" { yylval.url->hostname = Str_dup(yytext); } YY_BREAK case 377: YY_RULE_SETUP #line 848 "src/l.l" { yylval.url->hostname = Str_ndup(yytext + 1, yyleng - 2); yylval.url->ipv6 = true; } YY_BREAK case 378: YY_RULE_SETUP #line 853 "src/l.l" { yylval.url->port = atoi(++yytext); } YY_BREAK case 379: YY_RULE_SETUP #line 857 "src/l.l" { yylval.url->path = Util_urlEncode(yytext, false); } YY_BREAK case 380: YY_RULE_SETUP #line 861 "src/l.l" { yylval.url->query = Util_urlEncode(++yytext, false); } YY_BREAK case 381: YY_RULE_SETUP #line 865 "src/l.l" { /* EMPTY - reference is ignored */ } YY_BREAK case 382: /* rule 382 can match eol */ YY_RULE_SETUP #line 873 "src/l.l" { if (yytext[0] == '}') yyless(0); BEGIN(INITIAL); if (! yylval.address->address) yyerror("missing address"); save_arg(); return ADDRESSOBJECT; } YY_BREAK case 383: YY_RULE_SETUP #line 883 "src/l.l" { yylval.address->address = Str_dup(yytext); } YY_BREAK case 384: YY_RULE_SETUP #line 887 "src/l.l" { char *name = Str_unquote(Str_dup(yytext)); if (name) { if (*name) yylval.address->name = name; else // Empty quoted string FREE(name); } } YY_BREAK case 385: YY_RULE_SETUP #line 898 "src/l.l" { // Ignore } YY_BREAK case 386: YY_RULE_SETUP #line 902 "src/l.l" { BEGIN(INITIAL); yyerror("invalid mail format"); } YY_BREAK case 387: YY_RULE_SETUP #line 910 "src/l.l" { yylval.string = Str_dup(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } YY_BREAK case 388: YY_RULE_SETUP #line 917 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } YY_BREAK case 389: YY_RULE_SETUP #line 924 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } YY_BREAK case 390: YY_RULE_SETUP #line 931 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 391: YY_RULE_SETUP #line 939 "src/l.l" ; YY_BREAK case 392: YY_RULE_SETUP #line 941 "src/l.l" ; YY_BREAK case 393: /* rule 393 can match eol */ YY_RULE_SETUP #line 943 "src/l.l" { lineno++; } YY_BREAK case 394: YY_RULE_SETUP #line 947 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return HOSTGROUPNAME; } YY_BREAK case 395: /* rule 395 can match eol */ YY_RULE_SETUP #line 953 "src/l.l" { yylval.string = Str_cat("%s", Str_unquote(yytext + 1)); save_arg(); return HOSTGROUPNAME; } YY_BREAK case 396: YY_RULE_SETUP #line 959 "src/l.l" { BEGIN(INITIAL); save_arg(); return ']'; } YY_BREAK case 397: YY_RULE_SETUP #line 965 "src/l.l" { BEGIN(INITIAL); yyerror("invalid hostgroup list format"); } YY_BREAK case 398: YY_RULE_SETUP #line 974 "src/l.l" ; YY_BREAK case 399: YY_RULE_SETUP #line 976 "src/l.l" { yylval.number = atoi(yytext); BEGIN(INITIAL); save_arg(); return NUMBER; } YY_BREAK case 400: YY_RULE_SETUP #line 983 "src/l.l" { // A minimal syntax check of the cron format string; 5 fields separated with white-space yylval.string = Str_dup(Str_unquote(yytext)); BEGIN(INITIAL); save_arg(); return TIMESPEC; } YY_BREAK case 401: YY_RULE_SETUP #line 990 "src/l.l" { BEGIN(INITIAL); return CYCLE; } YY_BREAK case 402: YY_RULE_SETUP #line 995 "src/l.l" { BEGIN(INITIAL); yyerror("invalid every format"); } YY_BREAK case 403: YY_RULE_SETUP #line 1004 "src/l.l" ; YY_BREAK case 404: YY_RULE_SETUP #line 1006 "src/l.l" ; YY_BREAK case 405: /* rule 405 can match eol */ YY_RULE_SETUP #line 1008 "src/l.l" { lineno++; } YY_BREAK case 406: *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 1012 "src/l.l" { // name/: save_arg(); } YY_BREAK case 407: /* rule 407 can match eol */ YY_RULE_SETUP #line 1016 "src/l.l" { // : value yylval.string = Str_cat("%s:%s", Str_trim(argyytext), Str_unquote(yytext + 1)); save_arg(); return HTTPHEADER; } YY_BREAK case 408: YY_RULE_SETUP #line 1022 "src/l.l" { BEGIN(INITIAL); save_arg(); return ']'; } YY_BREAK case 409: YY_RULE_SETUP #line 1028 "src/l.l" { BEGIN(INITIAL); yyerror("invalid HTTP header list format"); } YY_BREAK case 410: YY_RULE_SETUP #line 1036 "src/l.l" { check_state = None_State; return yytext[0]; } YY_BREAK case 411: YY_RULE_SETUP #line 1042 "src/l.l" /* eat the whitespace */ YY_BREAK case 412: YY_RULE_SETUP #line 1044 "src/l.l" { /* got the include file name with double quotes */ char *temp = Str_dup(yytext); Str_unquote(temp); include_file(temp); FREE(temp); BEGIN(INITIAL); } YY_BREAK case 413: YY_RULE_SETUP #line 1052 "src/l.l" { /* got the include file name with single quotes*/ char *temp = Str_dup(yytext); Str_unquote(temp); include_file(temp); FREE(temp); BEGIN(INITIAL); } YY_BREAK case 414: YY_RULE_SETUP #line 1060 "src/l.l" { /* got the include file name without quotes*/ char *temp = Str_dup(yytext); include_file(temp); FREE(temp); BEGIN(INITIAL); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(ARGUMENT_COND): case YY_STATE_EOF(DEPEND_COND): case YY_STATE_EOF(SERVICE_COND): case YY_STATE_EOF(URL_COND): case YY_STATE_EOF(ADDRESS_COND): case YY_STATE_EOF(STRING_COND): case YY_STATE_EOF(HOSTGROUP_COND): case YY_STATE_EOF(EVERY_COND): case YY_STATE_EOF(HTTP_HEADER_COND): case YY_STATE_EOF(INCLUDE): #line 1068 "src/l.l" { BEGIN(INITIAL); check_state = None_State; if (! pop_buffer_state()) yyterminate(); } YY_BREAK case 415: YY_RULE_SETUP #line 1076 "src/l.l" ECHO; YY_BREAK #line 9030 "src/lex.yy.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); /* "- 2" to take care of EOB's */ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); (yy_state_ptr) = (yy_state_buf); *(yy_state_ptr)++ = yy_current_state; for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 2766 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *(yy_state_ptr)++ = yy_current_state; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; YY_CHAR yy_c = 1; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 2766 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 2765); if ( ! yy_is_jam ) *(yy_state_ptr)++ = yy_current_state; return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT static void yyunput (int c, char * yy_bp ) { char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ int number_to_move = (yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_init_buffer( YY_CURRENT_BUFFER, input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree( (void *) b->yy_ch_buf ); yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return NULL; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (const char * yystr ) { return yy_scan_bytes( yystr, (int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yynoreturn yy_fatal_error (const char* msg ) { fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param _line_number line number * */ void yyset_lineno (int _line_number ) { yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str ) { yyin = _in_str ; } void yyset_out (FILE * _out_str ) { yyout = _out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int _bdebug ) { yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; (yy_state_buf) = 0; (yy_state_ptr) = 0; (yy_full_match) = 0; (yy_lp) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = NULL; yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; yyfree ( (yy_state_buf) ); (yy_state_buf) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return realloc(ptr, size); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 1076 "src/l.l" /* * Do lineno++ for every occurrence of '\n' in a string. This is * necessary whenever a yytext has an unknown number of CRs. */ static void steplinenobycr(char *string) { char *pos = string; while (*pos) if ('\n' == *pos++) { lineno++; } } static char *handle_quoted_string(char *string) { char *buf = Str_dup(string); Str_unquote(buf); if (! Util_handleEscapes(buf)) yyerror("unbalanced escape sequence"); return buf; } static void _include(const char *path) { if (Str_cmp(Run.files.control, path) == 0) { yywarning("Include loop detected when trying to include %s", path); return; } for (int i = 0; i < buffer_stack_ptr; i++) { if (Str_cmp(buffer_stack[i].currentfile, path) == 0) { yywarning("Include loop detected when trying to include %s", path); return; } } FILE *_yyin = fopen(path, "r"); if (! _yyin) yyerror("Cannot include file '%s' -- %s", path, STRERROR); else push_buffer_state(yy_create_buffer(_yyin, YY_BUF_SIZE), path); } static void include_file(char *pattern) { glob_t globbuf; errno = 0; if (glob(pattern, GLOB_MARK, NULL, &globbuf) == 0) { for (size_t i = 0; i < globbuf.gl_pathc; i++) { size_t filename_length = strlen(globbuf.gl_pathv[i]); if ((filename_length == 0) || (globbuf.gl_pathv[i][filename_length - 1] == '~' ) || (globbuf.gl_pathv[i][filename_length - 1] == '/')) continue; // skip subdirectories and file backup copies _include(globbuf.gl_pathv[i]); } globfree(&globbuf); } else if (errno != 0) { yywarning("Include failed -- %s", STRERROR); } // else no include files found -- silently ignore } static void push_buffer_state(YY_BUFFER_STATE buffer, const char *filename) { if (buffer_stack_ptr >= MAX_STACK_DEPTH) { yyerror("include files limit reached"); exit( 1 ); } buffer_stack[buffer_stack_ptr].lineno = lineno; buffer_stack[buffer_stack_ptr].currentfile = currentfile; buffer_stack[buffer_stack_ptr].buffer = YY_CURRENT_BUFFER; buffer_stack_ptr++; lineno = 1; currentfile = Str_dup(filename); yy_switch_to_buffer(buffer); BEGIN(INITIAL); } static int pop_buffer_state(void) { if ( --buffer_stack_ptr < 0 ) { return 0; } else { fclose(yyin); lineno = buffer_stack[buffer_stack_ptr].lineno; FREE(currentfile); currentfile = buffer_stack[buffer_stack_ptr].currentfile; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(buffer_stack[buffer_stack_ptr].buffer); } return 1; } static void save_arg(void) { arglineno = lineno; argcurrentfile = currentfile; FREE(argyytext); argyytext = Str_dup(yytext); } static URL_T create_URL(char *proto) { URL_T url; assert(proto); NEW(url); url->protocol = proto; if (IS(url->protocol, "https")) { url->port = 443; #ifndef HAVE_OPENSSL yyerror("HTTPS protocol not supported -- SSL support disabled" ); #endif } else if (IS(url->protocol, "http")) { url->port = 80; } else { yyerror("URL protocol not supported -- "); } return url; } // Turn back on unreachable code warnings #if defined(__clang__) || defined(__GNUC__) #pragma GCC diagnostic pop #endif monit-5.35.2/src/event.h0000644000016400001720000001163215007061157011736 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_EVENT_H #define MONIT_EVENT_H #include "monit.h" typedef enum { Event_Null = 0x0, Event_Checksum = 0x1, Event_Resource = 0x2, //FIXME: split to more specific events (cpu, totalcpu, mem, totalmem, loadaverage, space, inode, ...) Event_Timeout = 0x4, Event_Timestamp = 0x8, //FIXME: split to more specific events (atime, mtime, ctime) Event_Size = 0x10, Event_Connection = 0x20, Event_Permission = 0x40, Event_Uid = 0x80, Event_Gid = 0x100, Event_NonExist = 0x200, Event_Invalid = 0x400, Event_Data = 0x800, Event_Exec = 0x1000, Event_FsFlag = 0x2000, Event_Icmp = 0x4000, Event_Content = 0x8000, Event_Instance = 0x10000, Event_Action = 0x20000, Event_Pid = 0x40000, Event_PPid = 0x80000, Event_Heartbeat = 0x100000, Event_Status = 0x200000, Event_Uptime = 0x400000, Event_Link = 0x800000, //FIXME: split to more specific events (link status, link errors) Event_Speed = 0x1000000, Event_Saturation = 0x2000000, Event_ByteIn = 0x4000000, Event_ByteOut = 0x8000000, Event_PacketIn = 0x10000000, Event_PacketOut = 0x20000000, Event_Exist = 0x40000000, Event_All = 0x7FFFFFFF } Event_Type; #define IS_EVENT_SET(value, mask) ((value & mask) != 0) typedef struct myeventtable { int id; const char *description_failed; const char *description_succeeded; const char *description_changed; const char *description_changednot; State_Type saveState; // Bitmap of the event states that should trigger state file update } EventTable_T; extern EventTable_T Event_Table[]; /** * This class implements the event processing machinery used by * monit. In monit an event is an object containing a Service_T * reference indicating the object where the event originated, an id * specifying the event type, a value representing up or down state * and an optional message describing why the event was fired. * * Clients may use the function Event_post() to post events to the * event handler for processing. * * @file */ /** * Post a new Event * @param service The Service the event belongs to * @param id The event identification * @param state The event state * @param action Description of the event action * @param s Optional message describing the event */ void Event_post(Service_T service, long id, State_Type state, EventAction_T action, const char *s, ...) __attribute__((format (printf, 5, 6))); /** * Get a textual description of actual event type. For instance if the * event type is positive Event_Timestamp, the textual description is * "Timestamp error". Likewise if the event type is negative Event_Checksum * the textual description is "Checksum recovery" and so on. * @param E An event object * @return A string describing the event type in clear text. If the * event type is not found NULL is returned. */ const char *Event_get_description(Event_T E); /** * Get an event action id. * @param E An event object * @return An action id */ Action_Type Event_get_action(Event_T E); /** * Get a textual description of actual event action. For instance if the * event type is positive Event_NonExist, the textual description of * failed state related action is "restart". Likewise if the event type is * negative Event_Checksum the textual description of recovery related action * is "alert" and so on. * @param E An event object * @return A string describing the event type in clear text. If the * event type is not found NULL is returned. */ const char *Event_get_action_description(Event_T E); /** * Reprocess the partially handled event queue */ void Event_queue_process(void); #endif monit-5.35.2/src/file.c0000644000016400001720000002337115007061157011532 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_DIRENT_H #include #endif #include "monit.h" #include "engine.h" // libmonit #include "io/File.h" /** * Utilities for managing files used by monit. * * @file */ /* ------------------------------------------------------------------ Public */ void file_init(void) { char pidfile[STRLEN]; char buf[STRLEN]; /* Check if the pidfile was already set during configfile parsing */ if (Run.files.pid == NULL) { /* Set the location of this programs pidfile */ if (! getuid()) { snprintf(pidfile, STRLEN, "%s/%s", MYPIDDIR, MYPIDFILE); } else { snprintf(pidfile, STRLEN, "%s/.%s", Run.Env.home, MYPIDFILE); } Run.files.pid = Str_dup(pidfile); } /* Set the location of monit's id file */ if (Run.files.id == NULL) { snprintf(buf, STRLEN, "%s/.%s", Run.Env.home, MYIDFILE); Run.files.id = Str_dup(buf); } Util_monitId(Run.files.id); /* Set the location of monit's state file */ if (Run.files.state == NULL) { snprintf(buf, STRLEN, "%s/.%s", Run.Env.home, MYSTATEFILE); Run.files.state = Str_dup(buf); } } void file_finalize(void) { Engine_cleanup(); unlink(Run.files.pid); } char *file_findControlFile(void) { char *rcfile = CALLOC(sizeof(char), STRLEN + 1); snprintf(rcfile, STRLEN, "%s/.%s", Run.Env.home, MONITRC); if (File_exist(rcfile)) { return rcfile; } snprintf(rcfile, STRLEN, "/etc/%s", MONITRC); if (File_exist(rcfile)) { return rcfile; } snprintf(rcfile, STRLEN, "%s/%s", SYSCONFDIR, MONITRC); if (File_exist(rcfile)) { return rcfile; } snprintf(rcfile, STRLEN, "/usr/local/etc/%s", MONITRC); if (File_exist(rcfile)) { return rcfile; } if (File_exist(MONITRC)) { snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC); return rcfile; } Log_error("Cannot find the Monit control file at ~/.%s, /etc/%s, %s/%s, /usr/local/etc/%s or at ./%s \n", MONITRC, MONITRC, SYSCONFDIR, MONITRC, MONITRC, MONITRC); exit(1); } bool file_createPidFile(const char *pidfile) { assert(pidfile); unlink(pidfile); FILE *F = fopen(pidfile, "w"); if (! F) { Log_error("Error opening pidfile '%s' for writing -- %s\n", pidfile, STRERROR); return false; } fprintf(F, "%d\n", (int)getpid()); fclose(F); return true; } bool file_checkStat(const char *filename, const char *description, mode_t permmask) { assert(filename); assert(description); errno = 0; struct stat buf; if (stat(filename, &buf) < 0) { Log_error("Cannot stat the %s '%s' -- %s\n", description, filename, STRERROR); return false; } if (! S_ISREG(buf.st_mode)) { Log_error("The %s '%s' is not a regular file.\n", description, filename); return false; } if (buf.st_uid != geteuid()) { Log_error("The %s '%s' must be owned by you.\n", description, filename); return false; } if ((buf.st_mode & 0777) & ~permmask) { Log_error("The %s '%s' permission 0%o is wrong, maximum 0%o allowed\n", description, filename, buf.st_mode & 0777, permmask & 0777); return false; } return true; } bool file_checkQueueDirectory(const char *path) { if (mkdir(path, 0700) < 0 && errno != EEXIST) { Log_error("Cannot create the event queue directory '%s' -- %s\n", path, STRERROR); return false; } return true; } bool file_checkQueueLimit(const char *path, int limit) { if (limit >= 0) { DIR *dir = opendir(path); if (! dir) { Log_error("Cannot open the event queue directory '%s' -- %s\n", path, STRERROR); return false; } int used = 0; struct dirent *de = NULL; while ((de = readdir(dir)) ) { char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "%s/%s", path, de->d_name); if (File_isFile(buf) && ++used > limit) { Log_error("Event queue is full\n"); closedir(dir); return false; } } closedir(dir); } return true; } bool file_writeQueue(FILE *file, const void *data, size_t size) { assert(file); /* write size */ size_t rv = fwrite(&size, 1, sizeof(size_t), file); if (rv != sizeof(size_t)) { if (feof(file) || ferror(file)) Log_error("Queued event file: unable to write event size -- %s\n", feof(file) ? "end of file" : "stream error"); else Log_error("Queued event file: unable to write event size -- read returned %lu bytes\n", (unsigned long)rv); return false; } /* write data if any */ if (size > 0) { if ((rv = fwrite(data, 1, size, file)) != size) { if (feof(file) || ferror(file)) Log_error("Queued event file: unable to write event size -- %s\n", feof(file) ? "end of file" : "stream error"); else Log_error("Queued event file: unable to write event size -- read returned %lu bytes\n", (unsigned long)rv); return false; } } return true; } void *file_readQueue(FILE *file, size_t *size) { assert(file); /* read size */ size_t rv = fread(size, 1, sizeof(size_t), file); if (rv != sizeof(size_t)) { if (feof(file) || ferror(file)) Log_error("Queued event file: unable to read event size -- %s\n", feof(file) ? "end of file" : "stream error"); else Log_error("Queued event file: unable to read event size -- read returned %lu bytes\n", (unsigned long)rv); return NULL; } /* read data if any (allow 1MB at maximum to prevent enormous memory allocation) */ void *data = NULL; if (*size > 0 && *size < 1048576) { data = CALLOC(1, *size); if ((rv = fread(data, 1, *size, file)) != *size) { FREE(data); if (feof(file) || ferror(file)) Log_error("Queued event file: unable to read event data -- %s\n", feof(file) ? "end of file" : "stream error"); else Log_error("Queued event file: unable to read event data -- read returned %lu bytes\n", (unsigned long)rv); return NULL; } } return data; } bool file_readProc(char *buf, int buf_size, const char *name, int pid, int *bytes_read) { assert(buf); assert(name); char filename[STRLEN]; if (pid < 0) snprintf(filename, sizeof(filename), "/proc/%s", name); else snprintf(filename, sizeof(filename), "/proc/%d/%s", pid, name); int fd = open(filename, O_RDONLY); if (fd < 0) { if (Run.debug >= 2) DEBUG("Cannot open proc file '%s' -- %s\n", filename, STRERROR); return false; } bool rv = false; int bytes = (int)read(fd, buf, buf_size - 1); if (bytes >= 0) { if (bytes_read) *bytes_read = bytes; buf[bytes] = 0; rv = true; } else { *buf = 0; DEBUG("Cannot read proc file '%s' -- %s\n", filename, STRERROR); } if (close(fd) < 0) Log_error("Failed to close proc file '%s' -- %s\n", filename, STRERROR); return rv; } monit-5.35.2/src/monit.c0000644000016400001720000011706715007061157011747 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #include #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_GETOPT_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_WAIT_H #include #endif #include "monit.h" #include "SystemInfo.h" #include "ProcessTree.h" #include "state.h" #include "event.h" #include "engine.h" #include "client.h" #include "MMonit.h" #include "md5.h" #include "sha1.h" #include "checksum.h" // libmonit #include "Bootstrap.h" #include "io/Dir.h" #include "io/File.h" #include "system/Time.h" #include "util/List.h" #include "exceptions/AssertException.h" /** * DESCRIPTION * monit - system for monitoring services on a Unix system * * SYNOPSIS * monit [options] {arguments} * * @file */ /* -------------------------------------------------------------- Prototypes */ static void do_init(void); /* Initialize this application */ static void do_reinit(bool full); /* Re-initialize the runtime application */ static void do_action(List_T); /* Dispatch to the submitted action */ static void do_exit(bool); /* Finalize monit */ static void do_default(void); /* Do default action */ static void do_options(int, char **, List_T); /* Handle program options */ static void *do_heartbeat(void *args); /* M/Monit heartbeat thread */ static void help(void); /* Print program help message to stdout */ static void version(void); /* Print version information */ static void handle_reload(int); /* Signalhandler for a daemon reload */ static void handle_stop(int); /* Signalhandler for monit finalization */ static void handle_wakeup(int); /* Signalhandler for a daemon wakeup call */ /* ------------------------------------------------------------------ Global */ const char *Prog; /**< The Name of this Program */ struct Run_T Run; /**< Struct holding runtime constants */ Service_T Service_List; /**< The service list (created in p.y) */ Service_T Service_List_Conf; /**< The service list in conf file (c. in p.y) */ ServiceGroup_T Service_Group_List;/**< The service group list (created in p.y) */ SystemInfo_T System_Info; /**< System information */ const char *Action_Names[] = {"ignore", "alert", "restart", "stop", "exec", "unmonitor", "start", "monitor", ""}; const char *Mode_Names[] = {"active", "passive"}; const char *onReboot_Names[] = {"start", "nostart", "laststate"}; const char *Checksum_Names[] = {"UNKNOWN", "MD5", "SHA1"}; const char *Operator_Names[] = {"less than", "less than or equal to", "greater than", "greater than or equal to", "equal to", "not equal to", "changed"}; const char *OperatorShort_Names[] = {"<", "<=", ">", ">=", "=", "!=", "<>"}; const char *Servicetype_Names[] = {"Filesystem", "Directory", "File", "Process", "Remote Host", "System", "Fifo", "Program", "Network"}; const char *Path_Names[] = {"Path", "Path", "Path", "Pid file", "Path", "", "Path"}; const char *Icmp_Names[] = {"Reply", "", "", "Destination Unreachable", "Source Quench", "Redirect", "", "", "Ping", "", "", "Time Exceeded", "Parameter Problem", "Timestamp Request", "Timestamp Reply", "Information Request", "Information Reply", "Address Mask Request", "Address Mask Reply"}; const char *Socket_Names[] = {"unix", "IP", "IPv4", "IPv6"}; const char *Timestamp_Names[] = {"modify/change time", "access time", "change time", "modify time"}; const char *Httpmethod_Names[] = {"", "HEAD", "GET"}; /* -------------------------------------------------------------- File Private */ static AtomicThread_T Heartbeat_Thread; /* ------------------------------------------------------------------ Public */ /** * The Prime mover */ int main(int argc, char **argv) { Bootstrap(); // Bootstrap libmonit Bootstrap_setAbortHandler(Log_abort_handler); // Abort Monit on exceptions thrown by libmonit Bootstrap_setErrorHandler(Log_verror); Bootstrap_setDebugHandler(Log_vdebug); setlocale(LC_ALL, "C"); Prog = File_basename(argv[0]); #ifdef HAVE_OPENSSL Ssl_start(); #endif init_env(); List_T arguments = List_new(); TRY { do_options(argc, argv, arguments); } ELSE { Log_error("%s\n", Exception_frame.message); exit(1); } END_TRY; do_init(); do_action(arguments); List_free(&arguments); do_exit(false); } /** * Wakeup a sleeping monit daemon. * Returns true on success otherwise false */ bool do_wakeupcall(void) { pid_t pid; if ((pid = exist_daemon()) > 0) { kill(pid, SIGUSR1); Log_info("Monit daemon with PID %d awakened\n", pid); return true; } return false; } bool interrupt(void) { return Run.flags & Run_Stopped || Run.flags & Run_DoReload; } /* ----------------------------------------------------------------- Private */ static void _validateOnce(void) { if (State_open()) { State_restore(); validate(); State_save(); State_close(); } } /** * Initialize this application - Register signal handlers, * Parse the control file and initialize the program's * datastructures and the log system. */ static void do_init(void) { /* * Register interest for the SIGTERM signal, * in case we run in daemon mode this signal * will terminate a running daemon. */ signal(SIGTERM, handle_stop); /* * Register interest for the SIGUSER1 signal, * in case we run in daemon mode this signal * will wakeup a sleeping daemon. */ signal(SIGUSR1, handle_wakeup); /* * Register interest for the SIGINT signal, * in case we run as a server but not as a daemon * we need to catch this signal if the user pressed * CTRL^C in the terminal */ signal(SIGINT, handle_stop); /* * Register interest for the SIGHUP signal, * in case we run in daemon mode this signal * will reload the configuration. */ signal(SIGHUP, handle_reload); /* * Register no interest for the SIGPIPE signal */ signal(SIGPIPE, SIG_IGN); /* * Initialize the random number generator */ srandom((unsigned)(Time_now() + getpid())); /* * Initialize the Runtime mutex. This mutex * is used to synchronize handling of global * service data */ Mutex_init(Run.mutex); // Initialize the Heartbeat Thread variable AtomicThread_init(&Heartbeat_Thread); /* * Get the position of the control file */ if (! Run.files.control) Run.files.control = file_findControlFile(); /* * Initialize the system information data collecting interface */ if (SystemInfo_init()) { Run.flags |= Run_ProcessEngineEnabled; } /* * Start the Parser and create the service list. This will also set * any Runtime constants defined in the controlfile. */ if (! parse(Run.files.control)) { Log_error("%s exiting due to parsing errors in the configuration file.\n", Prog); exit(1); } /* * Initialize the log system */ if (! Log_init()) exit(1); /* * Did we find any service ? */ if (! Service_List) { Log_error("No service has been specified\n"); exit(0); } /* * Initialize Runtime file variables */ file_init(); /* * Should we print debug information ? */ if (Run.debug) { Util_printRunList(); Util_printServiceList(); } } /** * Re-Initialize the application - called if a * monit daemon receives the SIGHUP signal. */ static void do_reinit(bool full) { Log_info("Reinitializing Monit -- control file '%s'\n", Run.files.control); if (AtomicThread_isActive(&Heartbeat_Thread)) { Sem_signal(Heartbeat_Thread.sem); Thread_join(Heartbeat_Thread.value); } Run.flags &= ~Run_DoReload; /* Stop http interface */ if (Run.httpd.flags & Httpd_Net || Run.httpd.flags & Httpd_Unix) monit_http(Httpd_Stop); /* Save the current state (no changes are possible now since the http thread is stopped) */ if (full) State_save(); State_close(); /* Run the garbage collector */ gc(); if (! parse(Run.files.control)) { Log_error("%s exiting due to parsing errors in the configuration file.\n", Prog); exit(1); } /* Close the current log */ Log_close(); /* Reinstall the log system */ if (! Log_init()) exit(1); /* Did we find any services ? */ if (! Service_List) { Log_error("No service has been specified\n"); exit(0); } /* Reinitialize Runtime file variables */ file_init(); if (! file_createPidFile(Run.files.pid)) { Log_error("%s stopped -- cannot create a pid file\n", Prog); exit(1); } /* Update service data from the state repository */ if (! State_open()) exit(1); State_restore(); if (full) { /* Start http interface */ if (can_http()) monit_http(Httpd_Start); /* send the monit startup notification */ Event_post(Run.system, Event_Instance, State_Changed, Run.system->action_MONIT_START, "Monit reloaded"); if (Run.mmonits) { AtomicThread_create(&Heartbeat_Thread, do_heartbeat, NULL); } } } static bool _isMemberOfGroup(Service_T s, ServiceGroup_T g) { for (_list_t m = g->members->head; m; m = m->next) { Service_T member = m->e; if (s == member) return true; } return false; } static bool _hasParentInTheSameGroup(Service_T s, ServiceGroup_T g) { for (Dependant_T d = s->dependantlist; d; d = d->next ) { Service_T parent = Util_getService(d->dependant); if (parent && _isMemberOfGroup(parent, g)) return true; } return false; } /** * Dispatch to the submitted action - actions are program arguments */ static void do_action(List_T arguments) { char *action = List_pop(arguments); Run.flags |= Run_Once; if (! action) { do_default(); } else if (IS(action, "start") || IS(action, "stop") || IS(action, "monitor") || IS(action, "unmonitor") || IS(action, "restart")) { char *service = List_pop(arguments); if (Run.mygroup || service) { int errors = 0; List_T services = List_new(); if (Run.mygroup) { for (ServiceGroup_T sg = Service_Group_List; sg; sg = sg->next) { if (IS(Run.mygroup, sg->name)) { for (_list_t m = sg->members->head; m; m = m->next) { Service_T s = m->e; if (IS(action, "restart") && _hasParentInTheSameGroup(s, sg)) { DEBUG("Restart of %s skipped -- it'll be handled as part of the dependency chain, as the parent service is member of the same group\n", s->name); continue; } List_append(services, s->name); } break; } } if (List_length(services) == 0) { List_free(&services); Log_error("Group '%s' not found\n", Run.mygroup); exit(1); } } else if (IS(service, "all")) { for (Service_T s = Service_List; s; s = s->next) List_append(services, s->name); } else { List_append(services, service); } errors = exist_daemon() ? (HttpClient_action(action, services) ? 0 : 1) : control_service_string(services, action); List_free(&services); if (errors) exit(1); } else { Log_error("Please specify a service name or 'all' after %s\n", action); exit(1); } } else if (IS(action, "reload")) { Log_info("Reinitializing %s daemon\n", Prog); kill_daemon(SIGHUP); } else if (IS(action, "status")) { char *service = List_pop(arguments); if (! HttpClient_status(Run.mygroup, service)) exit(1); } else if (IS(action, "summary")) { char *service = List_pop(arguments); if (! HttpClient_summary(Run.mygroup, service)) exit(1); } else if (IS(action, "report")) { char *type = List_pop(arguments); if (! HttpClient_report(Run.mygroup, type)) exit(1); } else if (IS(action, "procmatch")) { char *pattern = List_pop(arguments); if (! pattern) { printf("Invalid syntax - usage: procmatch \"\"\n"); exit(1); } ProcessTree_testMatch(pattern); } else if (IS(action, "quit")) { kill_daemon(SIGTERM); } else if (IS(action, "validate")) { if (do_wakeupcall()) { char *service = List_pop(arguments); HttpClient_status(Run.mygroup, service); } else { _validateOnce(); } exit(1); } else { Log_error("Invalid argument -- %s (-h will show valid arguments)\n", action); exit(1); } } /** * Finalize monit */ static bool _is_init(void) { return getpid() == 1; } /// Returns true if process 'pid' has terminated within the 10 seconds /// grace period otherwise false static bool _wait_for_termination(pid_t pid) { long long elapsed = 0LL; long long grace_period = 10 * USEC_PER_SEC; // 10 Seconds long long check_interval = 100 * USEC_PER_MSEC; // 100 milliseconds while (elapsed < grace_period) { if (kill(pid, 0) != 0) return true; Time_usleep(check_interval); elapsed += check_interval; } return false; } static void _shutdown_visitor(ProcessTree_T *p, __attribute__((unused)) void *context) { if (p->pid > 1) { // Skip init (ourself) kill(p->pid, SIGTERM); if (!_wait_for_termination(p->pid)) { // Process didn't terminate within grace period kill(p->pid, SIGKILL); } } } static void _perform_init_shutdown(void) { Log_info("Monit running as PID 1, performing init shutdown responsibilities\n"); // First, stop all managed services gracefully for (Service_T s = Service_List; s; s = s->next) { control_service(s->name, Action_Stop); } // Visit all remaining processes and shut them down (except self) ProcessTree_visit(_shutdown_visitor, NULL); } static void do_exit(bool saveState) { set_signal_block(true); Run.flags |= Run_Stopped; if ((Run.flags & Run_Daemon) && ! (Run.flags & Run_Once)) { if (can_http()) { monit_http(Httpd_Stop); } if (AtomicThread_isActive(&Heartbeat_Thread)) { Sem_signal(Heartbeat_Thread.sem); Thread_join(Heartbeat_Thread.value); } AtomicThread_destroy(&Heartbeat_Thread); /* send the monit stop notification */ Event_post(Run.system, Event_Instance, State_Changed, Run.system->action_MONIT_STOP, "Monit %s stopped", VERSION); } if (saveState) { State_save(); } // Special handling when running as PID 1 (init) if (_is_init()) { _perform_init_shutdown(); } if ((Run.flags & Run_Daemon) && ! (Run.flags & Run_Once)) { Log_info("Monit daemon with pid [%d] stopped\n", (int)getpid()); } gc(); #ifdef HAVE_OPENSSL Ssl_stop(); #endif exit(0); } /** * Default action - become a daemon if defined in the Run object and * run validate() between sleeps. If not, just run validate() once. * Also, if specified, start the monit http server if in daemon mode. */ static void do_default(void) { if (Run.flags & Run_Daemon) { if (do_wakeupcall()) exit(0); Run.flags &= ~Run_Once; if (can_http()) { if (Run.httpd.flags & Httpd_Net) Log_info("Starting Monit %s daemon with http interface at [%s]:%d\n", VERSION, Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "*", Run.httpd.socket.net.port); else if (Run.httpd.flags & Httpd_Unix) Log_info("Starting Monit %s daemon with http interface at %s\n", VERSION, Run.httpd.socket.unix.path); } else { Log_info("Starting Monit %s daemon\n", VERSION); } if (! (Run.flags & Run_Foreground)) { if (_is_init()) { Log_warning("Monit is running as process 1 (init) and cannot daemonize\n" "Please start monit with the -I option to avoid seeing this warning\n"); } else { daemonize(); } } if (! file_createPidFile(Run.files.pid)) { Log_error("Monit daemon died\n"); exit(1); } if (! State_open()) exit(1); State_restore(); atexit(file_finalize); reload: if (Run.startdelay) { if (State_reboot()) { Log_info("Monit will delay for %d seconds on first start after reboot ...\n", Run.startdelay); // Sleep, unless there is a pending action or monit was stopped/reloaded (sleep can be interrupted by signal) for (long remaining = Run.startdelay; remaining > 0; remaining = Time_sleep(remaining)) { if (Run.flags & Run_Stopped) { do_exit(false); } else if (Run.flags & Run_DoReload) { do_reinit(false); goto reload; } } } else { DEBUG("Monit delay %ds skipped -- the system boot time has not changed since last Monit start\n", Run.startdelay); } } if (can_http()) monit_http(Httpd_Start); /* send the monit startup notification */ Event_post(Run.system, Event_Instance, State_Changed, Run.system->action_MONIT_START, "Monit %s started", VERSION); if (Run.mmonits) { AtomicThread_create(&Heartbeat_Thread, do_heartbeat, NULL); } while (true) { validate(); // Sleep, unless there is a pending action or monit was stopped/reloaded (sleep can be interrupted by signal) // Using Time_usleep instead of Time_sleep to handle signal interruptions properly. // Time_sleep only returns whole seconds remaining after interruption, discarding // fractional seconds. This can cause premature loop exit with frequent signals, // effectively preventing proper sleep timing. Time_usleep preserves microsecond // precision, ensuring correct remaining time calculation when interrupted. for (long long remaining = Run.polltime * USEC_PER_SEC; remaining > 0; remaining = Time_usleep(remaining)) { if ((Run.flags & Run_ActionPending) || interrupt()) break; } if (Run.flags & Run_DoWakeup) { Run.flags &= ~Run_DoWakeup; Log_info("Awakened by User defined signal 1\n"); } if (Run.flags & Run_Stopped) { do_exit(true); } else if (Run.flags & Run_DoReload) { do_reinit(true); } else { State_saveIfDirty(); } } } else { _validateOnce(); } } /** * Handle program options - Options set from the commandline * takes precedence over those found in the control file */ static void do_options(int argc, char **argv, List_T arguments) { int opt; int deferred_opt = 0; opterr = 0; Run.mygroup = NULL; const char *shortopts = "+c:d:g:l:p:s:HIirtvVhB"; while (optind < argc) { #ifdef HAVE_GETOPT_LONG struct option longopts[] = { {"conf", required_argument, NULL, 'c'}, {"daemon", required_argument, NULL, 'd'}, {"group", required_argument, NULL, 'g'}, {"logfile", required_argument, NULL, 'l'}, {"pidfile", required_argument, NULL, 'p'}, {"statefile", required_argument, NULL, 's'}, {"hash", optional_argument, NULL, 'H'}, {"id", no_argument, NULL, 'i'}, {"help", no_argument, NULL, 'h'}, {"resetid", no_argument, NULL, 'r'}, {"test", no_argument, NULL, 't'}, {"verbose", no_argument, NULL, 'v'}, {"batch", no_argument, NULL, 'B'}, {"interactive", no_argument, NULL, 'I'}, {"version", no_argument, NULL, 'V'}, {0} }; if ((opt = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) #else if ((opt = getopt(argc, argv, shortopts)) != -1) #endif { switch (opt) { case 'c': { char *f = optarg; char realpath[PATH_MAX] = {}; if (Run.files.control) { Log_warning("WARNING: The -c option was specified multiple times, only the last value will be used\n"); FREE(Run.files.control); } if (f[0] != SEPARATOR_CHAR) f = File_realPath(optarg, realpath); if (! f) THROW(AssertException, "The control file '%s' does not exist at %s", Str_trunc(optarg, 80), Dir_cwd((char[STRLEN]){}, STRLEN)); if (! File_isFile(f)) THROW(AssertException, "The control file '%s' is not a file", Str_trunc(f, 80)); if (! File_isReadable(f)) THROW(AssertException, "The control file '%s' is not readable", Str_trunc(f, 80)); Run.files.control = Str_dup(f); break; } case 'd': { Run.flags |= Run_Daemon; if (sscanf(optarg, "%d", &Run.polltime) != 1 || Run.polltime < 1) { Log_error("Option -%c requires a natural number\n", opt); exit(1); } break; } case 'g': { if (Run.mygroup) { Log_warning("WARNING: The -g option was specified multiple times, only the last value will be used\n"); FREE(Run.mygroup); } Run.mygroup = Str_dup(optarg); break; } case 'l': { if (Run.files.log) { Log_warning("WARNING: The -l option was specified multiple times, only the last value will be used\n"); FREE(Run.files.log); } Run.files.log = Str_dup(optarg); if (IS(Run.files.log, "syslog")) Run.flags |= Run_UseSyslog; Run.flags |= Run_Log; break; } case 'p': { if (Run.files.pid) { Log_warning("WARNING: The -p option was specified multiple times, only the last value will be used\n"); FREE(Run.files.pid); } Run.files.pid = Str_dup(optarg); break; } case 's': { if (Run.files.state) { Log_warning("WARNING: The -s option was specified multiple times, only the last value will be used\n"); FREE(Run.files.state); } Run.files.state = Str_dup(optarg); break; } case 'I': { Run.flags |= Run_Foreground; break; } case 'i': { deferred_opt = 'i'; break; } case 'r': { deferred_opt = 'r'; break; } case 't': { deferred_opt = 't'; break; } case 'v': { Run.debug++; Bootstrap_setDebugHandler(Log_vdebug); break; } case 'H': { if (argc > optind) Checksum_printHash(argv[optind]); else Checksum_printHash(NULL); exit(0); break; } case 'V': { version(); exit(0); break; } case 'h': { help(); exit(0); break; } case 'B': { Run.flags |= Run_Batch; break; } case '?': { switch (optopt) { case 'c': case 'd': case 'g': case 'l': case 'p': case 's': { Log_error("Option -- %c requires an argument\n", optopt); break; } default: { Log_error("Invalid option -- %c (-h will show valid options)\n", optopt); } } exit(1); } } } else { List_append(arguments, argv[optind++]); } } /* Handle deferred options to make arguments to the program positional independent. These options are handled last, here as they represent exit points in the application and the control-file might be set with -c and these options need to respect the new control-file location as they call do_init */ switch (deferred_opt) { case 't': { do_init(); // Parses control file and initialize program, exit on error printf("Control file syntax OK\n"); exit(0); break; } case 'r': { do_init(); assert(Run.id); printf("Reset Monit Id? [y/N]> "); if (tolower(getchar()) == 'y') { File_delete(Run.files.id); Util_monitId(Run.files.id); kill_daemon(SIGHUP); // make any running Monit Daemon reload the new ID-File } exit(0); break; } case 'i': { do_init(); assert(Run.id); printf("Monit ID: %s\n", Run.id); exit(0); break; } } } /** * Print the program's help message */ static void help(void) { printf( "Usage: %s [options]+ [command]\n" "Options are as follows:\n" " -c file Use this control file\n" " -d n Run as a daemon once per n seconds\n" " -g name Set group name for monit commands\n" " -l logfile Print log information to this file\n" " -p pidfile Use this lock file in daemon mode\n" " -s statefile Set the file monit should write state information to\n" " -I Do not run in background (needed when run from init)\n" " --id Print Monit's unique ID\n" " --resetid Reset Monit's unique ID. Use with caution\n" " -B Batch command line mode (do not output tables or colors)\n" " -t Run syntax check for the control file\n" " -v Verbose mode, work noisy (diagnostic output)\n" " -vv Very verbose mode, same as -v plus log stacktrace on error\n" " -H [filename] Print SHA1 and MD5 hashes of the file or of stdin if the\n" " filename is omitted; monit will exit afterwards\n" " -V Print version number and patchlevel\n" " -h Print this text\n" "Optional commands are as follows:\n" " start all - Start all services\n" " start - Only start the named service\n" " stop all - Stop all services\n" " stop - Stop the named service\n" " restart all - Stop and start all services\n" " restart - Only restart the named service\n" " monitor all - Enable monitoring of all services\n" " monitor - Only enable monitoring of the named service\n" " unmonitor all - Disable monitoring of all services\n" " unmonitor - Only disable monitoring of the named service\n" " reload - Reinitialize monit\n" " status [name] - Print full status information for service(s)\n" " summary [name] - Print short status information for service(s)\n" " report [up|down|..] - Report state of services. See manual for options\n" " quit - Kill the monit daemon process\n" " validate - Check all services and start if not running\n" " procmatch - Test process matching pattern\n", Prog); } /** * Print version information */ static void version(void) { printf("This is Monit version %s\n", VERSION); printf("Built with"); #ifndef HAVE_OPENSSL printf("out"); #endif printf(" ssl, with"); #ifndef HAVE_IPV6 printf("out"); #endif printf(" ipv6, with"); #ifndef HAVE_LIBZ printf("out"); #endif printf(" compression, with"); #ifndef HAVE_LIBPAM printf("out"); #endif printf(" pam and with"); #ifndef HAVE_LARGEFILES printf("out"); #endif printf(" large files\n"); printf("Copyright (C) 2001-2025 Tildeslash Ltd. All Rights Reserved.\n"); } // M/Monit heartbeat thread static void *do_heartbeat(__attribute__ ((unused)) void *args) { set_signal_block(false); Log_info("M/Monit heartbeat started\n"); LOCK(Heartbeat_Thread.mutex) { while (! interrupt()) { MMonit_send(NULL); struct timespec wait = {.tv_sec = Time_now() + Run.polltime}; Sem_timeWait(Heartbeat_Thread.sem, Heartbeat_Thread.mutex, wait); } } END_LOCK; #ifdef HAVE_OPENSSL Ssl_threadCleanup(); #endif Log_info("M/Monit heartbeat stopped\n"); return NULL; } // Signal handler for a daemon reload call static void handle_reload(__attribute__ ((unused)) int sig) { Run.flags |= Run_DoReload; } // Signal handler for monit finalization static void handle_stop(__attribute__ ((unused)) int sig) { Run.flags |= Run_Stopped; } // Signal handler for a daemon wakeup call static void handle_wakeup(__attribute__ ((unused)) int sig) { Run.flags |= Run_DoWakeup; } monit-5.35.2/src/util.c0000644000016400001720000025213315007061157011570 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_CRYPT_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_PAM_PAM_APPL_H #include #endif #ifdef HAVE_SECURITY_PAM_APPL_H #include #endif #ifdef HAVE_PWD_H #include #endif #ifdef HAVE_GRP_H #include #endif #include "monit.h" #include "engine.h" #include "md5.h" #include "md5_crypt.h" #include "sha1.h" #include "base64.h" #include "alert.h" #include "event.h" #include "state.h" #include "protocol.h" #include "checksum.h" // libmonit #include "io/File.h" #include "util/Fmt.h" #include "system/Time.h" #include "system/Random.h" #include "exceptions/AssertException.h" #include "exceptions/IOException.h" struct ad_user { const char *login; const char *passwd; }; /* Unsafe URL characters: [00-1F, 7F-FF] <>\"#%}{|\\^[] ` */ static const unsigned char urlunsafe[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; /* Unsafe URL characters for parameter value: [00-1F, 7F-FF] ?=&/<>\"#%}{|\\^[] ` */ static const unsigned char urlunsafeparameter[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; static const unsigned char b2x[][256] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF" }; /** * General purpose utility methods. * * @file */ /* ----------------------------------------------------------------- Private */ /** * Returns the value of the parameter if defined or the String "(not * defined)" */ static const char *is_str_defined(const char *s) { return((s && *s) ? s : "(not defined)"); } /** * Convert a hex char to a char */ static char _x2c(char *hex) { register char digit; digit = ((hex[0] >= 'A') ? ((hex[0] & 0xDF) - 'A') + 10 : (hex[0] - '0')); digit *= 16; digit += (hex[1] >= 'A' ? ((hex[1] & 0xDF) - 'A') + 10 : (hex[1] - '0')); return(digit); } /** * Print registered events list */ static void printevents(unsigned int events) { if (events == Event_Null) { printf("No events"); } else if (events == Event_All) { printf("All events"); } else { if (IS_EVENT_SET(events, Event_Action)) printf("Action "); if (IS_EVENT_SET(events, Event_ByteIn)) printf("ByteIn "); if (IS_EVENT_SET(events, Event_ByteOut)) printf("ByteOut "); if (IS_EVENT_SET(events, Event_Checksum)) printf("Checksum "); if (IS_EVENT_SET(events, Event_Connection)) printf("Connection "); if (IS_EVENT_SET(events, Event_Content)) printf("Content "); if (IS_EVENT_SET(events, Event_Data)) printf("Data "); if (IS_EVENT_SET(events, Event_Exec)) printf("Exec "); if (IS_EVENT_SET(events, Event_Exist)) printf("Exist "); if (IS_EVENT_SET(events, Event_FsFlag)) printf("Fsflags "); if (IS_EVENT_SET(events, Event_Gid)) printf("Gid "); if (IS_EVENT_SET(events, Event_Icmp)) printf("Icmp "); if (IS_EVENT_SET(events, Event_Instance)) printf("Instance "); if (IS_EVENT_SET(events, Event_Invalid)) printf("Invalid "); if (IS_EVENT_SET(events, Event_Link)) printf("Link "); if (IS_EVENT_SET(events, Event_NonExist)) printf("Nonexist "); if (IS_EVENT_SET(events, Event_PacketIn)) printf("PacketIn "); if (IS_EVENT_SET(events, Event_PacketOut)) printf("PacketOut "); if (IS_EVENT_SET(events, Event_Permission)) printf("Permission "); if (IS_EVENT_SET(events, Event_Pid)) printf("PID "); if (IS_EVENT_SET(events, Event_PPid)) printf("PPID "); if (IS_EVENT_SET(events, Event_Resource)) printf("Resource "); if (IS_EVENT_SET(events, Event_Saturation)) printf("Saturation "); if (IS_EVENT_SET(events, Event_Size)) printf("Size "); if (IS_EVENT_SET(events, Event_Speed)) printf("Speed "); if (IS_EVENT_SET(events, Event_Status)) printf("Status "); if (IS_EVENT_SET(events, Event_Timeout)) printf("Timeout "); if (IS_EVENT_SET(events, Event_Timestamp)) printf("Timestamp "); if (IS_EVENT_SET(events, Event_Uid)) printf("Uid "); if (IS_EVENT_SET(events, Event_Uptime)) printf("Uptime "); } printf("\n"); } #ifdef HAVE_LIBPAM /** * PAM conversation */ #if defined(SOLARIS) || defined(AIX) static int PAMquery(int num_msg, struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { #else static int PAMquery(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { #endif int i; struct ad_user *user = (struct ad_user *)appdata_ptr; struct pam_response *response; /* Sanity checking */ if (! msg || ! resp || ! user || ! num_msg) return PAM_CONV_ERR; response = CALLOC(sizeof(struct pam_response), num_msg); for (i = 0; i < num_msg; i++) { response[i].resp = NULL; response[i].resp_retcode = 0; switch ((*(msg[i])).msg_style) { case PAM_PROMPT_ECHO_ON: /* Store the login as the response. This likely never gets called, since login was on pam_start() */ response[i].resp = appdata_ptr ? Str_dup(user->login) : NULL; break; case PAM_PROMPT_ECHO_OFF: /* Store the password as the response */ response[i].resp = appdata_ptr ? Str_dup(user->passwd) : NULL; break; case PAM_TEXT_INFO: case PAM_ERROR_MSG: /* Shouldn't happen since we have PAM_SILENT set. If it happens anyway, ignore it. */ break; default: /* Something strange... */ FREE(response); return PAM_CONV_ERR; } } /* On success, return the response structure */ *resp = response; return PAM_SUCCESS; } /** * Validate login/passwd via PAM service "monit" */ static bool PAMcheckPasswd(const char *login, const char *passwd) { int rv; pam_handle_t *pamh = NULL; struct ad_user user_info = { login, passwd }; struct pam_conv conv = { PAMquery, &user_info }; if ((rv = pam_start("monit", login, &conv, &pamh) != PAM_SUCCESS)) { DEBUG("PAM authentication start failed -- %d\n", rv); return false; } if ((rv = pam_authenticate(pamh, PAM_SILENT)) == PAM_SUCCESS) rv = pam_acct_mgmt(pamh, PAM_SILENT); pam_end(pamh, rv); return rv == PAM_SUCCESS ? true : false; } /** * Check whether the user is member of allowed groups */ static Auth_T PAMcheckUserGroup(const char *uname) { Auth_T c = Run.httpd.credentials; struct passwd *pwd = NULL; struct group *grp = NULL; assert(uname); if (! (pwd = getpwnam(uname))) return NULL; if (! (grp = getgrgid(pwd->pw_gid))) return NULL; while (c) { if (c->groupname) { struct group *sgrp = NULL; /* check for primary group match */ if (IS(c->groupname, grp->gr_name)) return c; /* check secondary groups match */ if ((sgrp = getgrnam(c->groupname))) { char **g = NULL; for (g = sgrp->gr_mem; *g; g++) if (IS(*g, uname)) return c; } } c = c->next; } return NULL; } #endif /* ------------------------------------------------------------------ Public */ char *Util_replaceString(char **src, const char *old, const char *new) { assert(src); assert(*src); assert(old); assert(new); size_t i = Util_countWords(*src, old); if (i) { size_t l = strlen(old); size_t new_len = strlen(new); size_t d; if (new_len > l) { d = (new_len - l) * i; } else { d = 0; } char *buf = CALLOC(sizeof(char), strlen(*src) + d + 1); char *p; char *q = *src; *buf = 0; while ((p = strstr(q, old))) { *p = 0; strcat(buf, q); strcat(buf, new); p += l; q = p; } strcat(buf, q); FREE(*src); *src = buf; } return *src; } size_t Util_countWords(const char *s, const char *word) { size_t i = 0; const char *p = s; assert(s && word); while ((p = strstr(p, word))) { i++; p++; } return i; } char *Util_handleEscapes(char *buf) { assert(buf); size_t editpos; size_t insertpos; size_t buf_len = strlen(buf); for (editpos = insertpos = 0; *(buf + editpos) != '\0'; editpos++, insertpos++) { if (*(buf + editpos) == '\\' ) { switch (*(buf + editpos + 1)) { case 'n': // "\n": unescape as real '\n' control character *(buf + insertpos) = '\n'; editpos++; break; case 't': // "\t": unescape as real '\t' control character *(buf + insertpos) = '\t'; editpos++; break; case 'r': // "\r": unescape as real '\r' control character *(buf + insertpos) = '\r'; editpos++; break; case ' ': // "\ ": unescape as space character ' ' *(buf + insertpos) = ' '; editpos++; break; case '\\': // "\\": unescape as single '\' character *(buf + insertpos) = '\\'; editpos++; break; case '0': // "\0" beginning, lookup the next character if (editpos + 4 >= buf_len) { // We expect "\0xYY" sequence - if the string is short, terminate it and return NULL *(buf + insertpos) = '\0'; return NULL; } if (*(buf + editpos + 2) == 'x') { // "\0x" beginning, lookup next two characters if ((*(buf + editpos + 3) == '0' && *(buf + editpos + 4) == '0')) { // "\0x00" // Don't swap \0x00 with 0 to avoid truncating the string. // Currently the only place where we support sending of 0 bytes // is in check_generic(). The \0x00 -> 0 byte swap is performed // there and in-place. *(buf + insertpos) = *(buf + editpos); } else { // "\0x??" (where "??" are two generic characters): unescape the "\0x??" hex code into real character code *(buf + insertpos) = _x2c(&buf[editpos + 3]); editpos += 4; } } break; default: // the '\' is followed by non-escape sequence character or NUL, no need to unescape, copy the initial '\' as is *(buf + insertpos) = *(buf + editpos); } } else { // other character, no need to unescape, copy as is *(buf + insertpos) = *(buf + editpos); } } // Terminate the string *(buf + insertpos) = '\0'; return buf; } int Util_handle0Escapes(char *buf) { int editpos; int insertpos; assert(buf); for (editpos = insertpos = 0; *(buf + editpos) != '\0'; editpos++, insertpos++) { if (*(buf + editpos) == '\\' ) { switch (*(buf + editpos + 1)) { case '0': if (*(buf + editpos + 2) == 'x') { *(buf + insertpos) = _x2c(&buf[editpos+3]); editpos += 4; } break; default: *(buf + insertpos) = *(buf + editpos); } } else { *(buf + insertpos) = *(buf + editpos); } } *(buf + insertpos) = '\0'; return insertpos; } Service_T Util_getService(const char *name) { assert(name); for (Service_T s = Service_List; s; s = s->next) if (IS(s->name, name)) return s; return NULL; } int Util_getNumberOfServices(void) { int i = 0; Service_T s; for (s = Service_List; s; s = s->next) i += 1; return i; } bool Util_existService(const char *name) { assert(name); return Util_getService(name) ? true : false; } void Util_printRunList(void) { char buf[10]; printf("Runtime constants:\n"); printf(" %-18s = %s\n", "Control file", is_str_defined(Run.files.control)); printf(" %-18s = %s\n", "Log file", is_str_defined(Run.files.log)); printf(" %-18s = %s\n", "Pid file", is_str_defined(Run.files.pid)); printf(" %-18s = %s\n", "Id file", is_str_defined(Run.files.id)); printf(" %-18s = %s\n", "State file", is_str_defined(Run.files.state)); printf(" %-18s = %s\n", "Debug", Run.debug ? "True" : "False"); printf(" %-18s = %s\n", "Log", (Run.flags & Run_Log) ? "True" : "False"); printf(" %-18s = %s\n", "Use syslog", (Run.flags & Run_UseSyslog) ? "True" : "False"); printf(" %-18s = %s\n", "Is Daemon", (Run.flags & Run_Daemon) ? "True" : "False"); printf(" %-18s = %s\n", "Use process engine", (Run.flags & Run_ProcessEngineEnabled) ? "True" : "False"); printf(" %-18s = {\n", "Limits"); printf(" %-18s = programOutput: %s\n", " ", Fmt_bytes2str(Run.limits.programOutput, buf)); printf(" %-18s = sendExpectBuffer: %s\n", " ", Fmt_bytes2str(Run.limits.sendExpectBuffer, buf)); printf(" %-18s = fileContentBuffer: %s\n", " ", Fmt_bytes2str(Run.limits.fileContentBuffer, buf)); printf(" %-18s = httpContentBuffer: %s\n", " ", Fmt_bytes2str(Run.limits.httpContentBuffer, buf)); printf(" %-18s = networkTimeout: %s\n", " ", Fmt_time2str(Run.limits.networkTimeout, (char[11]){})); printf(" %-18s = programTimeout: %s\n", " ", Fmt_time2str(Run.limits.programTimeout, (char[11]){})); printf(" %-18s = stopTimeout: %s\n", " ", Fmt_time2str(Run.limits.stopTimeout, (char[11]){})); printf(" %-18s = startTimeout: %s\n", " ", Fmt_time2str(Run.limits.startTimeout, (char[11]){})); printf(" %-18s = restartTimeout: %s\n", " ", Fmt_time2str(Run.limits.restartTimeout, (char[11]){})); printf(" %-18s = execTimeout: %s\n", " ", Fmt_time2str(Run.limits.execTimeout, (char[11]){})); printf(" %-18s = }\n", " "); printf(" %-18s = %s\n", "On reboot", onReboot_Names[Run.onreboot]); printf(" %-18s = %d seconds with start delay %d seconds\n", "Poll time", Run.polltime, Run.startdelay); if (Run.eventlist_dir) { char slots[STRLEN]; if (Run.eventlist_slots < 0) snprintf(slots, STRLEN, "unlimited"); else snprintf(slots, STRLEN, "%d", Run.eventlist_slots); printf(" %-18s = base directory %s with %s slots\n", "Event queue", Run.eventlist_dir, slots); } #ifdef HAVE_OPENSSL { const char *options = Ssl_printOptions(&(Run.ssl), (char[STRLEN]){}, STRLEN); if (options && *options) printf(" %-18s = %s\n", "SSL options", options); } #endif if (Run.mmonits) { Mmonit_T c; printf(" %-18s = ", "M/Monit(s)"); for (c = Run.mmonits; c; c = c->next) { printf("%s\n", c->url->url); printf(" = with timeout %s\n", Fmt_time2str(c->timeout, (char[11]){})); #ifdef HAVE_OPENSSL if (c->ssl.flags) { printf(" = using TLS"); const char *options = Ssl_printOptions(&c->ssl, (char[STRLEN]){}, STRLEN); if (options && *options) printf(" with options {%s}", options); if (c->ssl.checksum) printf(" and certificate checksum %s equal to '%s'", Checksum_Names[c->ssl.checksumType], c->ssl.checksum); printf("\n"); } #endif if (Run.flags & Run_MmonitCredentials && c->url->user) printf(" = with credentials\n"); if (c->hostgroups) { int hostgroups = 0; printf(" = with hostgroups ["); for (_list_t g = c->hostgroups->head; g; g = g->next) { printf("%s\"%s\"", hostgroups++ ? ", " : "", (const char *)g->e); } printf("]\n"); } if (c->next) printf(" = "); } } if (Run.mailservers) { MailServer_T mta; printf(" %-18s = ", "Mail server(s)"); for (mta = Run.mailservers; mta; mta = mta->next) { printf("%s:%d", mta->host, mta->port); #ifdef HAVE_OPENSSL if (mta->ssl.flags) { printf(" using TLS"); const char *options = Ssl_printOptions(&mta->ssl, (char[STRLEN]){}, STRLEN); if (options && *options) printf(" with options {%s}", options); if (mta->ssl.checksum) printf(" and certificate checksum %s equal to '%s'", Checksum_Names[mta->ssl.checksumType], mta->ssl.checksum); } #endif if (mta->next) printf(", "); } printf(" with timeout %s", Fmt_time2str(Run.mailserver_timeout, (char[11]){})); if (Run.mail_hostname) printf(" using '%s' as my hostname", Run.mail_hostname); printf("\n"); } if (Run.MailFormat.from) { if (Run.MailFormat.from->name) printf(" %-18s = %s <%s>\n", "Mail from", Run.MailFormat.from->name, Run.MailFormat.from->address); else printf(" %-18s = %s\n", "Mail from", Run.MailFormat.from->address); } if (Run.MailFormat.replyto) { if (Run.MailFormat.replyto->name) printf(" %-18s = %s <%s>\n", "Mail reply to", Run.MailFormat.replyto->name, Run.MailFormat.replyto->address); else printf(" %-18s = %s\n", "Mail reply to", Run.MailFormat.replyto->address); } if (Run.MailFormat.subject) printf(" %-18s = %s\n", "Mail subject", Run.MailFormat.subject); if (Run.MailFormat.message) printf(" %-18s = %-.20s..(truncated)\n", "Mail message", Run.MailFormat.message); printf(" %-18s = %s\n", "Start monit httpd", (Run.httpd.flags & Httpd_Net || Run.httpd.flags & Httpd_Unix) ? "True" : "False"); if (Run.httpd.flags & Httpd_Net || Run.httpd.flags & Httpd_Unix) { if (Run.httpd.flags & Httpd_Net) { printf(" %-18s = %s\n", "httpd bind address", Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "Any/All"); printf(" %-18s = %d\n", "httpd portnumber", Run.httpd.socket.net.port); printf(" %-18s = %s\n", "httpd net readonly", Run.httpd.socket.net.readonly ? "Enabled" : "Disabled"); #ifdef HAVE_OPENSSL const char *options = Ssl_printOptions(&(Run.httpd.socket.net.ssl), (char[STRLEN]){}, STRLEN); if (options && *options) printf(" %-18s = %s\n", "httpd encryption", options); #endif } if (Run.httpd.flags & Httpd_Unix) { printf(" %-18s = %s\n", "httpd unix socket", Run.httpd.socket.unix.path); printf(" %-18s = %s\n", "httpd unix readonly", Run.httpd.socket.unix.readonly ? "Enabled" : "Disabled"); } printf(" %-18s = %s\n", "httpd signature", Run.httpd.flags & Httpd_Signature ? "Enabled" : "Disabled"); printf(" %-18s = %s\n", "httpd auth. style", Run.httpd.credentials && Engine_hasAllow() ? "Basic Authentication and Host/Net allow list" : Run.httpd.credentials ? "Basic Authentication" : Engine_hasAllow() ? "Host/Net allow list" : "No authentication!"); } { for (Mail_T list = Run.maillist; list; list = list->next) { printf(" %-18s = %s\n", "Alert mail to", is_str_defined(list->to)); printf(" %-16s = ", "Alert on"); printevents(list->events); if (list->reminder) printf(" %-16s = %u cycles\n", "Alert reminder", list->reminder); } } printf("\n"); } void Util_printService(Service_T s) { assert(s); bool sgheader = false; char buffer[STRLEN]; StringBuffer_T buf = StringBuffer_create(STRLEN); printf("%-21s = %s\n", StringBuffer_toString(StringBuffer_append(buf, "%s Name", Servicetype_Names[s->type])), s->name); for (ServiceGroup_T o = Service_Group_List; o; o = o->next) { for (_list_t m = o->members->head; m; m = m->next) { if (m->e == s) { if (! sgheader) { printf(" %-20s = %s", "Group", o->name); sgheader = true; } else { printf(", %s", o->name); } } } } if (sgheader) printf("\n"); if (s->type == Service_Process) { if (s->matchlist) printf(" %-20s = %s\n", "Match", s->path); else printf(" %-20s = %s\n", "Pid file", s->path); } else if (s->type == Service_Host) { printf(" %-20s = %s\n", "Address", s->path); } else if (s->type == Service_Net) { printf(" %-20s = %s\n", "Interface", s->path); } else if (s->type != Service_System) { printf(" %-20s = %s\n", "Path", s->path); } printf(" %-20s = %s\n", "Monitoring mode", Mode_Names[s->mode]); printf(" %-20s = %s\n", "On reboot", onReboot_Names[s->onreboot]); if (s->start) { printf(" %-20s = '%s'", "Start program", Util_commandDescription(s->start, (char[STRLEN]){})); if (s->start->has_uid) printf(" as uid %d", s->start->uid); if (s->start->has_gid) printf(" as gid %d", s->start->gid); printf(" timeout %s", Fmt_time2str(s->start->timeout, (char[11]){})); printf("\n"); } if (s->stop) { printf(" %-20s = '%s'", "Stop program", Util_commandDescription(s->stop, (char[STRLEN]){})); if (s->stop->has_uid) printf(" as uid %d", s->stop->uid); if (s->stop->has_gid) printf(" as gid %d", s->stop->gid); printf(" timeout %s", Fmt_time2str(s->stop->timeout, (char[11]){})); printf("\n"); } if (s->restart) { printf(" %-20s = '%s'", "Restart program", Util_commandDescription(s->restart, (char[STRLEN]){})); if (s->restart->has_uid) printf(" as uid %d", s->restart->uid); if (s->restart->has_gid) printf(" as gid %d", s->restart->gid); printf(" timeout %s", Fmt_time2str(s->restart->timeout, (char[11]){})); printf("\n"); } for (NonExist_T o = s->nonexistlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Existence", StringBuffer_toString(Util_printRule(false, buf, o->action, "if does not exist"))); } for (Exist_T o = s->existlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Non-Existence", StringBuffer_toString(Util_printRule(false, buf, o->action, "if exist"))); } for (Dependant_T o = s->dependantlist; o; o = o->next) if (o->dependant != NULL) printf(" %-20s = %s\n", "Depends on Service", o->dependant); for (Pid_T o = s->pidlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Pid", StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed"))); } for (Pid_T o = s->ppidlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "PPid", StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed"))); } for (FsFlag_T o = s->fsflaglist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Filesystem flags", StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed"))); } if (s->type == Service_Program) { printf(" %-20s = ", "Program timeout"); printf("terminate the program if not finished within %s\n", Fmt_time2str(s->program->timeout, (char[11]){})); for (Status_T o = s->statuslist; o; o = o->next) { StringBuffer_clear(buf); if (o->operator == Operator_Changed) printf(" %-20s = %s\n", "Status", StringBuffer_toString(Util_printRule(false, buf, o->action, "if exit value changed"))); else printf(" %-20s = %s\n", "Status", StringBuffer_toString(Util_printRule(false, buf, o->action, "if exit value %s %d", OperatorShort_Names[o->operator], o->return_value))); } } if (s->checksum && s->checksum->action) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Checksum", s->checksum->test_changes ? StringBuffer_toString(Util_printRule(false, buf, s->checksum->action, "if changed %s", Checksum_Names[s->checksum->type])) : StringBuffer_toString(Util_printRule(false, buf, s->checksum->action, "if failed %s(%s)", s->checksum->hash, Checksum_Names[s->checksum->type])) ); } if (s->perm && s->perm->action) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Permission", s->perm->test_changes ? StringBuffer_toString(Util_printRule(false, buf, s->perm->action, "if changed")) : StringBuffer_toString(Util_printRule(false, buf, s->perm->action, "if failed %04o", s->perm->perm)) ); } if (s->uid && s->uid->action) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "UID", StringBuffer_toString(Util_printRule(false, buf, s->uid->action, "if failed %d", s->uid->uid))); } if (s->euid && s->euid->action) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "EUID", StringBuffer_toString(Util_printRule(false, buf, s->euid->action, "if failed %d", s->euid->uid))); } for (SecurityAttribute_T o = s->secattrlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Security attribute", StringBuffer_toString(Util_printRule(false, buf, o->action, "if failed %s", o->attribute))); } for (Filedescriptors_T o = s->filedescriptorslist; o; o = o->next) { StringBuffer_clear(buf); if (o->total) { printf(" %-20s = %s\n", "Total filedescriptors", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld", Operator_Names[o->operator], o->limit_absolute))); } else { if (o->limit_absolute > -1) printf(" %-20s = %s\n", "Filedescriptors", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld", Operator_Names[o->operator], o->limit_absolute))); else printf(" %-20s = %s\n", "Filedescriptors", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit_percent))); } } if (s->gid && s->gid->action) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "GID", StringBuffer_toString(Util_printRule(false, buf, s->gid->action, "if failed %d", s->gid->gid))); } for (Icmp_T o = s->icmplist; o; o = o->next) { StringBuffer_clear(buf); StringBuffer_T buf2 = StringBuffer_create(64); StringBuffer_append(buf2, "if %s count %d size %d with timeout %s", o->check_invers ? "succeeded" : "failed", o->count, o->size, Fmt_time2str(o->timeout, (char[11]){})); if (o->responsetime.limit > -1.) StringBuffer_append(buf2, " and responsetime %s %s", Operator_Names[o->responsetime.operator], Fmt_time2str(o->responsetime.limit, (char[11]){})); if (o->outgoing.ip) StringBuffer_append(buf2, " via address %s", o->outgoing.ip); switch (o->family) { case Socket_Ip4: printf(" %-20s = %s\n", "Ping4", StringBuffer_toString(Util_printRule(o->check_invers, buf, o->action, "%s", StringBuffer_toString(buf2)))); break; case Socket_Ip6: printf(" %-20s = %s\n", "Ping6", StringBuffer_toString(Util_printRule(o->check_invers, buf, o->action, "%s", StringBuffer_toString(buf2)))); break; default: printf(" %-20s = %s\n", "Ping", StringBuffer_toString(Util_printRule(o->check_invers, buf, o->action, "%s", StringBuffer_toString(buf2)))); break; } StringBuffer_free(&buf2); } for (Port_T o = s->portlist; o; o = o->next) { StringBuffer_clear(buf); StringBuffer_T buf2 = StringBuffer_create(64); StringBuffer_append(buf2, "if %s [%s]:%d%s", o->check_invers ? "succeeded" : "failed", o->hostname, o->target.net.port, Util_portRequestDescription(o)); if (o->outgoing.ip) StringBuffer_append(buf2, " via address %s", o->outgoing.ip); StringBuffer_append(buf2, " type %s/%s protocol %s with timeout %s", Util_portTypeDescription(o), Util_portIpDescription(o), o->protocol->name, Fmt_time2str(o->timeout, (char[11]){})); if (o->retry > 1) StringBuffer_append(buf2, " and retry %d times", o->retry); if (o->responsetime.limit > -1.) StringBuffer_append(buf2, " and responsetime %s %s", Operator_Names[o->responsetime.operator], Fmt_time2str(o->responsetime.limit, (char[11]){})); #ifdef HAVE_OPENSSL if (o->target.net.ssl.options.flags) { StringBuffer_append(buf2, " using TLS"); const char *options = Ssl_printOptions(&o->target.net.ssl.options, (char[STRLEN]){}, STRLEN); if (options && *options) StringBuffer_append(buf2, " with options {%s}", options); if (o->target.net.ssl.certificate.minimumDays > 0) StringBuffer_append(buf2, " and certificate valid for at least %d days", o->target.net.ssl.certificate.minimumDays); if (o->target.net.ssl.options.checksum) StringBuffer_append(buf2, " and certificate checksum %s equal to '%s'", Checksum_Names[o->target.net.ssl.options.checksumType], o->target.net.ssl.options.checksum); } #endif printf(" %-20s = %s\n", "Port", StringBuffer_toString(Util_printRule(o->check_invers, buf, o->action, "%s", StringBuffer_toString(buf2)))); StringBuffer_free(&buf2); } for (Port_T o = s->socketlist; o; o = o->next) { StringBuffer_clear(buf); StringBuffer_T buf2 = StringBuffer_create(64); StringBuffer_append(buf2, "if %s %s type %s protocol %s with timeout %s", o->check_invers ? "succeeded" : "failed", o->target.unix.pathname, Util_portTypeDescription(o), o->protocol->name, Fmt_time2str(o->timeout, (char[11]){})); if (o->retry > 1) StringBuffer_append(buf2, " and retry %d times", o->retry); if (o->responsetime.limit > -1.) StringBuffer_append(buf2, " and responsetime %s %s", Operator_Names[o->responsetime.operator], Fmt_time2str(o->responsetime.limit, (char[11]){})); printf(" %-20s = %s\n", "Unix Socket", StringBuffer_toString(Util_printRule(o->check_invers, buf, o->action, "%s", StringBuffer_toString(buf2)))); StringBuffer_free(&buf2); } for (Timestamp_T o = s->timestamplist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", Timestamp_Names[o->type], o->test_changes ? StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed")) : StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s", Operator_Names[o->operator], Fmt_time2str(o->time * 1000., (char[11]){}))) ); } for (Size_T o = s->sizelist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Size", o->test_changes ? StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed")) : StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %llu byte(s)", Operator_Names[o->operator], o->size)) ); } for (NLink_T o = s->nlinklist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Hardlink", o->test_changes ? StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed")) : StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %llu", Operator_Names[o->operator], o->nlink)) ); } for (LinkStatus_T o = s->linkstatuslist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Link status", StringBuffer_toString(Util_printRule(o->check_invers, buf, o->action, "if %s", o->check_invers ? "up" : "down"))); } for (LinkSpeed_T o = s->linkspeedlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Link capacity", StringBuffer_toString(Util_printRule(false, buf, o->action, "if changed"))); } for (LinkSaturation_T o = s->linksaturationlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Link utilization", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit))); } for (Bandwidth_T o = s->uploadbyteslist; o; o = o->next) { StringBuffer_clear(buf); if (o->range == Time_Second) { printf(" %-20s = %s\n", "Upload bytes", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s/s", Operator_Names[o->operator], Fmt_bytes2str(o->limit, buffer)))); } else { printf(" %-20s = %s\n", "Total upload bytes", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s in last %d %s(s)", Operator_Names[o->operator], Fmt_bytes2str(o->limit, buffer), o->rangecount, Util_timestr(o->range)))); } } for (Bandwidth_T o = s->uploadpacketslist; o; o = o->next) { StringBuffer_clear(buf); if (o->range == Time_Second) { printf(" %-20s = %s\n", "Upload packets", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld packets/s", Operator_Names[o->operator], o->limit))); } else { printf(" %-20s = %s\n", "Total upload packets", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld packets in last %d %s(s)", Operator_Names[o->operator], o->limit, o->rangecount, Util_timestr(o->range)))); } } for (Bandwidth_T o = s->downloadbyteslist; o; o = o->next) { StringBuffer_clear(buf); if (o->range == Time_Second) { printf(" %-20s = %s\n", "Download bytes", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s/s", Operator_Names[o->operator], Fmt_bytes2str(o->limit, buffer)))); } else { printf(" %-20s = %s\n", "Total download bytes", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s in last %d %s(s)", Operator_Names[o->operator], Fmt_bytes2str(o->limit, buffer), o->rangecount, Util_timestr(o->range)))); } } for (Bandwidth_T o = s->downloadpacketslist; o; o = o->next) { StringBuffer_clear(buf); if (o->range == Time_Second) { printf(" %-20s = %s\n", "Download packets", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld packets/s", Operator_Names[o->operator], o->limit))); } else { printf(" %-20s = %s\n", "Total downl. packets", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld packets in last %d %s(s)", Operator_Names[o->operator], o->limit, o->rangecount, Util_timestr(o->range)))); } } for (Uptime_T o = s->uptimelist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Uptime", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %llu second(s)", Operator_Names[o->operator], o->uptime))); } if (s->type != Service_Process) { for (Match_T o = s->matchignorelist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Ignore content", StringBuffer_toString(Util_printRule(false, buf, o->action, "if content %s \"%s\"", o->not ? "!=" : "=", o->match_string))); } for (Match_T o = s->matchlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Content", StringBuffer_toString(Util_printRule(false, buf, o->action, "if content %s \"%s\"", o->not ? "!=" : "=", o->match_string))); } for (OutputChange_T oc = s->outputchangelist; oc; oc = oc->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Content change", StringBuffer_toString(Util_printRule(false, buf, oc->action, "if content %schanged", oc->check_invers ? "not " : ""))); } } for (FileSystem_T o = s->filesystemlist; o; o = o->next) { StringBuffer_clear(buf); if (o->resource == Resource_Inode) { printf(" %-20s = %s\n", "Inodes usage limit", o->limit_absolute > -1 ? StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld", Operator_Names[o->operator], o->limit_absolute)) : StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit_percent)) ); } else if (o->resource == Resource_InodeFree) { printf(" %-20s = %s\n", "Inodes free limit", o->limit_absolute > -1 ? StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %lld", Operator_Names[o->operator], o->limit_absolute)) : StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit_percent)) ); } else if (o->resource == Resource_Space) { if (o->limit_absolute > -1) { printf(" %-20s = %s\n", "Space usage limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s", Operator_Names[o->operator], Fmt_bytes2str(o->limit_absolute, buffer)))); } else { printf(" %-20s = %s\n", "Space usage limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit_percent))); } } else if (o->resource == Resource_SpaceFree) { if (o->limit_absolute > -1) { printf(" %-20s = %s\n", "Space free limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s", Operator_Names[o->operator], Fmt_bytes2str(o->limit_absolute, buffer)))); } else { printf(" %-20s = %s\n", "Space free limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit_percent))); } } else if (o->resource == Resource_ReadBytes) { printf(" %-20s = %s\n", "Read limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if read %s %s/s", Operator_Names[o->operator], Fmt_bytes2str(o->limit_absolute, (char[10]){})))); } else if (o->resource == Resource_ReadOperations) { printf(" %-20s = %s\n", "Read limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if read %s %llu operations/s", Operator_Names[o->operator], o->limit_absolute))); } else if (o->resource == Resource_WriteBytes) { printf(" %-20s = %s\n", "Write limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if write %s %s/s", Operator_Names[o->operator], Fmt_bytes2str(o->limit_absolute, (char[10]){})))); } else if (o->resource == Resource_WriteOperations) { printf(" %-20s = %s\n", "Write limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if write %s %llu operations/s", Operator_Names[o->operator], o->limit_absolute))); } else if (o->resource == Resource_ServiceTime) { printf(" %-20s = %s\n", "Service time limit", StringBuffer_toString(Util_printRule(false, buf, o->action, "if service time %s %s/operation", Operator_Names[o->operator], Fmt_time2str(o->limit_absolute, (char[11]){})))); } } for (Resource_T o = s->resourcelist; o; o = o->next) { StringBuffer_clear(buf); switch (o->resource_id) { case Resource_CpuPercent: printf(" %-20s = ", "CPU usage limit"); break; case Resource_CpuPercentTotal: printf(" %-20s = ", "CPU usage limit (incl. children)"); break; case Resource_CpuUser: printf(" %-20s = ", "CPU user limit"); break; case Resource_CpuSystem: printf(" %-20s = ", "CPU system limit"); break; case Resource_CpuWait: printf(" %-20s = ", "CPU I/O wait limit"); break; case Resource_CpuNice: printf(" %-20s = ", "CPU nice limit"); break; case Resource_CpuHardIRQ: printf(" %-20s = ", "CPU hardware IRQ limit"); break; case Resource_CpuSoftIRQ: printf(" %-20s = ", "CPU software IRQ limit"); break; case Resource_CpuSteal: printf(" %-20s = ", "CPU steal limit"); break; case Resource_CpuGuest: printf(" %-20s = ", "CPU guest limit"); break; case Resource_CpuGuestNice: printf(" %-20s = ", "CPU guest nice limit"); break; case Resource_MemoryPercent: printf(" %-20s = ", "Memory usage limit"); break; case Resource_MemoryKbyte: printf(" %-20s = ", "Memory amount limit"); break; case Resource_SwapPercent: printf(" %-20s = ", "Swap usage limit"); break; case Resource_SwapKbyte: printf(" %-20s = ", "Swap amount limit"); break; case Resource_LoadAverage1m: printf(" %-20s = ", "Load avg (1m)"); break; case Resource_LoadAverage5m: printf(" %-20s = ", "Load avg (5m)"); break; case Resource_LoadAverage15m: printf(" %-20s = ", "Load avg (15m)"); break; case Resource_LoadAveragePerCore1m: printf(" %-20s = ", "Load avg/core (1m)"); break; case Resource_LoadAveragePerCore5m: printf(" %-20s = ", "Load avg/core (5m)"); break; case Resource_LoadAveragePerCore15m: printf(" %-20s = ", "Load avg/core (15m)"); break; case Resource_Threads: printf(" %-20s = ", "Threads"); break; case Resource_Children: printf(" %-20s = ", "Children"); break; case Resource_MemoryKbyteTotal: printf(" %-20s = ", "Memory amount limit (incl. children)"); break; case Resource_MemoryPercentTotal: printf(" %-20s = ", "Memory usage limit (incl. children)"); break; case Resource_ReadBytes: printf(" %-20s = ", "Read limit"); break; case Resource_ReadBytesPhysical: printf(" %-20s = ", "Disk read limit"); break; case Resource_ReadOperations: printf(" %-20s = ", "Disk read limit"); break; case Resource_WriteBytes: printf(" %-20s = ", "Write limit"); break; case Resource_WriteBytesPhysical: printf(" %-20s = ", "Disk write limit"); break; case Resource_WriteOperations: printf(" %-20s = ", "Disk write limit"); break; default: break; } switch (o->resource_id) { case Resource_CpuPercent: case Resource_CpuPercentTotal: case Resource_MemoryPercentTotal: case Resource_CpuUser: case Resource_CpuSystem: case Resource_CpuWait: case Resource_CpuNice: case Resource_CpuHardIRQ: case Resource_CpuSoftIRQ: case Resource_CpuSteal: case Resource_CpuGuest: case Resource_CpuGuestNice: case Resource_MemoryPercent: case Resource_SwapPercent: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f%%", Operator_Names[o->operator], o->limit))); break; case Resource_MemoryKbyte: case Resource_SwapKbyte: case Resource_MemoryKbyteTotal: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s", Operator_Names[o->operator], Fmt_bytes2str(o->limit, buffer)))); break; case Resource_LoadAverage1m: case Resource_LoadAverage5m: case Resource_LoadAverage15m: case Resource_LoadAveragePerCore1m: case Resource_LoadAveragePerCore5m: case Resource_LoadAveragePerCore15m: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.1f", Operator_Names[o->operator], o->limit))); break; case Resource_Threads: case Resource_Children: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.0f", Operator_Names[o->operator], o->limit))); break; case Resource_ReadBytes: case Resource_WriteBytes: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s/s", Operator_Names[o->operator], Fmt_bytes2str(o->limit, (char[10]){})))); break; case Resource_ReadBytesPhysical: case Resource_WriteBytesPhysical: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %s/s", Operator_Names[o->operator], Fmt_bytes2str(o->limit, (char[10]){})))); break; case Resource_ReadOperations: case Resource_WriteOperations: printf("%s", StringBuffer_toString(Util_printRule(false, buf, o->action, "if %s %.0f operations/s", Operator_Names[o->operator], o->limit))); break; default: break; } printf("\n"); } if (s->every.type == Every_SkipCycles) printf(" %-20s = Check service every %d cycles\n", "Every", s->every.spec.cycle.number); else if (s->every.type == Every_Cron) printf(" %-20s = Check service every %s\n", "Every", s->every.spec.cron); else if (s->every.type == Every_NotInCron) printf(" %-20s = Don't check service every %s\n", "Every", s->every.spec.cron); for (ActionRate_T o = s->actionratelist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = If restarted %d times within %d cycle(s) then %s\n", "Timeout", o->count, o->cycle, StringBuffer_toString(Util_printAction(o->action->failed, buf))); } for (Mail_T o = s->maillist; o; o = o->next) { printf(" %-20s = %s\n", "Alert mail to", is_str_defined(o->to)); printf(" %-18s = ", "Alert on"); printevents(o->events); if (o->reminder) printf(" %-18s = %u cycles\n", "Alert reminder", o->reminder); } printf("\n"); StringBuffer_free(&buf); } void Util_printServiceList(void) { Service_T s; char ruler[STRLEN]; printf("The service list contains the following entries:\n\n"); for (s = Service_List_Conf; s; s = s->next_conf) Util_printService(s); memset(ruler, '-', STRLEN); printf("%-.79s\n", ruler); } char *Util_getToken(MD_T token) { md5_context_t ctx; char buf[STRLEN] = {}; MD_T digest; Random_bytes(buf, sizeof(buf)); md5_init(&ctx); md5_append(&ctx, (const md5_byte_t *)buf, STRLEN - 1); md5_finish(&ctx, (md5_byte_t *)digest); Checksum_digest2Bytes((unsigned char *)digest, 16, token); return token; } char *Util_monitId(char *idfile) { assert(idfile); FILE *file = NULL; if (! File_exist(idfile)) { // Generate the unique id file = fopen(idfile, "w"); if (! file) { Log_error("Error opening the idfile '%s' -- %s\n", idfile, STRERROR); return NULL; } fprintf(file, "%s", Util_getToken(Run.id)); Log_info(" New Monit id: %s\n Stored in '%s'\n", Run.id, idfile); } else { if (! File_isFile(idfile)) { Log_error("idfile '%s' is not a regular file\n", idfile); return NULL; } if ((file = fopen(idfile,"r")) == (FILE *)NULL) { Log_error("Error opening the idfile '%s' -- %s\n", idfile, STRERROR); return NULL; } if (fscanf(file, "%64s", Run.id) != 1) { Log_error("Error reading id from file '%s'\n", idfile); if (fclose(file)) Log_error("Error closing file '%s' -- %s\n", idfile, STRERROR); return NULL; } } fflush(file); fsync(fileno(file)); if (fclose(file)) Log_error("Error closing file '%s' -- %s\n", idfile, STRERROR); return Run.id; } pid_t Util_getPid(char *pidfile) { assert(pidfile); pid_t pid = -1; FILE *file = NULL; if (! File_exist(pidfile)) { DEBUG("pidfile '%s' does not exist\n", pidfile); return -1; } if (! File_isFile(pidfile)) { DEBUG("pidfile '%s' is not a regular file\n", pidfile); return -1; } if ((file = fopen(pidfile,"r")) == (FILE *)NULL) { DEBUG("Error opening the pidfile '%s' -- %s\n", pidfile, STRERROR); return -1; } if (fscanf(file, "%d", &pid) != 1) { DEBUG("Error reading pid from file '%s'\n", pidfile); if (fclose(file)) DEBUG("Error closing file '%s' -- %s\n", pidfile, STRERROR); return -1; } if (fclose(file)) DEBUG("Error closing file '%s' -- %s\n", pidfile, STRERROR); return pid; } bool Util_isurlsafe(const char *url) { assert(url && *url); for (int i = 0; url[i]; i++) if (urlunsafe[(unsigned char)url[i]]) return false; return true; } char *Util_urlEncode(const char *string, bool isParameterValue) { char *escaped = NULL; if (STR_DEF(string)) { char *p; int i, n; const unsigned char *unsafe = isParameterValue ? urlunsafeparameter : urlunsafe; for (n = i = 0; string[i]; i++) if (unsafe[(unsigned char)(string[i])]) n += 2; p = escaped = CALLOC(1, i + n + 1); for (; *string; string++, p++) { if (unsafe[(unsigned char)(*p = *string)]) { *p++ = '%'; *p++ = b2x[(unsigned char)(*string)][0]; *p = b2x[(unsigned char)(*string)][1]; } } *p = 0; } return escaped; } char *Util_urlDecode(char *url) { if (url && *url) { register int x, y; for (x = 0, y = 0; url[y]; x++, y++) { if (url[y] == '+') { url[x] = ' '; } else if (url[y] == '%') { if (! url[y + 1] || ! url[y + 2]) break; url[x] = _x2c(url + y + 1); y += 2; } else { url[x] = url[y]; } } url[x] = 0; } return url; } char *Util_getBasicAuthHeader(char *username, char *password) { char *auth, *b64; char buf[STRLEN]; if (! username) return NULL; snprintf(buf, STRLEN, "%s:%s", username, password ? password : ""); if (! (b64 = encode_base64(strlen(buf), (unsigned char *)buf)) ) { Log_error("Failed to base64 encode authentication header\n"); return NULL; } auth = CALLOC(sizeof(char), STRLEN + 1); snprintf(auth, STRLEN, "Authorization: Basic %s\r\n", b64); FREE(b64); return auth; } void Util_redirectStdFds(void) { for (int i = 0; i < 3; i++) { if (close(i) == -1 || open("/dev/null", O_RDWR) != i) { Log_error("Cannot reopen standard file descriptor (%d) -- %s\n", i, STRERROR); } } } void Util_closeFds(void) { for (int i = 3, descriptors = System_descriptors(1024); i < descriptors; i++) { close(i); } errno = 0; } Auth_T Util_getUserCredentials(char *uname) { /* check allowed user names */ for (Auth_T c = Run.httpd.credentials; c; c = c->next) if (c->uname && IS(c->uname, uname)) return c; #ifdef HAVE_LIBPAM /* check allowed group names */ return(PAMcheckUserGroup(uname)); #else return NULL; #endif } bool Util_checkCredentials(char *uname, char *outside) { Auth_T c = Util_getUserCredentials(uname); char outside_crypt[STRLEN]; if (c == NULL) return false; switch (c->digesttype) { case Digest_Cleartext: outside_crypt[sizeof(outside_crypt) - 1] = 0; strncpy(outside_crypt, outside, sizeof(outside_crypt) - 1); break; case Digest_Md5: { char id[STRLEN]; char salt[STRLEN]; char *temp; /* A password looks like this, * $id$salt$digest * the '$' around the id are still part of the id. */ id[sizeof(id) - 1] = 0; strncpy(id, c->passwd, sizeof(id) - 1); if (! (temp = strchr(id + 1, '$'))) { Log_error("Password not in MD5 format.\n"); return false; } temp += 1; *temp = '\0'; salt[sizeof(salt) - 1] = 0; strncpy(salt, c->passwd + strlen(id), sizeof(salt) - 1); if (! (temp = strchr(salt, '$'))) { Log_error("Password not in MD5 format.\n"); return false; } *temp = '\0'; if (md5_crypt(outside, id, salt, outside_crypt, sizeof(outside_crypt)) == NULL) { Log_error("Cannot generate MD5 digest error.\n"); return false; } break; } case Digest_Crypt: { char salt[3]; char *temp; snprintf(salt, 3, "%c%c", c->passwd[0], c->passwd[1]); temp = crypt(outside, salt); outside_crypt[sizeof(outside_crypt) - 1] = 0; strncpy(outside_crypt, temp, sizeof(outside_crypt) - 1); break; } #ifdef HAVE_LIBPAM case Digest_Pam: return PAMcheckPasswd(uname, outside); break; #endif default: Log_error("Unknown password digestion method.\n"); return false; } return Str_authcmp(outside_crypt, c->passwd); } void Util_swapFilesystemFlags(FilesystemFlags_T flags) { char *temp = flags->previous; flags->previous = flags->current; flags->current = temp; *(flags->current) = 0; } static void _resetFilesystemFlags(FilesystemFlags_T flags) { flags->previous = flags->value[0]; flags->current = flags->value[1]; *(flags->current) = 0; *(flags->previous) = 0; } static void _resetIOStatistics(IOStatistics_T S) { Statistics_reset(&(S->operations)); Statistics_reset(&(S->bytes)); } void Util_resetInfo(Service_T s) { switch (s->type) { case Service_Filesystem: s->inf.filesystem->f_bsize = 0LL; s->inf.filesystem->f_blocks = 0LL; s->inf.filesystem->f_blocksfree = 0LL; s->inf.filesystem->f_blocksfreetotal = 0LL; s->inf.filesystem->f_blocksused = 0LL; s->inf.filesystem->f_files = 0LL; s->inf.filesystem->f_filesfree = 0LL; s->inf.filesystem->f_filesused = 0LL; s->inf.filesystem->inode_percent = 0.; s->inf.filesystem->space_percent = 0.; s->inf.filesystem->mode = -1; s->inf.filesystem->uid = -1; s->inf.filesystem->gid = -1; _resetFilesystemFlags(&(s->inf.filesystem->flags)); _resetIOStatistics(&(s->inf.filesystem->read)); _resetIOStatistics(&(s->inf.filesystem->write)); Statistics_reset(&(s->inf.filesystem->time.read)); Statistics_reset(&(s->inf.filesystem->time.write)); Statistics_reset(&(s->inf.filesystem->time.wait)); Statistics_reset(&(s->inf.filesystem->time.run)); break; case Service_File: s->inf.file->size = -1; s->inf.file->readpos = 0; s->inf.file->inode = 0; s->inf.file->inode_prev = 0; s->inf.file->mode = -1; s->inf.file->uid = -1; s->inf.file->gid = -1; s->inf.file->nlink = -1; s->inf.file->timestamp.access = 0; s->inf.file->timestamp.change = 0; s->inf.file->timestamp.modify = 0; *s->inf.file->cs_sum = 0; break; case Service_Directory: s->inf.directory->mode = -1; s->inf.directory->uid = -1; s->inf.directory->gid = -1; s->inf.directory->nlink = -1; s->inf.directory->timestamp.access = 0; s->inf.directory->timestamp.change = 0; s->inf.directory->timestamp.modify = 0; break; case Service_Fifo: s->inf.fifo->mode = -1; s->inf.fifo->uid = -1; s->inf.fifo->gid = -1; s->inf.fifo->nlink = -1; s->inf.fifo->timestamp.access = 0; s->inf.fifo->timestamp.change = 0; s->inf.fifo->timestamp.modify = 0; break; case Service_Process: s->inf.process->_pid = -1; s->inf.process->_ppid = -1; s->inf.process->pid = -1; s->inf.process->ppid = -1; s->inf.process->uid = -1; s->inf.process->euid = -1; s->inf.process->gid = -1; s->inf.process->zombie = false; s->inf.process->threads = -1; s->inf.process->children = -1; s->inf.process->mem = 0ULL; s->inf.process->total_mem = 0ULL; s->inf.process->mem_percent = -1.; s->inf.process->total_mem_percent = -1.; s->inf.process->cpu_percent = -1.; s->inf.process->total_cpu_percent = -1.; s->inf.process->uptime = -1; s->inf.process->filedescriptors.open = -1LL; s->inf.process->filedescriptors.openTotal = -1LL; *(s->inf.process->secattr) = 0; _resetIOStatistics(&(s->inf.process->read)); _resetIOStatistics(&(s->inf.process->write)); break; case Service_Net: if (s->inf.net->stats) Link_reset(s->inf.net->stats); break; default: break; } } bool Util_hasServiceStatus(Service_T s) { return((s->monitor & Monitor_Yes) && ! (s->error & Event_NonExist) && ! (s->error & Event_Data)); } char *Util_getHTTPHostHeader(Socket_T s, char *hostBuf, int len) { int port = Socket_getRemotePort(s); const char *host = Socket_getRemoteHost(s); bool ipv6 = Str_sub(host, ":") ? true : false; if (port == 80 || port == 443) snprintf(hostBuf, len, "%s%s%s", ipv6 ? "[" : "", host, ipv6 ? "]" : ""); else snprintf(hostBuf, len, "%s%s%s:%d", ipv6 ? "[" : "", host, ipv6 ? "]" : "", port); return hostBuf; } bool Util_evalQExpression(Operator_Type operator, long long left, long long right) { switch (operator) { case Operator_Greater: if (left > right) return true; break; case Operator_GreaterOrEqual: if (left >= right) return true; break; case Operator_Less: if (left < right) return true; break; case Operator_LessOrEqual: if (left <= right) return true; break; case Operator_Equal: if (left == right) return true; break; case Operator_NotEqual: case Operator_Changed: if (left != right) return true; break; default: Log_error("Unknown comparison operator\n"); return false; } return false; } bool Util_evalDoubleQExpression(Operator_Type operator, double left, double right) { switch (operator) { case Operator_Greater: if (left > right) return true; break; case Operator_GreaterOrEqual: if (left >= right) return true; break; case Operator_Less: if (left < right) return true; break; case Operator_LessOrEqual: if (left <= right) return true; break; case Operator_Equal: if (left == right) return true; break; case Operator_NotEqual: case Operator_Changed: if (left != right) return true; break; default: Log_error("Unknown comparison operator\n"); return false; } return false; } void Util_monitorSet(Service_T s) { assert(s); if (s->monitor == Monitor_Not) { s->monitor = Monitor_Init; DEBUG("'%s' monitoring enabled\n", s->name); State_dirty(); } } void Util_monitorUnset(Service_T s) { assert(s); if (s->monitor != Monitor_Not) { s->monitor = Monitor_Not; DEBUG("'%s' monitoring disabled\n", s->name); } s->nstart = 0; s->ncycle = 0; if (s->every.type == Every_SkipCycles) s->every.spec.cycle.counter = 0; s->error = Event_Null; if (s->eventlist) gc_event(&s->eventlist); Util_resetInfo(s); State_dirty(); } int Util_getAction(const char *action) { int i = 1; /* the Action_Ignored has index 0 => we will start on next item */ assert(action); while (strlen(Action_Names[i])) { if (IS(action, Action_Names[i])) return i; i++; } /* the action was not found */ return Action_Ignored; } StringBuffer_T Util_printAction(Action_T A, StringBuffer_T buf) { StringBuffer_append(buf, "%s", Action_Names[A->id]); if (A->id == Action_Exec) { command_t C = A->exec; for (int i = 0; C->arg[i]; i++) StringBuffer_append(buf, "%s%s", i ? " " : " '", C->arg[i]); StringBuffer_append(buf, "'"); if (C->has_uid) StringBuffer_append(buf, " as uid %d", C->uid); if (C->has_gid) StringBuffer_append(buf, " as gid %d", C->gid); if (C->timeout) StringBuffer_append(buf, " timeout %d cycle(s)", C->timeout); if (A->repeat) StringBuffer_append(buf, " repeat every %d cycle(s)", A->repeat); } return buf; } StringBuffer_T Util_printEventratio(Action_T action, StringBuffer_T buf) { if (action->cycles > 1) { if (action->count == action->cycles) StringBuffer_append(buf, "for %d cycles ", action->cycles); else StringBuffer_append(buf, "for %d times within %d cycles ", action->count, action->cycles); } return buf; } StringBuffer_T Util_printRule(bool inverse, StringBuffer_T buf, EventAction_T action, const char *rule, ...) { assert(buf); assert(action); assert(rule); // Variable part va_list ap; va_start(ap, rule); StringBuffer_vappend(buf, rule, ap); va_end(ap); // Constant part (failure action) StringBuffer_append(buf, " "); Util_printEventratio(action->failed, buf); StringBuffer_append(buf, "then "); Util_printAction(action->failed, buf); // Print the success part only if it's non default action (alert is implicit => skipped for simpler output) if (action->succeeded->id != Action_Ignored && action->succeeded->id != Action_Alert) { StringBuffer_append(buf, " else if "); StringBuffer_append(buf, inverse ? "failed " : "succeeded "); Util_printEventratio(action->succeeded, buf); StringBuffer_append(buf, "then "); Util_printAction(action->succeeded, buf); } return buf; } const char *Util_portIpDescription(Port_T p) { switch (p->family) { case Socket_Ip: return "IP"; case Socket_Ip4: return "IPv4"; case Socket_Ip6: return "IPv6"; default: return "UNKNOWN"; } } const char *Util_portTypeDescription(Port_T p) { switch (p->type) { case Socket_Tcp: return "TCP"; case Socket_Udp: return "UDP"; default: return "UNKNOWN"; } } const char *Util_portRequestDescription(Port_T p) { const char *request = ""; if (p->protocol->check == check_http && p->parameters.http.request) request = p->parameters.http.request; else if (p->protocol->check == check_websocket && p->parameters.websocket.request) request = p->parameters.websocket.request; return request; } char *Util_portDescription(Port_T p, char *buf, int bufsize) { if (p->family == Socket_Ip || p->family == Socket_Ip4 || p->family == Socket_Ip6) { snprintf(buf, bufsize, "[%s]:%d%s [%s/%s%s]", p->hostname, p->target.net.port, Util_portRequestDescription(p), Util_portTypeDescription(p), Util_portIpDescription(p), p->target.net.ssl.options.flags ? " TLS" : ""); } else if (p->family == Socket_Unix) { snprintf(buf, bufsize, "%s", p->target.unix.pathname); } else { *buf = 0; } return buf; } char *Util_commandDescription(command_t command, char s[STRLEN]) { assert(s); assert(command); int len = 0; for (int i = 0; command->arg[i] && len < STRLEN - 1; i++) { len += snprintf(s + len, STRLEN - len, "%s%s", i ? " " : "", command->arg[i]); } if (len >= STRLEN - 1) snprintf(s + STRLEN - 3 - 1, 4, "..."); return s; } const char *Util_timestr(int time) { int i = 0; struct mytimetable { int id; const char *description; } tt[]= { {Time_Second, "second"}, {Time_Minute, "minute"}, {Time_Hour, "hour"}, {Time_Day, "day"}, {Time_Month, "month"}, {0} }; do { if (time == tt[i].id) return tt[i].description; } while (tt[++i].description); return NULL; } monit-5.35.2/src/alert.c0000644000016400001720000003147615007061157011727 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #include "monit.h" #include "event.h" #include "alert.h" #include "SMTP.h" // libmonit #include "util/Str.h" #include "system/Time.h" #include "system/Random.h" #include "exceptions/IOException.h" /** * Implementation of the alert module * * @file */ /* ----------------------------------------------------------------- Private */ // If the host is not set already (cached), translate system hostname to FQDN or fallback to plain system hostname if failed static char *_getFQDNhostname(char host[256]) { assert(host); if (STR_UNDEF(host)) { struct addrinfo *result = NULL, hints = { .ai_family = AF_UNSPEC, .ai_flags = AI_CANONNAME, .ai_socktype = SOCK_STREAM }; int status = getaddrinfo(Run.system->name, NULL, &hints, &result); if (status == 0) { for (struct addrinfo *r = result; r; r = r->ai_next) { if (Str_startsWith(r->ai_canonname, Run.system->name)) { strncpy(host, r->ai_canonname, 255); break; } } freeaddrinfo(result); } else { Log_warning("Cannot translate '%s' to FQDN name, please set a sender address using 'set mail-format' -- %s\n", Run.system->name, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); } if (STR_UNDEF(host)) { // Fallback strncpy(host, Run.system->name, 255); } } return host; } static void _substitute(Mail_T m, Event_T e) { assert(m); assert(e); if (Str_sub(m->from->name, "$HOST")) Util_replaceString(&m->from->name, "$HOST", _getFQDNhostname(m->host)); if (Str_sub(m->from->address, "$HOST")) Util_replaceString(&m->from->address, "$HOST", _getFQDNhostname(m->host)); Util_replaceString(&m->subject, "$HOST", Run.system->name); Util_replaceString(&m->message, "$HOST", Run.system->name); char timestamp[26]; Time_localStr(e->collected.tv_sec, timestamp); Util_replaceString(&m->subject, "$DATE", timestamp); Util_replaceString(&m->message, "$DATE", timestamp); Util_replaceString(&m->subject, "$SERVICE", e->source->name); Util_replaceString(&m->message, "$SERVICE", e->source->name); const char *description = Event_get_description(e); Util_replaceString(&m->subject, "$EVENT", description); Util_replaceString(&m->message, "$EVENT", description); const char *message = NVLSTR(e->message); Util_replaceString(&m->subject, "$DESCRIPTION", message); Util_replaceString(&m->message, "$DESCRIPTION", message); const char *action = Event_get_action_description(e); Util_replaceString(&m->subject, "$ACTION", action); Util_replaceString(&m->message, "$ACTION", action); } static void _escape(Mail_T m) { // replace bare linefeed Util_replaceString(&m->message, "\r\n", "\n"); Util_replaceString(&m->message, "\n", "\r\n"); // escape ^. Util_replaceString(&m->message, "\n.", "\n.."); // drop any CR|LF from the subject Str_chomp(m->subject); } static void _copyMail(Mail_T n, Mail_T o) { assert(n); assert(o); n->to = Str_dup(o->to); if (o->from) { n->from = Address_copy(o->from); } else if (Run.MailFormat.from) { n->from = Address_copy(Run.MailFormat.from); } else { n->from = Address_new(); n->from->address = Str_dup(ALERT_FROM); } n->replyto = o->replyto ? Address_copy(o->replyto) : Run.MailFormat.replyto ? Address_copy(Run.MailFormat.replyto) : NULL; n->subject = o->subject ? Str_dup(o->subject) : Run.MailFormat.subject ? Str_dup(Run.MailFormat.subject) : Str_dup(ALERT_SUBJECT); n->message = o->message ? Str_dup(o->message) : Run.MailFormat.message ? Str_dup(Run.MailFormat.message) : Str_dup(ALERT_MESSAGE); } // Append the alert to a notification list IFF: // 1) is the given event type allowed for this recipient? // 2a) state change notifications is always delivered // 2b) failure notification is sent only of it matches reminder settings static void _appendMail(List_T list, Mail_T m, Event_T e, char *host) { if (IS_EVENT_SET(m->events, e->id) && (e->state_changed || (e->state && m->reminder && e->count % m->reminder == 0))) { Mail_T tmp = NULL; NEW(tmp); tmp->host = host; _copyMail(tmp, m); _substitute(tmp, e); _escape(tmp); List_append(list, tmp); DEBUG("Sending %s notification to %s\n", Event_get_description(e), m->to); } } static MailServer_T _connectMTA(void) { if (! Run.mailservers) THROW(IOException, "No mail servers are defined -- please see the 'set mailserver' statement in the manual"); MailServer_T mta = NULL; for (mta = Run.mailservers; mta; mta = mta->next) { DEBUG("Trying to send mail via %s:%i\n", mta->host, mta->port); if (mta->ssl.flags == SSL_Enabled) mta->socket = Socket_create(mta->host, mta->port, Socket_Tcp, Socket_Ip, &(mta->ssl), Run.mailserver_timeout); else mta->socket = Socket_new(mta->host, mta->port, Socket_Tcp, Socket_Ip, SSL_Disabled, Run.mailserver_timeout); if (mta->socket) break; else Log_error("Cannot open a connection to the mailserver %s:%i -- %s\n", mta->host, mta->port, STRERROR); } if (! mta || ! mta->socket) THROW(IOException, "Delivery failed -- no mail server is available"); return mta; } static bool _send(List_T list) { volatile bool failed = false; if (List_length(list)) { volatile Mail_T m = NULL; volatile SMTP_T smtp = NULL; volatile MailServer_T mta = NULL; TRY { mta = _connectMTA(); smtp = SMTP_new(mta->socket); SMTP_greeting(smtp); SMTP_helo(smtp, Run.mail_hostname ? Run.mail_hostname : Run.system->name); if (mta->ssl.flags == SSL_StartTLS) SMTP_starttls(smtp, &(mta->ssl)); if (mta->username && mta->password) SMTP_auth(smtp, mta->username, mta->password); char now[STRLEN]; Time_str(Time_now(), now); while ((m = List_pop(list))) { SMTP_from(smtp, m->from->address); SMTP_to(smtp, m->to); SMTP_dataBegin(smtp); if ( (m->replyto && ((m->replyto->name ? Socket_print(mta->socket, "Reply-To: \"%s\" <%s>\r\n", m->replyto->name, m->replyto->address) : Socket_print(mta->socket, "Reply-To: %s\r\n", m->replyto->address)) <= 0)) || ((m->from->name ? Socket_print(mta->socket, "From: \"%s\" <%s>\r\n", m->from->name, m->from->address) : Socket_print(mta->socket, "From: %s\r\n", m->from->address)) <= 0) || Socket_print(mta->socket, "To: %s\r\n" "Subject: %s\r\n" "Date: %s\r\n" "X-Mailer: Monit %s\r\n" "MIME-Version: 1.0\r\n" "Content-Type: text/plain; charset=utf-8\r\n" "Content-Transfer-Encoding: 8bit\r\n" "X-Auto-Response-Suppress: All\r\n" "Precedence: Bulk\r\n" "Message-Id: <%lld.%llx@%s>\r\n" "\r\n" "%s", m->to, m->subject, now, VERSION, (long long)Time_now(), Random_number(), Run.mail_hostname ? Run.mail_hostname : Run.system->name, m->message) <= 0 ) { THROW(IOException, "Error sending data to mail server %s -- %s", mta->host, STRERROR); } SMTP_dataCommit(smtp); gc_mail_list((Mail_T *)&m); } SMTP_quit(smtp); } ELSE { failed = true; Log_error("Mail: %s\n", Exception_frame.message); } FINALLY { if (m) gc_mail_list((Mail_T *)&m); if (smtp) SMTP_free((SMTP_T *)&smtp); if (mta && mta->socket) Socket_free(&(mta->socket)); } END_TRY; } return failed; } static bool _hasRecipient(Mail_T list, const char *recipient) { for (Mail_T l = list; l; l = l->next) if (IS(recipient, l->to)) return true; return false; } /* ------------------------------------------------------------------ Public */ /** * Notify registered users about the event * @param E An Event object * @return If failed, return Handler_Alert flag or Handler_Succeeded if succeeded */ Handler_Type handle_alert(Event_T E) { assert(E); Handler_Type rv = Handler_Succeeded; Service_T s = E->source; if (s->maillist || Run.maillist) { char host[256] = {}; List_T list = List_new(); // Build a mail-list with local recipients that has registered interest for this event for (Mail_T m = s->maillist; m; m = m->next) _appendMail(list, m, E, host); // Build a mail-list with global recipients that has registered interest for this event. Recipients which are defined in the service localy overrides the same recipient events which are registered globaly. for (Mail_T m = Run.maillist; m; m = m->next) if (! _hasRecipient(s->maillist, m->to)) _appendMail(list, m, E, host); if (List_length(list)) if (_send(list)) rv = Handler_Alert; List_free(&list); } return rv; } monit-5.35.2/src/device/0000755000016400001720000000000015007061157011760 500000000000000monit-5.35.2/src/device/sysdep_AIX.c0000644000016400001720000002114015007061157014052 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_MNTENT_H #include #endif #ifdef HAVE_SYS_STATFS_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_VAR_H #include #endif #ifdef HAVE_SYS_PROTOSW_H #include #endif #ifdef HAVE_LIBPERFSTAT_H #include #endif #ifdef HAVE_LVM_H #include #endif #include "monit.h" #include "device.h" /* ------------------------------------------------------------- Definitions */ static struct { bool iostatEnabled; } _statistics = {}; /* --------------------------------------- Static constructor and destructor */ static void __attribute__ ((constructor)) _constructor() { // Check if iostat is enabled (disabled by default) struct vario v; sys_parm(SYSP_GET, SYSP_V_IOSTRUN, &v); _statistics.iostatEnabled = v.v.v_iostrun.value; if (! _statistics.iostatEnabled) { DEBUG("Enabling iostat\n"); v.v.v_iostrun.value = 1; sys_parm(SYSP_SET, SYSP_V_IOSTRUN, &v); } } static void __attribute__ ((destructor)) _destructor() { // Return the iostat settings back to its original settings on exit if (! _statistics.iostatEnabled) { DEBUG("Disabling iostat\n"); struct vario v; v.v.v_iostrun.value = 0; sys_parm(SYSP_SET, SYSP_V_IOSTRUN, &v); } } /* ----------------------------------------------------------------- Private */ static bool _getDummyDiskActivity(void *_inf) { return true; } static bool _getDiskActivity(void *_inf) { /* * FIXME: * * The libperfstat provides interface to the disk IO statistics per physical device (for example "hdisk0), * but the filesystem/volumes are usually part of LVM and thus we need to map physical device to LVM volume * and reflect the RAID configuration too. * * Example of volume group rootvg, which contains only one physical volume/disk (hdisk0) and multiple logical * volumes on top: * * # lsvg -p rootvg * rootvg: * PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION * hdisk0 active 542 100 00..00..00..00..100 * * # lsvg -l rootvg * rootvg: * LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT * hd5 boot 1 1 1 closed/syncd N/A * hd6 paging 16 16 1 open/syncd N/A * hd8 jfs2log 1 1 1 open/syncd N/A * hd4 jfs2 106 106 1 open/syncd / * hd2 jfs2 152 152 1 open/syncd /usr * hd9var jfs2 3 3 1 open/syncd /var * hd3 jfs2 2 2 1 open/syncd /tmp * hd1 jfs2 1 1 1 open/syncd /home * hd10opt jfs2 124 124 1 open/syncd /opt * hd11admin jfs2 4 4 1 open/syncd /admin * lg_dumplv sysdump 32 32 1 open/syncd N/A * * The mntent which we use in _setDevice() doesn't provide mapping between the physical and logical volume, example: * * mnt_fsname=/dev/hd1, mnt_dir=/home, mnt_type=jfs2, mnt_opts=rw,log=/dev/hd8 * * The libperfstat provides perfstat_disk() interface -> perfstat_disk_t entry example: * * name=hdisk0, description=16 Bit LVD SCSI Disk Drive, vgname=rootvg, adapter=sisscsia0 * * We can use liblvm (lvm_queryvgs() and lvm_queryvg()) to do the physical-logical mapping (note: it can be many-to-many * layout in the case of RAID). */ return true; } static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_bsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _compareMountpoint(const char *mountpoint, struct mntent *mnt) { return IS(mountpoint, mnt->mnt_dir); } static bool _compareDevice(const char *device, struct mntent *mnt) { return IS(device, mnt->mnt_fsname); } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct mntent *mnt)) { FILE *f = setmntent(MOUNTED, "r"); if (! f) { Log_error("Cannot open %s\n", MOUNTED); return false; } struct mntent *mnt; while ((mnt = getmntent(f))) { if (compare(path, mnt)) { strncpy(inf->filesystem->object.device, mnt->mnt_fsname, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mnt->mnt_dir, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mnt->mnt_type, sizeof(inf->filesystem->object.type) - 1); Util_swapFilesystemFlags(&(inf->filesystem->flags)); snprintf(inf->filesystem->flags.current, sizeof(inf->filesystem->flags.value[0]), "%s", mnt->mnt_opts); inf->filesystem->object.getDiskUsage = _getDiskUsage; if (Str_startsWith(mnt->mnt_type, "jfs")) { inf->filesystem->object.getDiskActivity = _getDiskActivity; } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } endmntent(f); inf->filesystem->object.mounted = true; return true; } } Log_error("Lookup for '%s' filesystem failed -- not found in %s\n", path, MOUNTED); endmntent(f); inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct mntent *mnt)) { if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/sysdep_FREEBSD.c0000644000016400001720000005566415007061157014525 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #if defined HAVE_SYS_UCRED_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_KVM_H #include #endif #ifdef HAVE_PATHS_H #include #endif #ifdef HAVE_DEVSTAT_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { unsigned long long timestamp; struct statinfo disk; } _statistics = {}; /* --------------------------------------- Static constructor and destructor */ static void __attribute__ ((constructor)) _constructor() { _statistics.disk.dinfo = CALLOC(1, sizeof(struct devinfo)); } static void __attribute__ ((destructor)) _destructor() { FREE(_statistics.disk.dinfo); } /* ----------------------------------------------------------------- Private */ static unsigned long long _bintimeToMilli(struct bintime *time) { return time->sec * 1000 + (((unsigned long long)1000 * (uint32_t)(time->frac >> 32)) >> 32); } // Parse the device path like /dev/da0p2 or /dev/gpt/myfilesystemlabel into name:instance -> da:0 static bool _parseDevice(const char *path, Device_T device) { if (strlen(path) > 5 && Str_startsWith(path, "/dev/")) { // Get the disk map size_t len = 0; if (sysctlbyname("kern.geom.conftxt", NULL, &len, NULL, 0)) { Log_error("system statistics error -- cannot get kern.geom.conftxt size\n"); return false; } char buf[len + 1]; if (sysctlbyname("kern.geom.conftxt", buf, &len, NULL, 0)) { Log_error("system statistics error -- cannot get kern.geom.conftxt\n"); return false; } buf[len] = 0; // Scan the table for matching label/partition char disk[PATH_MAX] = {}; const char *pathname = path + 5; // cut "/dev/" from the path for (const char *cursor = buf; cursor; cursor = strchr(cursor, '\n')) { while (*cursor == '\n') { cursor++; } if (*cursor) { int index; char type[64] = {}; char name[PATH_MAX] = {}; if (sscanf(cursor, "%d %63s %1023s ", &index, type, name) == 3) { if (Str_isEqual(type, "DISK")) { snprintf(disk, sizeof(disk), "%s", name); } else { if (Str_isEqual(pathname, name)) { // Matching label/partition found, parse the disk for (size_t i = 0; disk[i]; i++) { if (isdigit(*(disk + i))) { strncpy(device->key, disk, i < sizeof(device->key) ? i : sizeof(device->key) - 1); device->instance = Str_parseInt(disk + i); return true; } } } } } } } } Log_error("filesystem statistics error -- cannot parse device '%s'\n", path); return false; } static bool _getStatistics(unsigned long long now) { // Refresh only if the statistics are older then 1 second (handle also backward time jumps) if (now > _statistics.timestamp + 1000 || now < _statistics.timestamp - 1000) { if (devstat_getdevs(NULL, &(_statistics.disk)) == -1) { Log_error("filesystem statistics error -- devstat_getdevs: %s\n", devstat_errbuf); return false; } _statistics.timestamp = now; } return true; } static bool _getDummyDiskActivity(__attribute__ ((unused)) void *_inf) { return true; } static bool _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; unsigned long long now = Time_milli(); bool rv = _getStatistics(now); if (rv) { for (int i = 0; i < _statistics.disk.dinfo->numdevs; i++) { if (_statistics.disk.dinfo->devices[i].unit_number == inf->filesystem->object.instance && IS(_statistics.disk.dinfo->devices[i].device_name, inf->filesystem->object.key)) { unsigned long long now = _statistics.disk.snap_time * 1000; Statistics_update(&(inf->filesystem->time.read), now, _bintimeToMilli(&(_statistics.disk.dinfo->devices[i].duration[DEVSTAT_READ]))); Statistics_update(&(inf->filesystem->read.bytes), now, _statistics.disk.dinfo->devices[i].bytes[DEVSTAT_READ]); Statistics_update(&(inf->filesystem->read.operations), now, _statistics.disk.dinfo->devices[i].operations[DEVSTAT_READ]); Statistics_update(&(inf->filesystem->time.write), now, _bintimeToMilli(&(_statistics.disk.dinfo->devices[i].duration[DEVSTAT_WRITE]))); Statistics_update(&(inf->filesystem->write.bytes), now, _statistics.disk.dinfo->devices[i].bytes[DEVSTAT_WRITE]); Statistics_update(&(inf->filesystem->write.operations), now, _statistics.disk.dinfo->devices[i].operations[DEVSTAT_WRITE]); break; } } } return rv; } static unsigned long _mibGetValueByNameUlong(const char *name) { long long value = 0LL; size_t valueLength = sizeof(value); if (sysctlbyname(name, &value, &valueLength, NULL, 0)) { Log_error("system statistics error -- cannot get %s value: %s\n", name, STRERROR); return -1; } return value; } static bool _updateZfsStatistics(Info_T inf) { char memberName[PATH_MAX] = {}; snprintf(memberName, sizeof(memberName), "kstat.zfs.%.256s.dataset.objset-0x%.256s.nread", inf->filesystem->object.key, inf->filesystem->object.module); long long nread = _mibGetValueByNameUlong(memberName); snprintf(memberName, sizeof(memberName), "kstat.zfs.%.256s.dataset.objset-0x%.256s.reads", inf->filesystem->object.key, inf->filesystem->object.module); long long reads = _mibGetValueByNameUlong(memberName); snprintf(memberName, sizeof(memberName), "kstat.zfs.%.256s.dataset.objset-0x%.256s.nwritten", inf->filesystem->object.key, inf->filesystem->object.module); long long nwritten = _mibGetValueByNameUlong(memberName); snprintf(memberName, sizeof(memberName), "kstat.zfs.%.256s.dataset.objset-0x%.256s.writes", inf->filesystem->object.key, inf->filesystem->object.module); long long writes = _mibGetValueByNameUlong(memberName); if (nread >= 0 && reads >= 0 && nwritten >= 0 && writes >= 0) { unsigned long long now = Time_milli(); Statistics_update(&(inf->filesystem->read.bytes), now, nread); Statistics_update(&(inf->filesystem->read.operations), now, reads); Statistics_update(&(inf->filesystem->write.bytes), now, nwritten); Statistics_update(&(inf->filesystem->write.operations), now, writes); return true; } else { return false; } } static bool _getZfsObjsetId(Info_T inf) { char previousObjsetId[STRLEN] = {}; // Prepare the zpool statistics path name (kstat.zfs..dataset). char mibZfsStatsName[PATH_MAX] = {}; snprintf(mibZfsStatsName, sizeof(mibZfsStatsName), "kstat.zfs.%.256s.dataset", inf->filesystem->object.key); // Translate the kstat.zfs..dataset name to OID int mibZfsStatsQueryOid[CTL_MAXNAME] = {CTL_SYSCTL, CTL_SYSCTL_NAME2OID}; size_t mibZfsStatsQueryOidLength = 2; int mibZfsStatsRootOid[CTL_MAXNAME] = {}; size_t mibZfsStatsRootOidLength = sizeof(mibZfsStatsRootOid); if (sysctl(mibZfsStatsQueryOid, mibZfsStatsQueryOidLength, mibZfsStatsRootOid, &mibZfsStatsRootOidLength, mibZfsStatsName, strlen(mibZfsStatsName)) == -1) { Log_error("system statistics error -- sysctl for %s -> OID failed: %s\n", mibZfsStatsName, STRERROR); return false; } mibZfsStatsRootOidLength /= sizeof(int); // // Traverse the kstat.zfs..dataset.* OID tree // // Set the OID query mibZfsStatsQueryOid[0] = CTL_SYSCTL; mibZfsStatsQueryOid[1] = CTL_SYSCTL_NEXT; memcpy(mibZfsStatsQueryOid + 2, mibZfsStatsRootOid, mibZfsStatsRootOidLength * sizeof(int)); // Copy the tree root to the MIB query // Set the OID query length: the MIB header objects (CTL_SYSCTL + CTL_SYSCTL_NEXT) + the OID to traverse mibZfsStatsQueryOidLength = 2 + mibZfsStatsRootOidLength; // Walk tree members while (true) { int mibZfsStatsMemberOid[CTL_MAXNAME] = {}; size_t mibZfsStatsMemberOidLength = sizeof(mibZfsStatsMemberOid); // Get next object if (sysctl(mibZfsStatsQueryOid, mibZfsStatsQueryOidLength, mibZfsStatsMemberOid, &mibZfsStatsMemberOidLength, 0, 0) == -1) { if (errno != ENOENT) Log_error("system statistics error -- sysctl for next %s object failed: %s\n", mibZfsStatsName, STRERROR); else break; // No more objects under kstat.zfs..dataset.* tree } // sysctl result: convert OID byte length to object nesting level mibZfsStatsMemberOidLength /= sizeof(int); // if whole kstat.zfs..dataset.* tree was traversed, sysctl will continue with next object past the tree => quick check the OID level matches expectation if (mibZfsStatsMemberOidLength < mibZfsStatsRootOidLength) break; // We left the kstat.zfs..dataset.* tree // make sure the returned object is still within the kstat.zfs..dataset tree for (size_t i = 0; i < mibZfsStatsRootOidLength; i++) if (mibZfsStatsMemberOid[i] != mibZfsStatsRootOid[i]) return false; // We left the kstat.zfs..dataset tree without finding statistics for this dataset // // Translate the OID to object name // // Set the name query int mibZfsStatsQueryName[CTL_MAXNAME] = {CTL_SYSCTL, CTL_SYSCTL_NAME}; memcpy(mibZfsStatsQueryName + 2, mibZfsStatsMemberOid, mibZfsStatsMemberOidLength * sizeof(int)); // Copy the member OID the MIB name query // Set the name query length: the MIB header objects (CTL_SYSCTL + CTL_SYSCTL_NAME) + the OID to get name for size_t mibZfsStatsQueryNameLength = 2 + mibZfsStatsMemberOidLength; // translate the OID to name char objsetName[PATH_MAX] = {}; size_t objsetNameLength = sizeof(objsetName); if (sysctl(mibZfsStatsQueryName, mibZfsStatsQueryNameLength, objsetName, &objsetNameLength, 0, 0) == -1 || objsetNameLength <= 0) Log_error("system statistics error -- sysctl for OID -> name failed: %s\n", STRERROR); // Process the given objset ID data snprintf(mibZfsStatsName, sizeof(mibZfsStatsName), "kstat.zfs.%.256s.dataset.objset-0x", inf->filesystem->object.key); if (Str_startsWith(objsetName, mibZfsStatsName)) { // Dissect objset-0x from the object name (example: kstat.zfs.zroot.dataset.objset-0x4f.nunlinked). char *objsetId = objsetName + strlen(mibZfsStatsName); Str_replaceChar(objsetId, '.', 0); // If we found new objset ID, fetch the dataset_name value and if matching the filesystem we're testing, fetch data and stop, otherwise continue if (! Str_isByteEqual(objsetId, previousObjsetId)) { strncpy(previousObjsetId, objsetId, sizeof(previousObjsetId) - 1); char memberName[PATH_MAX] = {}; char datasetName[STRLEN]; size_t datasetNameLength = sizeof(datasetName); snprintf(memberName, sizeof(memberName), "kstat.zfs.%.256s.dataset.objset-0x%s.dataset_name", inf->filesystem->object.key, objsetId); if (sysctlbyname(memberName, datasetName, &datasetNameLength, NULL, 0)) { Log_error("system statistics error -- cannot get %s\n", memberName); return false; } if (Str_isByteEqual(datasetName, inf->filesystem->object.device)) { // Cache the objset ID, so we can fetch the data directly next time strncpy(inf->filesystem->object.module, objsetId, sizeof(inf->filesystem->object.module) - 1); return true; } } } // Update the query for the next cycle with the current member memcpy(mibZfsStatsQueryOid + 2, mibZfsStatsMemberOid, mibZfsStatsMemberOidLength * sizeof(int)); mibZfsStatsQueryOidLength = 2 + mibZfsStatsMemberOidLength; } return false; } static bool _getZfsDiskActivity(void *_inf) { Info_T inf = _inf; if (STR_UNDEF(inf->filesystem->object.key)) { // Skip if no zpool name is available return true; } // We cache the objset ID in the object.module ... if not set, scan the system information if (STR_UNDEF(inf->filesystem->object.module)) { if (! _getZfsObjsetId(inf)) return false; } return _updateZfsStatistics(inf); } static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_bsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static bool _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, unsigned long long flags) { struct mystable { unsigned long long flag; char *description; } t[]= { #ifdef MNT_AUTOMOUNTED {MNT_AUTOMOUNTED, "automounted"}, #endif #ifdef MNT_NFS4ACLS {MNT_NFS4ACLS, "nfs4acls"}, #endif #ifdef MNT_SUJ {MNT_SUJ, "journaled soft updates"}, #endif {MNT_RDONLY, "ro"}, {MNT_SYNCHRONOUS, "synchronous"}, {MNT_NOEXEC, "noexec"}, {MNT_NOSUID, "nosuid"}, {MNT_UNION, "union"}, {MNT_ASYNC, "async"}, {MNT_SUIDDIR, "suiddir"}, {MNT_SOFTDEP, "soft updates"}, {MNT_NOSYMFOLLOW, "nosymfollow"}, {MNT_GJOURNAL, "GEOM journal"}, {MNT_MULTILABEL, "multilabel"}, {MNT_ACLS, "acls"}, {MNT_NOATIME, "noatime"}, {MNT_NOCLUSTERR, "noclusterr"}, {MNT_NOCLUSTERW, "noclusterw"}, {MNT_EXRDONLY, "exported read only"}, {MNT_EXPORTED, "exported"}, {MNT_DEFEXPORTED, "exported to the world"}, {MNT_EXPORTANON, "anon uid mapping"}, {MNT_EXKERB, "exported with kerberos"}, {MNT_EXPUBLIC, "public export"}, {MNT_LOCAL, "local"}, {MNT_QUOTA, "quota"}, {MNT_ROOTFS, "rootfs"}, {MNT_USER, "user"}, {MNT_IGNORE, "ignore"} }; Util_swapFilesystemFlags(&(inf->filesystem->flags)); for (size_t i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags.current + strlen(inf->filesystem->flags.current), sizeof(inf->filesystem->flags.value[0]) - strlen(inf->filesystem->flags.current) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs > 0) { struct statfs *mnt = CALLOC(countfs, sizeof(struct statfs)); if ((countfs = getfsstat(mnt, countfs * sizeof(struct statfs), MNT_NOWAIT)) != -1) { for (int i = 0; i < countfs; i++) { struct statfs *mntItem = mnt + i; if (compare(path, mntItem)) { if (IS(mntItem->f_fstypename, "ufs")) { if (_parseDevice(mntItem->f_mntfromname, &(inf->filesystem->object))) { inf->filesystem->object.getDiskActivity = _getBlockDiskActivity; } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; DEBUG("I/O monitoring for filesystem '%s' skipped - unable to parse the device %s\n", path, mntItem->f_mntfromname); } } else if (IS(mntItem->f_fstypename, "zfs")) { // ZFS inf->filesystem->object.getDiskActivity = _getZfsDiskActivity; // Need base zpool name for kstat.zfs. lookup: snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "%s", inf->filesystem->object.device); Str_replaceChar(inf->filesystem->object.key, '/', 0); } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } inf->filesystem->object.flags = mntItem->f_flags & MNT_VISFLAGMASK; _filesystemFlagsToString(inf, inf->filesystem->object.flags); strncpy(inf->filesystem->object.device, mntItem->f_mntfromname, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mntItem->f_mntonname, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mntItem->f_fstypename, sizeof(inf->filesystem->object.type) - 1); inf->filesystem->object.getDiskUsage = _getDiskUsage; inf->filesystem->object.mounted = true; FREE(mnt); return true; } } } FREE(mnt); } Log_error("Lookup for '%s' filesystem failed\n", path); inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/sysdep_DARWIN.c0000644000016400001720000003123515007061157014423 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_UCRED_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_DISKARBITRATION_DISKARBITRATION_H #include #endif #ifdef HAVE_IOKIT_STORAGE_IOBLOCKSTORAGEDRIVER_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "system/Time.h" /* ----------------------------------------------------------------- Private */ static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_bsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _getDummyDiskActivity(__attribute__ ((unused)) void *_inf) { return true; } static bool _getBlockDiskActivity(void *_inf) { int rv = false; Info_T inf = _inf; DASessionRef session = DASessionCreate(NULL); if (session) { CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8 *)inf->filesystem->object.mountpoint, strlen(inf->filesystem->object.mountpoint), true); DADiskRef disk = DADiskCreateFromVolumePath(NULL, session, url); if (disk) { DADiskRef wholeDisk = DADiskCopyWholeDisk(disk); if (wholeDisk) { io_service_t ioMedia = DADiskCopyIOMedia(wholeDisk); if (ioMedia) { CFTypeRef statistics = IORegistryEntrySearchCFProperty(ioMedia, kIOServicePlane, CFSTR(kIOBlockStorageDriverStatisticsKey), kCFAllocatorDefault, kIORegistryIterateRecursively | kIORegistryIterateParents); if (statistics) { rv = true; UInt64 value = 0; unsigned long long now = Time_milli(); // Total read bytes CFNumberRef number = CFDictionaryGetValue(statistics, CFSTR(kIOBlockStorageDriverStatisticsBytesReadKey)); if (number) { CFNumberGetValue(number, kCFNumberSInt64Type, &value); Statistics_update(&(inf->filesystem->read.bytes), now, value); } // Total read operations number = CFDictionaryGetValue(statistics, CFSTR(kIOBlockStorageDriverStatisticsReadsKey)); if (number) { CFNumberGetValue(number, kCFNumberSInt64Type, &value); Statistics_update(&(inf->filesystem->read.operations), now, value); } // Total write bytes number = (CFNumberRef)CFDictionaryGetValue(statistics, CFSTR(kIOBlockStorageDriverStatisticsBytesWrittenKey)); if (number) { CFNumberGetValue(number, kCFNumberSInt64Type, &value); Statistics_update(&(inf->filesystem->write.bytes), now, value); } // Total write operations number = CFDictionaryGetValue(statistics, CFSTR(kIOBlockStorageDriverStatisticsWritesKey)); if (number) { CFNumberGetValue(number, kCFNumberSInt64Type, &value); Statistics_update(&(inf->filesystem->write.operations), now, value); } // Total read time number = CFDictionaryGetValue(statistics, CFSTR(kIOBlockStorageDriverStatisticsTotalReadTimeKey)); if (number) { CFNumberGetValue(number, kCFNumberSInt64Type, &value); Statistics_update(&(inf->filesystem->time.read), now, value / 1048576.); // ns -> ms } // Total write time number = CFDictionaryGetValue(statistics, CFSTR(kIOBlockStorageDriverStatisticsTotalWriteTimeKey)); if (number) { CFNumberGetValue(number, kCFNumberSInt64Type, &value); Statistics_update(&(inf->filesystem->time.write), now, value / 1048576.); // ns -> ms } //FIXME: add disk error statistics test: can use kIOBlockStorageDriverStatisticsWriteErrorsKey + kIOBlockStorageDriverStatisticsReadErrorsKey CFRelease(statistics); } IOObjectRelease(ioMedia); } CFRelease(wholeDisk); } CFRelease(disk); } CFRelease(url); CFRelease(session); } return rv; } static bool _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static bool _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, unsigned long long flags) { struct mystable { unsigned long long flag; char *description; } t[]= { {MNT_RDONLY, "ro"}, #ifdef MNT_REMOVABLE {MNT_REMOVABLE, "removable"}, #endif {MNT_SYNCHRONOUS, "synchronous"}, {MNT_NOEXEC, "noexec"}, {MNT_NOSUID, "nosuid"}, {MNT_NODEV, "nodev"}, {MNT_UNION, "union"}, {MNT_ASYNC, "async"}, {MNT_DOVOLFS, "dovolfs"}, #ifdef MNT_CPROTECT {MNT_CPROTECT, "content protection"}, #endif {MNT_EXPORTED, "exported"}, {MNT_QUARANTINE, "quarantined"}, {MNT_LOCAL, "local"}, {MNT_QUOTA, "quota"}, {MNT_ROOTFS, "rootfs"}, {MNT_DONTBROWSE, "nobrowse"}, {MNT_IGNORE_OWNERSHIP, "noowners"}, {MNT_AUTOMOUNTED, "automounted"}, {MNT_JOURNALED, "journaled"}, {MNT_NOUSERXATTR, "nouserxattr"}, {MNT_DEFWRITE, "defer writes"}, {MNT_MULTILABEL, "multilabel"}, {MNT_NOATIME, "noatime"}, #ifdef MNT_SNAPSHOT {MNT_SNAPSHOT, "snapshot"}, #endif #ifdef MNT_STRICTATIME {MNT_STRICTATIME, "strictatime"} #endif }; Util_swapFilesystemFlags(&(inf->filesystem->flags)); for (size_t i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags.current + strlen(inf->filesystem->flags.current), sizeof(inf->filesystem->flags.value[0]) - strlen(inf->filesystem->flags.current) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs > 0) { struct statfs *mnt = CALLOC(countfs, sizeof(struct statfs)); if ((countfs = getfsstat(mnt, countfs * sizeof(struct statfs), MNT_NOWAIT)) != -1) { for (int i = 0; i < countfs; i++) { struct statfs *mntItem = mnt + i; if (compare(path, mntItem)) { if (IS(mntItem->f_fstypename, "hfs") || IS(mntItem->f_fstypename, "apfs")) { inf->filesystem->object.getDiskActivity = _getBlockDiskActivity; } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } inf->filesystem->object.flags = mntItem->f_flags & MNT_VISFLAGMASK; _filesystemFlagsToString(inf, inf->filesystem->object.flags); strncpy(inf->filesystem->object.device, mntItem->f_mntfromname, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mntItem->f_mntonname, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mntItem->f_fstypename, sizeof(inf->filesystem->object.type) - 1); inf->filesystem->object.getDiskUsage = _getDiskUsage; inf->filesystem->object.mounted = true; FREE(mnt); return true; } } } FREE(mnt); } Log_error("Lookup for '%s' filesystem failed\n", path); inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { //FIXME: cache mount information (register for mount/unmount notification) if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/sysdep_NETBSD.c0000644000016400001720000002650715007061157014424 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STATVFS_H #include #endif #ifdef HAVE_SYS_IOSTAT_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { unsigned long long timestamp; size_t diskCount; size_t diskLength; struct io_sysctl *disk; } _statistics = {}; /* ------------------------------------------------------- Static destructor */ static void __attribute__ ((destructor)) _destructor() { FREE(_statistics.disk); } /* ----------------------------------------------------------------- Private */ // Parse the device path like /dev/sd0a -> sd0 static bool _parseDevice(const char *path, Device_T device) { const char *base = File_basename(path); for (int len = strlen(base), i = len - 1; i >= 0; i--) { if (isdigit(*(base + i))) { unsigned index = i + 1; strncpy(device->key, base, index < sizeof(device->key) ? index : sizeof(device->key) - 1); return true; } } return false; } static bool _getStatistics(unsigned long long now) { // Refresh only if the statistics are older then 1 second (handle also backward time jumps) if (now > _statistics.timestamp + 1000 || now < _statistics.timestamp - 1000) { size_t len = 0; int mib[3] = {CTL_HW, HW_IOSTATS, sizeof(struct io_sysctl)}; if (sysctl(mib, 3, NULL, &len, NULL, 0) == -1) { Log_error("filesystem statistic error -- cannot get HW_IOSTATS size: %s\n", STRERROR); return false; } if (_statistics.diskLength != len) { _statistics.diskCount = len / mib[2]; _statistics.diskLength = len; RESIZE(_statistics.disk, len); } if (sysctl(mib, 3, _statistics.disk, &(_statistics.diskLength), NULL, 0) == -1) { Log_error("filesystem statistic error -- cannot get HW_IOSTATS: %s\n", STRERROR); return false; } _statistics.timestamp = now; } return true; } static bool _getDummyDiskActivity(__attribute__ ((unused)) void *_inf) { return true; } static bool _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; unsigned long long now = Time_milli(); bool rv = _getStatistics(now); if (rv) { for (unsigned i = 0; i < _statistics.diskCount; i++) { if (Str_isEqual(inf->filesystem->object.key, _statistics.disk[i].name)) { Statistics_update(&(inf->filesystem->read.bytes), now, _statistics.disk[i].rbytes); Statistics_update(&(inf->filesystem->write.bytes), now, _statistics.disk[i].wbytes); Statistics_update(&(inf->filesystem->read.operations), now, _statistics.disk[i].rxfer); Statistics_update(&(inf->filesystem->write.operations), now, _statistics.disk[i].wxfer); Statistics_update(&(inf->filesystem->time.run), now, _statistics.disk[i].time_sec * 1000. + _statistics.disk[i].time_usec / 1000.); break; } } } return rv; } static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statvfs usage; if (statvfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_frsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _compareMountpoint(const char *mountpoint, struct statvfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static bool _compareDevice(const char *device, struct statvfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, unsigned long long flags) { struct mystable { unsigned long long flag; char *description; } t[]= { #ifdef MNT_DISCARD {MNT_DISCARD, "discard"}, #endif {MNT_RDONLY, "ro"}, {MNT_SYNCHRONOUS, "synchronous"}, {MNT_NOEXEC, "noexec"}, {MNT_NOSUID, "nosuid"}, {MNT_NODEV, "nodev"}, {MNT_NODEVMTIME, "nodevmtime"}, {MNT_EXTATTR, "extattr"}, {MNT_IGNORE, "hidden"}, {MNT_LOG, "log"}, {MNT_RELATIME, "relatime"}, {MNT_NOCOREDUMP, "nocoredump"}, {MNT_ASYNC, "asynchronous"}, {MNT_NOATIME, "noatime"}, {MNT_EXRDONLY, "exported read only"}, {MNT_EXPORTED, "exported"}, {MNT_DEFEXPORTED, "exported to the world"}, {MNT_EXPORTANON, "anon uid mapping"}, {MNT_EXKERB, "exported with kerberos"}, {MNT_EXPUBLIC, "public export"}, {MNT_EXNORESPORT, "no reserved ports enforcement"}, {MNT_LOCAL, "local"}, {MNT_QUOTA, "quota"}, {MNT_ROOTFS, "rootfs"}, {MNT_SOFTDEP, "soft dependencies"}, {MNT_SYMPERM, "symperm"}, {MNT_UNION, "union"} }; Util_swapFilesystemFlags(&(inf->filesystem->flags)); for (unsigned i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags.current + strlen(inf->filesystem->flags.current), sizeof(inf->filesystem->flags.value[0]) - strlen(inf->filesystem->flags.current) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statvfs *mnt)) { int countfs = getvfsstat(NULL, 0, MNT_NOWAIT); if (countfs > 0) { struct statvfs *mnt = CALLOC(countfs, sizeof(struct statvfs)); if ((countfs = getvfsstat(mnt, countfs * sizeof(struct statvfs), MNT_NOWAIT)) != -1) { for (int i = 0; i < countfs; i++) { struct statvfs *mntItem = mnt + i; if (compare(path, mntItem)) { if (IS(mntItem->f_fstypename, "ffs")) { if (_parseDevice(mntItem->f_mntfromname, &(inf->filesystem->object))) { inf->filesystem->object.getDiskActivity = _getBlockDiskActivity; } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; DEBUG("I/O monitoring for filesystem '%s' skipped - unable to parse the device %s", path, mntItem->f_mntfromname); } } else { //FIXME: NetBSD kernel has NFS statistics as well, but there is no clear mapping between the kernel label ("nfsX" style) and the NFS mount => we don't support NFS currently inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } inf->filesystem->object.flags = mntItem->f_flag & MNT_VISFLAGMASK; _filesystemFlagsToString(inf, inf->filesystem->object.flags); strncpy(inf->filesystem->object.device, mntItem->f_mntfromname, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mntItem->f_mntonname, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mntItem->f_fstypename, sizeof(inf->filesystem->object.type) - 1); inf->filesystem->object.getDiskUsage = _getDiskUsage; inf->filesystem->object.mounted = true; FREE(mnt); return true; } } } FREE(mnt); } Log_error("Lookup for '%s' filesystem failed\n", path); inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statvfs *mnt)) { if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/device.h0000644000016400001720000000232415007061157013311 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_DEVICE_H #define MONIT_DEVICE_H bool filesystem_usage(Service_T); bool Filesystem_getByMountpoint(Info_T inf, const char *path); bool Filesystem_getByDevice(Info_T inf, const char *path); #endif monit-5.35.2/src/device/sysdep_LINUX.c0000644000016400001720000006336715007061157014351 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_GLOB_H #include #endif #ifdef HAVE_SYS_STATVFS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_MNTENT_H #include #endif #ifdef HAVE_POLL_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_SYSMACROS_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "io/File.h" #include "system/Time.h" #include "exceptions/AssertException.h" /* ------------------------------------------------------------- Definitions */ #define MOUNTS "/proc/self/mounts" #define CIFSSTAT "/proc/fs/cifs/Stats" #define DISKSTAT "/proc/diskstats" #define NFSSTAT "/proc/self/mountstats" static struct { int fd; // /proc/self/mounts filedescriptor (needed for mount/unmount notification) int generation; // Increment each time the mount table is changed bool (*getBlockDiskActivity)(void *); // Disk activity callback: _getProcfsBlockDiskActivity or _getSysfsBlockDiskActivity (if sysfs is mounted) bool (*getCifsDiskActivity)(void *); // Disk activity callback: _getCifsDiskActivity if /proc/fs/cifs/Stats is present, otherwise _getDummyDiskActivity } _statistics = {}; /* ----------------------------------------------------------------- Private */ static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statvfs usage; if (statvfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_frsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _getDummyDiskActivity(__attribute__ ((unused)) void *_inf) { return true; } static bool _getCifsDiskActivity(void *_inf) { Info_T inf = _inf; FILE *f = fopen(CIFSSTAT, "r"); if (! f) { Log_error("Cannot open %s\n", CIFSSTAT); return false; } unsigned long long now = Time_milli(); char line[PATH_MAX]; bool found = false; while (fgets(line, sizeof(line), f)) { if (! found) { int index; char name[4096]; if (sscanf(line, "%d) %4095s", &index, name) == 2 && Str_isEqual(name, inf->filesystem->object.key)) { found = true; } } else if (found) { char label1[256]; char label2[256]; unsigned long long operations; unsigned long long bytes; if (sscanf(line, "%255[^:]: %llu %255[^:]: %llu", label1, &operations, label2, &bytes) == 4) { if (Str_isEqual(label1, "Reads") && Str_isEqual(label2, "Bytes")) { Statistics_update(&(inf->filesystem->read.bytes), now, bytes); Statistics_update(&(inf->filesystem->read.operations), now, operations); } else if (Str_isEqual(label1, "Writes") && Str_isEqual(label2, "Bytes")) { Statistics_update(&(inf->filesystem->write.bytes), now, bytes); Statistics_update(&(inf->filesystem->write.operations), now, operations); break; } } } } fclose(f); return true; } static bool _getNfsDiskActivity(void *_inf) { Info_T inf = _inf; FILE *f = fopen(NFSSTAT, "r"); if (! f) { Log_error("Cannot open %s\n", NFSSTAT); return false; } unsigned long long now = Time_milli(); char line[PATH_MAX]; char pattern[2 * PATH_MAX]; bool found = false; snprintf(pattern, sizeof(pattern), "device %s ", inf->filesystem->object.device); while (fgets(line, sizeof(line), f)) { if (! found && Str_startsWith(line, pattern)) { found = true; } else if (found) { char name[256]; unsigned long long operations; unsigned long long bytesSent; unsigned long long bytesReceived; unsigned long long time; if (sscanf(line, " %255[^:]: %llu %*u %*u %llu %llu %*u %*u %llu", name, &operations, &bytesSent, &bytesReceived, &time) == 5) { if (Str_isEqual(name, "READ")) { Statistics_update(&(inf->filesystem->time.read), now, time / 1000.); // us -> ms Statistics_update(&(inf->filesystem->read.bytes), now, bytesReceived); Statistics_update(&(inf->filesystem->read.operations), now, operations); } else if (Str_isEqual(name, "WRITE")) { Statistics_update(&(inf->filesystem->time.write), now, time / 1000.); // us -> ms Statistics_update(&(inf->filesystem->write.bytes), now, bytesSent); Statistics_update(&(inf->filesystem->write.operations), now, operations); break; } } } } fclose(f); return true; } static bool _getZfsObjsetId(Info_T inf) { // Find all objset files in the /proc/spl/kstat/zfs// directory char path[PATH_MAX] = {}; snprintf(path, sizeof(path), "/proc/spl/kstat/zfs/%.256s/objset-0x[a-fA-F0-9]*", inf->filesystem->object.key); glob_t globbuf; int rv = glob(path, 0, NULL, &globbuf); if (rv) { Log_error("system statistic error -- glob failed: %d (%s)\n", rv, STRERROR); return false; } // Scan objset list and find the matching dataset char datasetName[STRLEN] = {}; for (size_t i = 0; i < globbuf.gl_pathc; i++) { FILE *f = fopen(globbuf.gl_pathv[i], "r"); if (f) { char line[STRLEN]; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "dataset_name %*d %255s", datasetName) == 1) { if (Str_isByteEqual(datasetName, inf->filesystem->object.device)) { // Cache the path to statistics, so we can fetch the data directly next time strncpy(inf->filesystem->object.module, globbuf.gl_pathv[i], sizeof(inf->filesystem->object.module) - 1); fclose(f); return true; } else { // The dataset name doesn't match, try next objset file break; } } } fclose(f); } } return false; } static bool _updateZfsStatistics(Info_T inf) { FILE *f = fopen(inf->filesystem->object.module, "r"); if (f) { char line[STRLEN]; long long nread = -1LL; long long reads = -1LL; long long nwritten = -1LL; long long writes = -1LL; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "nread %*d %lld", &nread) == 1) continue; else if (sscanf(line, "reads %*d %lld", &reads) == 1) continue; else if (sscanf(line, "nwritten %*d %lld", &nwritten) == 1) continue; else if (sscanf(line, "writes %*d %lld", &writes) == 1) continue; } fclose(f); if (nread >= 0 && reads >= 0 && nwritten >= 0 && writes >= 0) { unsigned long long now = Time_milli(); Statistics_update(&(inf->filesystem->read.bytes), now, nread); Statistics_update(&(inf->filesystem->read.operations), now, reads); Statistics_update(&(inf->filesystem->write.bytes), now, nwritten); Statistics_update(&(inf->filesystem->write.operations), now, writes); return true; } else { Log_error("filesystem statistic error: cannot parse ZFS statistics from %s\n", inf->filesystem->object.module); } } else { Log_error("filesystem statistic error: cannot read ZFS statistics from %s -- %s\n", inf->filesystem->object.module, STRERROR); } return false; } static bool _getZfsDiskActivity(void *_inf) { Info_T inf = _inf; char path[2 * PATH_MAX]; snprintf(path, sizeof(path), "/proc/spl/kstat/zfs/%s/io", inf->filesystem->object.key); FILE *f = fopen(path, "r"); if (f) { char line[STRLEN]; unsigned long long now = Time_milli(); unsigned long long waitTime = 0ULL, runTime = 0ULL; unsigned long long readOperations = 0ULL, readBytes = 0ULL; unsigned long long writeOperations = 0ULL, writeBytes = 0ULL; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "%llu %llu %llu %llu %llu %*u %*u %llu", &readBytes, &writeBytes, &readOperations, &writeOperations, &waitTime, &runTime) == 6) { Statistics_update(&(inf->filesystem->read.bytes), now, readBytes); Statistics_update(&(inf->filesystem->read.operations), now, readOperations); Statistics_update(&(inf->filesystem->write.bytes), now, writeBytes); Statistics_update(&(inf->filesystem->write.operations), now, writeOperations); Statistics_update(&(inf->filesystem->time.wait), now, (double)waitTime / 1000000.); // ns -> ms Statistics_update(&(inf->filesystem->time.run), now, (double)runTime / 1000000.); // ns -> ms break; } } fclose(f); return true; } else { // OpenZFS 2.x // We cache the objset ID in the object.module ... if not set, scan the system information if (STR_UNDEF(inf->filesystem->object.module)) { if (! _getZfsObjsetId(inf)) return false; } return _updateZfsStatistics(inf); } } // See https://www.kernel.org/doc/Documentation/block/stat.txt static bool _getSysfsBlockDiskActivity(void *_inf) { Info_T inf = _inf; char path[2 * PATH_MAX]; snprintf(path, sizeof(path), "/sys/dev/block/%u:%u/stat", inf->filesystem->object.number.major, inf->filesystem->object.number.minor); FILE *f = fopen(path, "r"); if (f) { unsigned long long now = Time_milli(); unsigned long long readOperations = 0ULL, readSectors = 0ULL, readTime = 0ULL; unsigned long long writeOperations = 0ULL, writeSectors = 0ULL, writeTime = 0ULL; if (fscanf(f, "%llu %*u %llu %llu %llu %*u %llu %llu", &readOperations, &readSectors, &readTime, &writeOperations, &writeSectors, &writeTime) != 6) { fclose(f); Log_error("filesystem statistic error: cannot parse %s -- %s\n", path, STRERROR); return false; } Statistics_update(&(inf->filesystem->time.read), now, readTime); Statistics_update(&(inf->filesystem->read.bytes), now, readSectors * 512); Statistics_update(&(inf->filesystem->read.operations), now, readOperations); Statistics_update(&(inf->filesystem->time.write), now, writeTime); Statistics_update(&(inf->filesystem->write.bytes), now, writeSectors * 512); Statistics_update(&(inf->filesystem->write.operations), now, writeOperations); fclose(f); return true; } Log_error("filesystem statistic error: cannot read %s -- %s\n", path, STRERROR); return false; } // See https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats static bool _getProcfsBlockDiskActivity(void *_inf) { Info_T inf = _inf; FILE *f = fopen(DISKSTAT, "r"); if (f) { unsigned long long now = Time_milli(); unsigned long long readOperations = 0ULL, readSectors = 0ULL, readTime = 0ULL; unsigned long long writeOperations = 0ULL, writeSectors = 0ULL, writeTime = 0ULL; char line[PATH_MAX]; while (fgets(line, sizeof(line), f)) { int rv; int major; int minor; char name[256] = {}; // Note: There are 17 fields in kernel 5.5+, we may use them in the future rv = fscanf(f, " %d %d %255s %llu %*u %llu %llu %llu %*u %llu %llu", &major, &minor, name, &readOperations, &readSectors, &readTime, &writeOperations, &writeSectors, &writeTime); if (rv == 9 && major == inf->filesystem->object.number.major && minor == inf->filesystem->object.number.minor) { Statistics_update(&(inf->filesystem->time.read), now, readTime); Statistics_update(&(inf->filesystem->read.bytes), now, readSectors * 512); Statistics_update(&(inf->filesystem->read.operations), now, readOperations); Statistics_update(&(inf->filesystem->time.write), now, writeTime); Statistics_update(&(inf->filesystem->write.bytes), now, writeSectors * 512); Statistics_update(&(inf->filesystem->write.operations), now, writeOperations); break; } } fclose(f); return true; } Log_error("filesystem statistic error: cannot read %s -- %s\n", DISKSTAT, STRERROR); return false; } static bool _getDeviceNumbers(const char *device, int *major, int *minor) { struct stat sb; if (stat(device, &sb) != 0) { *major = *minor = -1; return false; } *major = major(sb.st_rdev); *minor = minor(sb.st_rdev); return true; } static bool _compareMountpoint(const char *mountpoint, struct mntent *mnt) { return IS(mountpoint, mnt->mnt_dir); } static bool _compareDevice(const char *device, struct mntent *mnt) { int mnt_major, mnt_minor; int device_major, device_minor; char target[PATH_MAX] = {}; if (Str_isEqual(device, mnt->mnt_fsname)) { // lookup the device as is first (support for NFS/CIFS/SSHFS/etc.) DEBUG("device %s matches filesystem %s (mounted on %s)\n", device, mnt->mnt_fsname, mnt->mnt_dir); return true; } else if (realpath(mnt->mnt_fsname, target) && Str_isEqual(device, target)) { // The device listed in /etc/mtab can be a device mapper symlink (e.g. /dev/mapper/centos-root -> /dev/dm-1), i.e. try realpath DEBUG("device %s matches real path %s for filesystem %s (mounted on %s)\n", device, target, mnt->mnt_fsname, mnt->mnt_dir); return true; } else if (_getDeviceNumbers(device, &device_major, &device_minor) && _getDeviceNumbers(mnt->mnt_fsname, &mnt_major, &mnt_minor) && (mnt_major == device_major) && (mnt_minor == device_minor)) { // The same filesystem may have multiple independent device nodes with the same major+minor number (e.g. block devices /dev/root and /dev/xvda1 for the same filesystem) => if path didn't match, compare major+minor DEBUG("device %s with major=%d and minor=%d number matches filesystem %s (mounted on %s)\n", device, mnt_major, mnt_minor, mnt->mnt_fsname, mnt->mnt_dir); return true; } return false; } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct mntent *mnt)) { FILE *f = setmntent(MOUNTS, "r"); if (! f) { Log_error("Cannot open %s\n", MOUNTS); return false; } inf->filesystem->object.generation = _statistics.generation; bool mounted = false; struct mntent *mnt; char flags[STRLEN] = {}; while ((mnt = getmntent(f))) { // Scan all entries for overlay mounts (common for rootfs) if (compare(path, mnt)) { snprintf(inf->filesystem->object.device, sizeof(inf->filesystem->object.device), "%s", mnt->mnt_fsname); snprintf(inf->filesystem->object.mountpoint, sizeof(inf->filesystem->object.mountpoint), "%s", mnt->mnt_dir); snprintf(inf->filesystem->object.type, sizeof(inf->filesystem->object.type), "%s", mnt->mnt_type); snprintf(flags, sizeof(flags), "%s", mnt->mnt_opts); inf->filesystem->object.getDiskUsage = _getDiskUsage; // The disk usage method is common for all filesystem types inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; // Set to dummy IO statistics method by default (can be overridden below if statistics method is available for this filesystem) // Get the major and minor device number _getDeviceNumbers(inf->filesystem->object.device, &(inf->filesystem->object.number.major), &(inf->filesystem->object.number.minor)); // Set filesystem-dependent callbacks if (Str_startsWith(mnt->mnt_type, "nfs")) { // NFS inf->filesystem->object.getDiskActivity = _getNfsDiskActivity; } else if (IS(mnt->mnt_type, "cifs")) { // CIFS inf->filesystem->object.getDiskActivity = _statistics.getCifsDiskActivity; // Need Windows style name - replace '/' with '\' so we can lookup the filesystem activity in /proc/fs/cifs/Stats snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "%s", inf->filesystem->object.device); Str_replaceChar(inf->filesystem->object.key, '/', '\\'); } else if (IS(mnt->mnt_type, "zfs")) { // ZFS inf->filesystem->object.getDiskActivity = _getZfsDiskActivity; // Need base zpool name for /proc/spl/kstat/zfs//io lookup: snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "%s", inf->filesystem->object.device); Str_replaceChar(inf->filesystem->object.key, '/', 0); } else { if (realpath(mnt->mnt_fsname, inf->filesystem->object.key)) { // Need base name for /sys/class/block//stat or /proc/diskstats lookup: snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "%s", File_basename(inf->filesystem->object.key)); // Test if block device statistics are available for the given filesystem if (_statistics.getBlockDiskActivity(inf)) { // Block device inf->filesystem->object.getDiskActivity = _statistics.getBlockDiskActivity; } } } mounted = true; } } endmntent(f); inf->filesystem->object.mounted = mounted; if (! mounted) { Log_error("Lookup for '%s' filesystem failed -- not found in %s\n", path, MOUNTS); } else { // Store the flags value at the end. The same filesystem may have overlay mounts (with different flags), we don't want to corrupt the flags in the monit status, until we find the (last) matching filesystem Util_swapFilesystemFlags(&(inf->filesystem->flags)); snprintf(inf->filesystem->flags.current, sizeof(inf->filesystem->flags.value[0]), "%s", flags); } return mounted; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct mntent *mnt)) { // Mount/unmount notification: open the /proc/self/mounts file if we're in daemon mode and keep it open until monit // stops, so we can poll for mount table changes // FIXME: when libev is added register the mount table handler in libev and stop polling here if (_statistics.fd == -1 && (Run.flags & Run_Daemon) && ! (Run.flags & Run_Once)) { _statistics.fd = open(MOUNTS, O_RDONLY); } if (_statistics.fd != -1) { int rv; struct pollfd mountNotify = {.fd = _statistics.fd, .events = POLLPRI, .revents = 0}; do { rv = poll(&mountNotify, 1, 0); } while (rv == -1 && errno == EINTR); if (rv != -1) { if (mountNotify.revents & POLLERR) { DEBUG("Mount table change detected\n"); _statistics.generation++; } } else { Log_error("Mount table polling failed -- %s\n", STRERROR); } } if (inf->filesystem->object.generation != _statistics.generation || _statistics.fd == -1) { DEBUG("Reloading mount information for filesystem '%s'\n", path); _setDevice(inf, path, compare); } else { strncpy(inf->filesystem->flags.previous, inf->filesystem->flags.current, sizeof(inf->filesystem->flags.value[0])); } if (inf->filesystem->object.mounted) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* --------------------------------------- Static constructor and destructor */ static void __attribute__ ((constructor)) _constructor(void) { struct stat sb; _statistics.fd = -1; _statistics.generation++; // First generation _statistics.getBlockDiskActivity = stat("/sys/class/block", &sb) == 0 ? _getSysfsBlockDiskActivity : _getProcfsBlockDiskActivity; _statistics.getCifsDiskActivity = stat(CIFSSTAT, &sb) == 0 ? _getCifsDiskActivity : _getDummyDiskActivity; } static void __attribute__ ((destructor)) _destructor(void) { if (_statistics.fd > -1) { close(_statistics.fd); } } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/sysdep_UNKNOWN.c0000644000016400001720000000313615007061157014575 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #include "monit.h" #include "device.h" /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); Log_error("Unsupported filesystem data collection method\n"); return false; } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); Log_error("Unsupported filesystem data collection method\n"); return false; } monit-5.35.2/src/device/device_common.c0000644000016400001720000001205415007061157014655 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System independent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "monit.h" #include "device.h" bool filesystem_usage(Service_T s) { assert(s); struct stat sb; bool rv = false; int st = lstat(s->path, &sb); if (st == 0) { if (S_ISLNK(sb.st_mode)) { // Symbolic link: dereference char buf[PATH_MAX] = {}; if (! realpath(s->path, buf)) { Log_error("Cannot dereference filesystem '%s' (symlink) -- %s\n", s->path, STRERROR); return false; } st = stat(buf, &sb); } } if (st != 0) { // The path string is not existing block/character device nor mountpoint - could be: // 1. either a filesystem connection string such as NFS/CIFS/SSHFS path // 2. or it is mountpoint which doesn't exist (subdirectory of parent filesystem which is not mounted itself or the mountpoint was deleted) // 3. or it is a hotplug device which was unconfigured from the system // Try to use the Filesystem_getByDevice() which will find case #1 above and keep the error for cases #2 and #3 if (Filesystem_getByDevice(&(s->inf), s->path)) { // If the device connection string was found, get uid/gid/mode of the mountpoint (connection string itself cannot be stated) if (stat(s->inf.filesystem->object.mountpoint, &sb) == 0) { rv = true; } } } else { char buf[PATH_MAX] = {}; if (realpath(s->path, buf)) { if (S_ISDIR(sb.st_mode)) { // Directory -> mountpoint rv = Filesystem_getByMountpoint(&(s->inf), buf); } else if (S_ISBLK(sb.st_mode) || S_ISCHR(sb.st_mode)) { // Block or character device rv = Filesystem_getByDevice(&(s->inf), buf); } } } if (rv) { s->inf.filesystem->mode = sb.st_mode; s->inf.filesystem->uid = sb.st_uid; s->inf.filesystem->gid = sb.st_gid; s->inf.filesystem->f_filesused = s->inf.filesystem->f_filesfree > 0 ? s->inf.filesystem->f_files - s->inf.filesystem->f_filesfree : s->inf.filesystem->f_files; s->inf.filesystem->f_blocksused = s->inf.filesystem->f_blocks - s->inf.filesystem->f_blocksfreetotal; s->inf.filesystem->inode_percent = s->inf.filesystem->f_files > 0 ? 100. * (double)s->inf.filesystem->f_filesused / (double)s->inf.filesystem->f_files : 0.; s->inf.filesystem->space_percent = s->inf.filesystem->f_blocks > 0 ? 100. * (double)s->inf.filesystem->f_blocksused / (double)s->inf.filesystem->f_blocks : 0.; } else { Statistics_reset(&(s->inf.filesystem->read.bytes)); Statistics_reset(&(s->inf.filesystem->read.operations)); Statistics_reset(&(s->inf.filesystem->write.bytes)); Statistics_reset(&(s->inf.filesystem->write.operations)); Statistics_reset(&(s->inf.filesystem->time.read)); Statistics_reset(&(s->inf.filesystem->time.write)); Statistics_reset(&(s->inf.filesystem->time.wait)); Statistics_reset(&(s->inf.filesystem->time.run)); Log_error("Filesystem '%s' not mounted\n", s->path); } return rv; } monit-5.35.2/src/device/sysdep_SOLARIS.c0000644000016400001720000003612115007061157014552 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_KSTAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STATVFS_H #include #endif #ifdef HAVE_SYS_MNTENT_H #include #endif #ifdef HAVE_SYS_MNTTAB_H #include #endif #ifdef HAVE_LIBZFS_H #include #endif #ifdef HAVE_NVPAIR_H #include #endif #ifdef HAVE_FS_ZFS_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ #define PATHTOINST "/etc/path_to_inst" static struct { int generation; // Increment each time the mount table is changed unsigned long long timestamp; // /etc/mnttab timestamp [ms] (changed on mount/unmount) } _statistics = {}; /* ----------------------------------------------------------------- Private */ static bool _getDummyDiskActivity(__attribute__ ((unused)) void *_inf) { return true; } static bool _getZfsDiskActivity(void *_inf) { Info_T inf = _inf; bool rv = false; libzfs_handle_t *z = libzfs_init(); libzfs_print_on_error(z, 1); zpool_handle_t *zp = zpool_open_canfail(z, inf->filesystem->object.key); if (zp) { nvlist_t *zpoolConfig = zpool_get_config(zp, NULL); nvlist_t *zpoolVdevTree = NULL; if (nvlist_lookup_nvlist(zpoolConfig, ZPOOL_CONFIG_VDEV_TREE, &zpoolVdevTree) == 0) { vdev_stat_t *zpoolStatistics = NULL; uint_t zpoolStatisticsCount = 0; if (nvlist_lookup_uint64_array(zpoolVdevTree, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&zpoolStatistics, &zpoolStatisticsCount) == 0) { //FIXME: if the zpool state has error, trigger the fs event, can also report number of read/write/checksum errors (see vdev_stat_t in /usr/include/sys/fs/zfs.h) DEBUG("ZFS pool '%s' state: %s\n", inf->filesystem->object.key, zpool_state_to_name(zpoolStatistics->vs_state, zpoolStatistics->vs_aux)); unsigned long long now = Time_milli(); Statistics_update(&(inf->filesystem->read.bytes), now, zpoolStatistics->vs_bytes[ZIO_TYPE_READ]); Statistics_update(&(inf->filesystem->write.bytes), now, zpoolStatistics->vs_bytes[ZIO_TYPE_WRITE]); Statistics_update(&(inf->filesystem->read.operations), now, zpoolStatistics->vs_ops[ZIO_TYPE_READ]); Statistics_update(&(inf->filesystem->write.operations), now, zpoolStatistics->vs_ops[ZIO_TYPE_WRITE]); rv = true; } } zpool_close(zp); } libzfs_fini(z); return rv; } static bool _getKstatDiskActivity(void *_inf) { Info_T inf = _inf; bool rv = false; kstat_ctl_t *kctl = kstat_open(); if (kctl) { kstat_t *kstat; for (kstat = kctl->kc_chain; kstat; kstat = kstat->ks_next) { if (kstat->ks_type == KSTAT_TYPE_IO && kstat->ks_instance == inf->filesystem->object.instance && IS(kstat->ks_module, inf->filesystem->object.module) && IS(kstat->ks_name, inf->filesystem->object.key)) { static kstat_io_t kio; if (kstat_read(kctl, kstat, &kio) == -1) { Log_error("filesystem statistics error: kstat_read failed -- %s\n", STRERROR); } else { unsigned long long now = Time_milli(); Statistics_update(&(inf->filesystem->read.bytes), now, kio.nread); Statistics_update(&(inf->filesystem->write.bytes), now, kio.nwritten); Statistics_update(&(inf->filesystem->read.operations), now, kio.reads); Statistics_update(&(inf->filesystem->write.operations), now, kio.writes); Statistics_update(&(inf->filesystem->time.wait), now, kio.wtime / 1000000.); Statistics_update(&(inf->filesystem->time.run), now, kio.rtime / 1000000.); rv = true; } } } kstat_close(kctl); } return rv; } static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statvfs usage; if (statvfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } int size = usage.f_frsize ? (usage.f_bsize / usage.f_frsize) : 1; inf->filesystem->f_bsize = usage.f_bsize; inf->filesystem->f_blocks = usage.f_blocks / size; inf->filesystem->f_blocksfree = usage.f_bavail / size; inf->filesystem->f_blocksfreetotal = usage.f_bfree / size; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _compareMountpoint(const char *mountpoint, struct extmnttab *mnt) { return IS(mountpoint, mnt->mnt_mountp); } static bool _compareDevice(const char *device, struct extmnttab *mnt) { char target[PATH_MAX] = {}; return (IS(device, mnt->mnt_special) || (realpath(mnt->mnt_special, target) && IS(device, target))); } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct extmnttab *mnt)) { FILE *f = fopen(MNTTAB, "r"); if (! f) { Log_error("Cannot open %s\n", MNTTAB); return false; } resetmnttab(f); struct extmnttab mnt; bool rv = false; inf->filesystem->object.generation = _statistics.generation; while (getextmntent(f, &mnt, sizeof(struct extmnttab)) == 0) { if (compare(path, &mnt)) { strncpy(inf->filesystem->object.device, mnt.mnt_special, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mnt.mnt_mountp, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mnt.mnt_fstype, sizeof(inf->filesystem->object.type) - 1); inf->filesystem->object.getDiskUsage = _getDiskUsage; // The disk usage method is common for all filesystem types Util_swapFilesystemFlags(&(inf->filesystem->flags)); snprintf(inf->filesystem->flags.current, sizeof(inf->filesystem->flags.value[0]), "%s", mnt.mnt_mntopts); if (Str_startsWith(mnt.mnt_fstype, MNTTYPE_NFS)) { strncpy(inf->filesystem->object.module, "nfs", sizeof(inf->filesystem->object.module) - 1); snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "nfs%d", mnt.mnt_minor); inf->filesystem->object.instance = mnt.mnt_minor; inf->filesystem->object.getDiskActivity = _getKstatDiskActivity; rv = true; } else if (IS(mnt.mnt_fstype, MNTTYPE_ZFS)) { strncpy(inf->filesystem->object.module, "zfs", sizeof(inf->filesystem->object.module) - 1); char *slash = strchr(mnt.mnt_special, '/'); if (slash) strncpy(inf->filesystem->object.key, mnt.mnt_special, slash - mnt.mnt_special); else strncpy(inf->filesystem->object.key, mnt.mnt_special, sizeof(inf->filesystem->object.key) - 1); inf->filesystem->object.getDiskActivity = _getZfsDiskActivity; rv = true; } else if (IS(mnt.mnt_fstype, MNTTYPE_UFS)) { char special[PATH_MAX]; if (! realpath(mnt.mnt_special, special)) { // If the file doesn't exist it's a virtual filesystem -> ENOENT doesn't mean error if (errno != ENOENT && errno != ENOTDIR) Log_error("Lookup for '%s' filesystem failed -- %s\n", path, STRERROR); } else if (! Str_startsWith(special, "/devices/")) { Log_error("Lookup for '%s' filesystem -- invalid device %s\n", path, special); } else { // Strip "/devices" prefix and :X partition postfix: /devices/pci@0,0/pci15ad,1976@10/sd@0,0:a -> /pci@0,0/pci15ad,1976@10/sd@0,0 int speclen = strlen(special); int devlen = strlen("/devices"); int len = speclen - devlen - 2; inf->filesystem->object.partition = *(special + speclen - 1); memmove(special, special + devlen, len); special[len] = 0; char line[PATH_MAX] = {}; FILE *pti = fopen(PATHTOINST, "r"); if (! pti) { Log_error("Cannot open %s\n", PATHTOINST); } else { while (fgets(line, sizeof(line), pti)) { char path[1024] = {}; if (sscanf(line, "\"%1023[^\"]\" %d \"%255[^\"]\"", path, &(inf->filesystem->object.instance), inf->filesystem->object.module) == 3) { if (IS(path, special)) { if (IS(inf->filesystem->object.module, "cmdk")) { // the "common disk driver" has no "partition" iostat class, only whole "disk" (at least on Solaris 10) snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "%s%d", inf->filesystem->object.module, inf->filesystem->object.instance); } else { // use partition for other drivers snprintf(inf->filesystem->object.key, sizeof(inf->filesystem->object.key), "%s%d,%c", inf->filesystem->object.module, inf->filesystem->object.instance, inf->filesystem->object.partition); } inf->filesystem->object.getDiskActivity = _getKstatDiskActivity; rv = true; break; } } } fclose(pti); } } } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; rv = true; } fclose(f); inf->filesystem->object.mounted = rv; return rv; } } Log_error("Lookup for '%s' filesystem failed -- not found in %s\n", path, MNTTAB); fclose(f); inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct extmnttab *mnt)) { struct stat sb; if (stat(MNTTAB, &sb) != 0 || _statistics.timestamp != (unsigned long long)((double)sb.st_mtim.tv_sec * 1000. + (double)sb.st_mtim.tv_nsec / 1000000.)) { DEBUG("Mount notification: change detected\n"); _statistics.timestamp = (double)sb.st_mtim.tv_sec * 1000. + (double)sb.st_mtim.tv_nsec / 1000000.; _statistics.generation++; // Increment, so all other filesystems can see the generation has changed } if (inf->filesystem->object.generation != _statistics.generation) { _setDevice(inf, path, compare); // The mount table has changed => refresh } if (inf->filesystem->object.mounted) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/sysdep_OPENBSD.c0000644000016400001720000002510415007061157014527 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #include #endif #ifdef HAVE_SYS_DISK_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { unsigned long long timestamp; size_t diskCount; size_t diskLength; struct diskstats *disk; } _statistics = {}; /* ------------------------------------------------------- Static destructor */ static void __attribute__ ((destructor)) _destructor() { FREE(_statistics.disk); } /* ----------------------------------------------------------------- Private */ static unsigned long long _timevalToMilli(struct timeval *time) { return time->tv_sec * 1000 + time->tv_usec / 1000.; } // Parse the device path like /dev/sd0a -> sd0 static bool _parseDevice(const char *path, Device_T device) { const char *base = File_basename(path); for (ssize_t len = strlen(base), i = len - 1; i >= 0; i--) { if (isdigit(*(base + i))) { strncpy(device->key, base, i + 1 < (ssize_t)sizeof(device->key) ? i + 1 : (ssize_t)sizeof(device->key) - 1); return true; } } return false; } static bool _getStatistics(unsigned long long now) { // Refresh only if the statistics are older then 1 second (handle also backward time jumps) if (now > _statistics.timestamp + 1000 || now < _statistics.timestamp - 1000) { ssize_t len = sizeof(_statistics.diskCount); int mib[2] = {CTL_HW, HW_DISKCOUNT}; if (sysctl(mib, 2, &(_statistics.diskCount), &len, NULL, 0) == -1) { Log_error("filesystem statistic error -- cannot get disks count: %s\n", STRERROR); return false; } len = _statistics.diskCount * sizeof(struct diskstats); if ((ssize_t)_statistics.diskLength != len) { _statistics.diskLength = len; RESIZE(_statistics.disk, len); } mib[1] = HW_DISKSTATS; if (sysctl(mib, 2, _statistics.disk, &(_statistics.diskLength), NULL, 0) == -1) { Log_error("filesystem statistic error -- cannot get disks statistics: %s\n", STRERROR); return false; } _statistics.timestamp = now; } return true; } static bool _getDummyDiskActivity(__attribute__ ((unused)) void *_inf) { return true; } static bool _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; unsigned long long now = Time_milli(); bool rv = _getStatistics(now); if (rv) { for (size_t i = 0; i < _statistics.diskCount; i++) { if (Str_isEqual(inf->filesystem->object.key, _statistics.disk[i].ds_name)) { Statistics_update(&(inf->filesystem->read.bytes), now, _statistics.disk[i].ds_rbytes); Statistics_update(&(inf->filesystem->write.bytes), now, _statistics.disk[i].ds_wbytes); Statistics_update(&(inf->filesystem->read.operations), now, _statistics.disk[i].ds_rxfer); Statistics_update(&(inf->filesystem->write.operations), now, _statistics.disk[i].ds_wxfer); Statistics_update(&(inf->filesystem->time.run), now, _timevalToMilli(&(_statistics.disk[i].ds_time))); break; } } } return rv; } static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_bsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static bool _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, unsigned long long flags) { struct mystable { unsigned long long flag; char *description; } t[]= { {MNT_RDONLY, "ro"}, {MNT_SYNCHRONOUS, "synchronous"}, {MNT_NOEXEC, "noexec"}, {MNT_NOSUID, "nosuid"}, {MNT_NODEV, "nodev"}, {MNT_WXALLOWED, "wxallowed"}, {MNT_ASYNC, "async"}, {MNT_NOATIME, "noatime"}, {MNT_EXRDONLY, "exported read only"}, {MNT_EXPORTED, "exported"}, {MNT_DEFEXPORTED, "exported to the world"}, {MNT_EXPORTANON, "anon uid mapping"}, {MNT_LOCAL, "local"}, {MNT_QUOTA, "quota"}, {MNT_ROOTFS, "rootfs"} }; Util_swapFilesystemFlags(&(inf->filesystem->flags)); for (size_t i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags.current + strlen(inf->filesystem->flags.current), sizeof(inf->filesystem->flags.value[0]) - strlen(inf->filesystem->flags.current) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs > 0) { struct statfs *mnt = CALLOC(countfs, sizeof(struct statfs)); if ((countfs = getfsstat(mnt, countfs * sizeof(struct statfs), MNT_NOWAIT)) != -1) { for (int i = 0; i < countfs; i++) { struct statfs *mntItem = mnt + i; if (compare(path, mntItem)) { if (IS(mntItem->f_fstypename, "ffs")) { if (_parseDevice(mntItem->f_mntfromname, &(inf->filesystem->object))) { inf->filesystem->object.getDiskActivity = _getBlockDiskActivity; } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; DEBUG("I/O monitoring for filesystem '%s' skipped - unable to parse the device %s", path, mntItem->f_mntfromname); } } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } inf->filesystem->object.flags = mntItem->f_flags & MNT_VISFLAGMASK; _filesystemFlagsToString(inf, inf->filesystem->object.flags); strncpy(inf->filesystem->object.device, mntItem->f_mntfromname, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mntItem->f_mntonname, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mntItem->f_fstypename, sizeof(inf->filesystem->object.type) - 1); inf->filesystem->object.getDiskUsage = _getDiskUsage; inf->filesystem->object.mounted = true; FREE(mnt); return true; } } } FREE(mnt); } Log_error("Lookup for '%s' filesystem failed\n", path); inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/device/sysdep_DRAGONFLY.c0000644000016400001720000002600115007061157014757 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ /** * System dependent filesystem methods. * * @file */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #if defined HAVE_SYS_UCRED_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_KVM_H #include #endif #ifdef HAVE_PATHS_H #include #endif #ifdef HAVE_DEVSTAT_H #include #endif #include "monit.h" #include "device.h" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { unsigned long long timestamp; struct statinfo disk; } _statistics = {}; /* --------------------------------------- Static constructor and destructor */ static void __attribute__ ((constructor)) _constructor() { _statistics.disk.dinfo = CALLOC(1, sizeof(struct devinfo)); } static void __attribute__ ((destructor)) _destructor() { FREE(_statistics.disk.dinfo); } /* ----------------------------------------------------------------- Private */ static unsigned long long _timevalToMilli(struct timeval *time) { return time->tv_sec * 1000 + time->tv_usec / 1000.; } // Parse the device path like /dev/da0p2 into name:instance -> da:0 static bool _parseDevice(const char *path, Device_T device) { const char *base = File_basename(path); for (int i = 0; base[i]; i++) { if (isdigit(*(base + i))) { strncpy(device->key, base, i < sizeof(device->key) ? i : sizeof(device->key) - 1); device->instance = Str_parseInt(base + i); return true; } } Log_error("filesystem statistics error -- cannot parse device '%s'\n", path); return false; } static bool _getStatistics(unsigned long long now) { // Refresh only if the statistics are older then 1 second (handle also backward time jumps) if (now > _statistics.timestamp + 1000 || now < _statistics.timestamp - 1000) { if (getdevs(&(_statistics.disk)) == -1) { Log_error("filesystem statistics error -- devstat_getdevs: %s\n", devstat_errbuf); return false; } _statistics.timestamp = now; } return true; } static bool _getDummyDiskActivity(void *_inf) { return true; } static bool _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; unsigned long long now = Time_milli(); bool rv = _getStatistics(now); if (rv) { for (int i = 0; i < _statistics.disk.dinfo->numdevs; i++) { if (_statistics.disk.dinfo->devices[i].unit_number == inf->filesystem->object.instance && IS(_statistics.disk.dinfo->devices[i].device_name, inf->filesystem->object.key)) { unsigned long long now = Time_milli(); Statistics_update(&(inf->filesystem->read.bytes), now, _statistics.disk.dinfo->devices[i].bytes_read); Statistics_update(&(inf->filesystem->read.operations), now, _statistics.disk.dinfo->devices[i].num_reads); Statistics_update(&(inf->filesystem->write.bytes), now, _statistics.disk.dinfo->devices[i].bytes_written); Statistics_update(&(inf->filesystem->write.operations), now, _statistics.disk.dinfo->devices[i].num_writes); Statistics_update(&(inf->filesystem->time.run), now, _timevalToMilli(&(_statistics.disk.dinfo->devices[i].busy_time))); break; } } } return rv; } static bool _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { Log_error("Error getting usage statistics for filesystem '%s' -- %s\n", inf->filesystem->object.mountpoint, STRERROR); return false; } inf->filesystem->f_bsize = usage.f_bsize; inf->filesystem->f_blocks = usage.f_blocks; inf->filesystem->f_blocksfree = usage.f_bavail; inf->filesystem->f_blocksfreetotal = usage.f_bfree; inf->filesystem->f_files = usage.f_files; inf->filesystem->f_filesfree = usage.f_ffree; return true; } static bool _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static bool _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, unsigned long long flags) { struct mystable { unsigned long long flag; char *description; } t[]= { {MNT_ASYNC, "async"}, {MNT_NOATIME, "noatime"}, {MNT_NODEV, "nodev"}, {MNT_NOEXEC, "noexec"}, {MNT_NOSUID, "nosuid"}, {MNT_NOSYMFOLLOW, "nosymfollow"}, {MNT_TRIM, "trim"}, {MNT_RDONLY, "rdonly"}, {MNT_SYNCHRONOUS, "sync"}, {MNT_NOCLUSTERR, "noclusterr"}, {MNT_NOCLUSTERW, "noclusterw"}, {MNT_SUIDDIR, "suiddir"}, {MNT_AUTOMOUNTED, "automounted"}, {MNT_IGNORE, "ignore"}, {MNT_SOFTDEP, "soft updates"}, {MNT_NOSYMFOLLOW, "nosymfollow"}, {MNT_EXRDONLY, "exported read only"}, {MNT_EXPORTED, "exported"}, {MNT_DEFEXPORTED, "exported to the world"}, {MNT_EXPORTANON, "anon uid mapping"}, {MNT_EXKERB, "exported with kerberos"}, {MNT_EXPUBLIC, "public export"}, {MNT_LOCAL, "local"}, {MNT_QUOTA, "quota"}, {MNT_ROOTFS, "rootfs"}, {MNT_USER, "user"} }; Util_swapFilesystemFlags(&(inf->filesystem->flags)); for (int i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags.current + strlen(inf->filesystem->flags.current), sizeof(inf->filesystem->flags.value[0]) - strlen(inf->filesystem->flags.current) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static bool _setDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs > 0) { struct statfs *mnt = CALLOC(countfs, sizeof(struct statfs)); if ((countfs = getfsstat(mnt, countfs * sizeof(struct statfs), MNT_NOWAIT)) != -1) { for (int i = 0; i < countfs; i++) { struct statfs *mntItem = mnt + i; if (compare(path, mntItem)) { if (IS(mntItem->f_fstypename, "ufs")) { if (_parseDevice(mntItem->f_mntfromname, &(inf->filesystem->object))) { inf->filesystem->object.getDiskActivity = _getBlockDiskActivity; } else { inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; DEBUG("I/O monitoring for filesystem '%s' skipped - unable to parse the device %s", path, mntItem->f_mntfromname); } } else { //FIXME: add HAMMER support inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } inf->filesystem->object.flags = mntItem->f_flags & MNT_VISFLAGMASK; _filesystemFlagsToString(inf, inf->filesystem->object.flags); strncpy(inf->filesystem->object.device, mntItem->f_mntfromname, sizeof(inf->filesystem->object.device) - 1); strncpy(inf->filesystem->object.mountpoint, mntItem->f_mntonname, sizeof(inf->filesystem->object.mountpoint) - 1); strncpy(inf->filesystem->object.type, mntItem->f_fstypename, sizeof(inf->filesystem->object.type) - 1); inf->filesystem->object.getDiskUsage = _getDiskUsage; inf->filesystem->object.mounted = true; FREE(mnt); return true; } } } FREE(mnt); } Log_error("Lookup for '%s' filesystem failed\n", path); error: inf->filesystem->object.mounted = false; return false; } static bool _getDevice(Info_T inf, const char *path, bool (*compare)(const char *path, struct statfs *mnt)) { if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ bool Filesystem_getByMountpoint(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareMountpoint); } bool Filesystem_getByDevice(Info_T inf, const char *path) { assert(inf); assert(path); return _getDevice(inf, path, _compareDevice); } monit-5.35.2/src/http/0000755000016400001720000000000015007061157011500 500000000000000monit-5.35.2/src/http/processor.h0000644000016400001720000000630415007061157013613 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef PROCESSOR_H #define PROCESSOR_H #include "config.h" #include #include "monit.h" #include "httpstatus.h" /* Server masquerade */ #define SERVER_NAME "monit" #define SERVER_VERSION VERSION #define SERVER_URL "https://mmonit.com/monit/" #define SERVER_PROTOCOL "HTTP/1.0" #define DATEFMT "%a, %d %b %Y %H:%M:%S GMT" /* Protocol methods supported */ #define METHOD_GET "GET" #define METHOD_POST "POST" /* Initial buffer sizes */ #define STRLEN 256 #define REQ_STRLEN 8192 #define RES_STRLEN 2048 #define MAX_URL_LENGTH 512 /* Request timeout in seconds */ #define REQUEST_TIMEOUT 30 struct entry { char *name; char *value; /* For internal use */ struct entry *next; }; typedef struct entry *HttpHeader; typedef struct entry *HttpParameter; typedef struct request { char *url; Socket_T S; char *method; char *protocol; char *pathinfo; char *remote_user; HttpHeader headers; HttpParameter params; Ssl_T ssl; } *HttpRequest; typedef struct response { int status; Socket_T S; const char *protocol; bool is_committed; HttpHeader headers; const char *status_msg; StringBuffer_T outputbuffer; MD_T token; Ssl_T ssl; } *HttpResponse; /* Public prototypes */ void *http_processor(Socket_T); char *get_headers(HttpResponse res); void set_status(HttpResponse res, int status); const char *get_status_string(int status_code); void add_Impl(void(*doGet)(HttpRequest, HttpResponse), void(*doPost)(HttpRequest, HttpResponse)); void set_content_type(HttpResponse res, const char *mime); const char *get_header(HttpRequest req, const char *header_name); StringBuffer_T escapeHTML(StringBuffer_T sb, const char *s); void send_error(HttpRequest, HttpResponse, int status, const char *message, ...) __attribute__((format (printf, 4, 5))); const char *get_parameter(HttpRequest req, const char *parameter_name); void set_header(HttpResponse res, const char *name, const char *value, ...) __attribute__((format (printf, 3, 4))); void Processor_setHttpPostLimit(void); #endif monit-5.35.2/src/http/client.c0000644000016400001720000002155015007061157013045 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "monit.h" #include "device.h" #include "TextColor.h" #include "TextBox.h" #include "httpstatus.h" #include "client.h" // libmonit #include "exceptions/AssertException.h" #include "exceptions/IOException.h" /** * The monit HTTP GUI client * * @file */ /* ----------------------------------------------------------------- Private */ static void _argument(StringBuffer_T data, const char *name, const char *value) { char *_value = Util_urlEncode(value, true); StringBuffer_append(data, "%s%s=%s", StringBuffer_length(data) ? "&" : "", name, _value); FREE(_value); } static char *_getBasicAuthHeader(void) { Auth_T auth = NULL; // Find the first cleartext credential for authorization for (Auth_T c = Run.httpd.credentials; c; c = c->next) { if (c->digesttype == Digest_Cleartext) { if (! auth || auth->is_readonly) { auth = c; } } } if (auth) return Util_getBasicAuthHeader(auth->uname, auth->passwd); return NULL; } static void _parseHttpResponse(Socket_T S) { char buf[1024]; if (! Socket_readLine(S, buf, sizeof(buf))) THROW(IOException, "Error receiving data -- %s", STRERROR); Str_chomp(buf); int status; if (! sscanf(buf, "%*s %d", &status)) THROW(IOException, "Cannot parse status in response: %s", buf); if (status < 300 || status == SC_MOVED_TEMPORARILY) { // Skip HTTP headers while (Socket_readLine(S, buf, sizeof(buf))) { if (! strncmp(buf, "\r\n", sizeof(buf))) break; } } else { int content_length = 0; // Read HTTP headers while (Socket_readLine(S, buf, sizeof(buf))) { if (! strncmp(buf, "\r\n", sizeof(buf))) break; if (Str_startsWith(buf, "Content-Length") && ! sscanf(buf, "%*s%*[: ]%d", &content_length)) THROW(IOException, "Invalid Content-Length header: %s", buf); } // Parse error response char *message = NULL; if (content_length > 0 && content_length < 1024 && Socket_readLine(S, buf, sizeof(buf))) { char token[] = ""; message = strstr(buf, token); if (message && strlen(message) > strlen(token)) { message += strlen(token); char *footer = NULL; if ((footer = strstr(message, "

")) || (footer = strstr(message, "


"))) *footer = 0; } } THROW(AssertException, "%s", message ? message : "cannot parse response"); } } static void _send(Socket_T S, const char *request, StringBuffer_T data) { _argument(data, "format", "text"); char *_auth = _getBasicAuthHeader(); MD_T token; StringBuffer_append(data, "%ssecuritytoken=%s", StringBuffer_length(data) > 0 ? "&" : "", Util_getToken(token)); int rv = Socket_print(S, "POST %s HTTP/1.0\r\n" "Content-Type: application/x-www-form-urlencoded\r\n" "Cookie: securitytoken=%s\r\n" "Content-Length: %d\r\n" "%s" "\r\n" "%s", request, token, StringBuffer_length(data), _auth ? _auth : "", StringBuffer_toString(data)); FREE(_auth); if (rv < 0) THROW(IOException, "Monit: cannot send command to the monit daemon -- %s", STRERROR); } static void _receive(Socket_T S) { char buf[1024]; _parseHttpResponse(S); bool strip = (Run.flags & Run_Batch || ! TextColor_support()) ? true : false; while (Socket_readLine(S, buf, sizeof(buf))) { if (strip) TextColor_strip(TextBox_strip(buf)); printf("%s", buf); } } static bool _client(const char *request, StringBuffer_T data) { volatile bool status = false; if (! exist_daemon()) { Log_error("Monit: the monit daemon is not running\n"); return status; } Socket_T S = NULL; // Connect via http if enabled except if set readonly and a unix socket was configured not readonly if ((Run.httpd.flags & Httpd_Net) && !(Run.httpd.socket.net.readonly && (Run.httpd.flags & Httpd_Unix) && !Run.httpd.socket.unix.readonly)) { S = Socket_create(Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "localhost", Run.httpd.socket.net.port, Socket_Tcp, Socket_Ip, &(Run.httpd.socket.net.ssl), Run.limits.networkTimeout); } else if (Run.httpd.flags & Httpd_Unix) { S = Socket_createUnix(Run.httpd.socket.unix.path, Socket_Tcp, Run.limits.networkTimeout); } else { Log_error("Monit: the monit HTTP interface is not enabled, please add the 'set httpd' statement and use the 'allow' option to allow monit to connect\n"); } if (S) { TRY { _send(S, request, data); _receive(S); status = true; } ELSE { Log_error("%s\n", Exception_frame.message); } END_TRY; Socket_free(&S); } return status; } /* ------------------------------------------------------------------ Public */ bool HttpClient_action(const char *action, List_T services) { assert(services); assert(action); if (Util_getAction(action) == Action_Ignored) { Log_error("Invalid action %s\n", action); return false; } StringBuffer_T data = StringBuffer_create(64); _argument(data, "action", action); for (_list_t s = services->head; s; s = s->next) _argument(data, "service", s->e); bool rv = _client("/_doaction", data); StringBuffer_free(&data); return rv; } bool HttpClient_report(const char *group, const char *type) { StringBuffer_T data = StringBuffer_create(64); if (STR_DEF(group)) _argument(data, "group", group); if (STR_DEF(type)) _argument(data, "type", type); bool rv = _client("/_report", data); StringBuffer_free(&data); return rv; } bool HttpClient_status(const char *group, const char *service) { StringBuffer_T data = StringBuffer_create(64); if (STR_DEF(service)) _argument(data, "service", service); if (STR_DEF(group)) _argument(data, "group", group); bool rv = _client("/_status", data); StringBuffer_free(&data); return rv; } bool HttpClient_summary(const char *group, const char *service) { StringBuffer_T data = StringBuffer_create(64); if (STR_DEF(service)) _argument(data, "service", service); if (STR_DEF(group)) _argument(data, "group", group); bool rv = _client("/_summary", data); StringBuffer_free(&data); return rv; } monit-5.35.2/src/http/processor.c0000644000016400001720000010302715007061157013606 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_SETJMP_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #include "monit.h" #include "processor.h" #include "base64.h" // libmonit #include "util/Str.h" #include "system/Net.h" /** * A naive quasi HTTP Processor module that can handle HTTP requests * received from a client, and return responses based on those * requests. * * This Processor delegates the actual handling of the request and * response to so called cervlets, which must implement two methods; * doGet and doPost. * * NOTES * This Processor is command oriented and if a second slash '/' is * found in the URL it's assumed to be the PATHINFO. In other words * this processor perceive an URL as: * * /COMMAND?QUERYSTRING/PATHINFO * * The doGet/doPost routines act's on the COMMAND. See the * cervlet.c code in this dir. for an example. * * @file */ static int _httpPostLimit; /* -------------------------------------------------------------- Prototypes */ static void do_service(Socket_T); static void destroy_entry(void *); static char *get_date(char *, int); static char *get_server(char *, int); static bool create_headers(HttpRequest); static void send_response(HttpRequest, HttpResponse); static bool basic_authenticate(HttpRequest); static void done(HttpRequest, HttpResponse); static void destroy_HttpRequest(HttpRequest); static void reset_response(HttpResponse res); static HttpParameter parse_parameters(char *); static bool create_parameters(HttpRequest req); static void destroy_HttpResponse(HttpResponse); static HttpRequest create_HttpRequest(Socket_T); static void internal_error(Socket_T, int, const char *); static HttpResponse create_HttpResponse(Socket_T); static bool is_authenticated(HttpRequest, HttpResponse); static int get_next_token(char *s, int *cursor, char **r); /* * An object for implementors of the service functions; doGet and * doPost. Implementing modules i.e. CERVLETS, must implement the * doGet and doPost functions and the engine will call the add_Impl * function to setup the callback to these functions. */ struct ServiceImpl { void(*doGet)(HttpRequest, HttpResponse); void(*doPost)(HttpRequest, HttpResponse); } Impl; /* ------------------------------------------------------------------ Public */ /** * Process a HTTP request. This is done by dispatching to the service * function. * @param s A Socket_T representing the client connection */ void *http_processor(Socket_T s) { if (! Net_canRead(Socket_getSocket(s), REQUEST_TIMEOUT * 1000)) internal_error(s, SC_REQUEST_TIMEOUT, "Time out when handling the Request"); else do_service(s); Socket_free(&s); return NULL; } /** * Callback for implementors of cervlet functions. * @param doGetFunc doGet function * @param doPostFunc doPost function */ void add_Impl(void(*doGet)(HttpRequest, HttpResponse), void(*doPost)(HttpRequest, HttpResponse)) { Impl.doGet = doGet; Impl.doPost = doPost; } void Processor_setHttpPostLimit(void) { // Base buffer size (space for e.g. "action=") _httpPostLimit = STRLEN; // Add space for each service for (Service_T s = Service_List; s; s = s->next) _httpPostLimit += strlen("&service=") + strlen(s->name); } StringBuffer_T escapeHTML(StringBuffer_T sb, const char *s) { for (int i = 0; s[i]; i++) { if (s[i] == '<') StringBuffer_append(sb, "<"); else if (s[i] == '>') StringBuffer_append(sb, ">"); else if (s[i] == '&') StringBuffer_append(sb, "&"); else StringBuffer_append(sb, "%c", s[i]); } return sb; } /** * Send an error message * @param res HttpResponse object * @param code Error Code to lookup and send * @param msg Optional error message (may be NULL) */ void send_error(HttpRequest req, HttpResponse res, int code, const char *msg, ...) { assert(msg); const char *err = get_status_string(code); reset_response(res); set_content_type(res, "text/html"); set_status(res, code); StringBuffer_append(res->outputbuffer, "" "" "%d %s" "" "" "

%s

", code, err, err); char *message; va_list ap; va_start(ap, msg); message = Str_vcat(msg, ap); va_end(ap); escapeHTML(res->outputbuffer, message); if (code != SC_UNAUTHORIZED) // We log details in basic_authenticate() already, no need to log generic error sent to client here Log_error("HttpRequest: error -- client [%s]: %s %d %s\n", NVLSTR(Socket_getRemoteHost(req->S)), SERVER_PROTOCOL, code, message); FREE(message); char server[STRLEN]; StringBuffer_append(res->outputbuffer, "
" "
%s" "" "" "\r\n", SERVER_URL, get_server(server, STRLEN)); } /* -------------------------------------------------------------- Properties */ /** * Adds a response header with the given name and value. If the header * had already been set the new value overwrites the previous one. * @param res HttpResponse object * @param name Header key name * @param value Header key value */ void set_header(HttpResponse res, const char *name, const char *value, ...) { HttpHeader h = NULL; assert(res); assert(name); NEW(h); h->name = Str_dup(name); va_list ap; va_start(ap, value); h->value = Str_vcat(value, ap); va_end(ap); if (res->headers) { HttpHeader n, p; for (n = p = res->headers; p; n = p, p = p->next) { if (IS(p->name, name)) { FREE(p->value); p->value = Str_dup(h->value); destroy_entry(h); return; } } n->next = h; } else { res->headers = h; } } /** * Sets the status code for the response * @param res HttpResponse object * @param code A HTTP status code <100-510> * @param msg The status code string message */ void set_status(HttpResponse res, int code) { res->status = code; res->status_msg = get_status_string(code); } /** * Set the response content-type * @param res HttpResponse object * @param mime Mime content type, e.g. text/html */ void set_content_type(HttpResponse res, const char *mime) { assert(mime); set_header(res, "Content-Type", "%s", mime); } /** * Returns the value of the specified header * @param req HttpRequest object * @param name Header name to lookup the value for * @return The value of the specified header, NULL if not found */ const char *get_header(HttpRequest req, const char *name) { for (HttpHeader p = req->headers; p; p = p->next) if (IS(p->name, name)) return (p->value); return NULL; } /** * Returns the value of the specified parameter * @param req HttpRequest object * @param name The request parameter key to lookup the value for * @return The value of the specified parameter, or NULL if not found */ const char *get_parameter(HttpRequest req, const char *name) { for (HttpParameter p = req->params; p; p = p->next) if (IS(p->name, name)) return (p->value); return NULL; } /** * Returns a string containing all (extra) headers found in the * response. The headers are newline separated in the returned * string. * @param res HttpResponse object * @return A String containing all headers set in the Response object */ char *get_headers(HttpResponse res) { char buf[RES_STRLEN]; char *b = buf; *buf = 0; for (HttpHeader p = res->headers; (((b - buf) + STRLEN) < RES_STRLEN) && p; p = p->next) b += snprintf(b, STRLEN,"%s: %s\r\n", p->name, p->value); return buf[0] ? Str_dup(buf) : NULL; } /** * Lookup the corresponding HTTP status string for the given status * code * @param status A HTTP status code * @return A default status message for the specified HTTP status * code. */ const char *get_status_string(int status) { switch (status) { case SC_OK: return "OK"; case SC_ACCEPTED: return "Accepted"; case SC_BAD_GATEWAY: return "Bad Gateway"; case SC_BAD_REQUEST: return "Bad Request"; case SC_CONFLICT: return "Conflict"; case SC_CONTINUE: return "Continue"; case SC_CREATED: return "Created"; case SC_EXPECTATION_FAILED: return "Expectation Failed"; case SC_FORBIDDEN: return "Forbidden"; case SC_GATEWAY_TIMEOUT: return "Gateway Timeout"; case SC_GONE: return "Gone"; case SC_VERSION_NOT_SUPPORTED: return "HTTP Version Not Supported"; case SC_INTERNAL_SERVER_ERROR: return "Internal Server Error"; case SC_LENGTH_REQUIRED: return "Length Required"; case SC_METHOD_NOT_ALLOWED: return "Method Not Allowed"; case SC_MOVED_PERMANENTLY: return "Moved Permanently"; case SC_MOVED_TEMPORARILY: return "Moved Temporarily"; case SC_MULTIPLE_CHOICES: return "Multiple Choices"; case SC_NO_CONTENT: return "No Content"; case SC_NON_AUTHORITATIVE: return "Non-Authoritative Information"; case SC_NOT_ACCEPTABLE: return "Not Acceptable"; case SC_NOT_FOUND: return "Not Found"; case SC_NOT_IMPLEMENTED: return "Not Implemented"; case SC_NOT_MODIFIED: return "Not Modified"; case SC_PARTIAL_CONTENT: return "Partial Content"; case SC_PAYMENT_REQUIRED: return "Payment Required"; case SC_PRECONDITION_FAILED: return "Precondition Failed"; case SC_PROXY_AUTHENTICATION_REQUIRED: return "Proxy Authentication Required"; case SC_REQUEST_ENTITY_TOO_LARGE: return "Request Entity Too Large"; case SC_REQUEST_TIMEOUT: return "Request Timeout"; case SC_REQUEST_URI_TOO_LARGE: return "Request URI Too Large"; case SC_RANGE_NOT_SATISFIABLE: return "Requested Range Not Satisfiable"; case SC_RESET_CONTENT: return "Reset Content"; case SC_SEE_OTHER: return "See Other"; case SC_SERVICE_UNAVAILABLE: return "Service Unavailable"; case SC_SWITCHING_PROTOCOLS: return "Switching Protocols"; case SC_UNAUTHORIZED: return "Unauthorized"; case SC_UNSUPPORTED_MEDIA_TYPE: return "Unsupported Media Type"; case SC_USE_PROXY: return "Use Proxy"; default: { return "Unknown HTTP status"; } } } /* ----------------------------------------------------------------- Private */ /** * Receives standard HTTP requests from a client socket and dispatches * them to the doXXX methods defined in a cervlet module. */ static void do_service(Socket_T s) { volatile HttpResponse res = create_HttpResponse(s); volatile HttpRequest req = create_HttpRequest(s); if (res && req) { if (Run.httpd.socket.net.ssl.flags & SSL_Enabled) set_header(res, "Strict-Transport-Security", "max-age=63072000"); if (is_authenticated(req, res)) { set_header(res, "Set-Cookie", "securitytoken=%s; Max-Age=600; HttpOnly; SameSite=strict%s", res->token, (Run.httpd.socket.net.ssl.flags & SSL_Enabled) ? "; Secure" : ""); if (IS(req->method, METHOD_GET)) Impl.doGet(req, res); else if (IS(req->method, METHOD_POST)) Impl.doPost(req, res); else send_error(req, res, SC_NOT_IMPLEMENTED, "Method not implemented"); } send_response(req, res); } done(req, res); } /** * Return a (RFC1123) Date string */ static char *get_date(char *result, int size) { time_t now; struct tm converted; time(&now); if (strftime(result, size, DATEFMT, gmtime_r(&now, &converted)) <= 0) *result = 0; return result; } /** * Return this server name + version */ static char *get_server(char *result, int size) { snprintf(result, size, "%s %s", SERVER_NAME, Run.httpd.flags & Httpd_Signature ? SERVER_VERSION : ""); return result; } /** * Send the response to the client. If the response has already been * committed, this function does nothing. */ static void send_response(HttpRequest req, HttpResponse res) { Socket_T S = res->S; if (! res->is_committed) { char date[STRLEN]; char server[STRLEN]; #ifdef HAVE_LIBZ const char *acceptEncoding = get_header(req, "Accept-Encoding"); bool canCompress = acceptEncoding && Str_sub(acceptEncoding, "gzip"); #else bool canCompress = false; #endif const void *body = NULL; size_t bodyLength = 0; if (canCompress && StringBuffer_length(res->outputbuffer) > 0) { body = StringBuffer_toCompressed(res->outputbuffer, 6, &bodyLength); set_header(res, "Content-Encoding", "gzip"); } else { body = StringBuffer_toString(res->outputbuffer); bodyLength = StringBuffer_length(res->outputbuffer); } char *headers = get_headers(res); res->is_committed = true; get_date(date, STRLEN); get_server(server, STRLEN); Socket_print(S, "%s %d %s\r\n", res->protocol, res->status, res->status_msg); Socket_print(S, "Date: %s\r\n", date); Socket_print(S, "Server: %s\r\n", server); Socket_print(S, "Content-Length: %zu\r\n", bodyLength); Socket_print(S, "Connection: close\r\n"); Socket_print(S, "X-Content-Type-Options: nosniff\r\n"); Socket_print(S, "X-Frame-Options: SAMEORIGIN\r\n"); Socket_print(S, "Content-Security-Policy: frame-ancestors 'self'\r\n"); Socket_print(S, "X-XSS-Protection: 1; mode=block\r\n"); Socket_print(S, "Referrer-Policy: same-origin\r\n"); Socket_print(S, "Permissions-Policy: geolocation=(),camera=(),microphone=()\r\n"); if (headers) Socket_print(S, "%s", headers); Socket_print(S, "\r\n"); if (bodyLength) if(Socket_write(S, body, bodyLength) < 0) Log_error("Http: Cannot send the response -- %s\n", STRERROR); FREE(headers); } } /* --------------------------------------------------------------- Factories */ /** * Returns a new HttpRequest object wrapping the client request */ static HttpRequest create_HttpRequest(Socket_T S) { char line[REQ_STRLEN]; if (Socket_readLine(S, line, sizeof(line)) == NULL) { internal_error(S, SC_BAD_REQUEST, "No request found"); return NULL; } Str_chomp(line); char method[STRLEN]; char url[REQ_STRLEN]; char protocol[STRLEN]; if (sscanf(line, "%255s %1023s HTTP/%3[1.0]", method, url, protocol) != 3) { internal_error(S, SC_BAD_REQUEST, "Cannot parse request"); return NULL; } if (strlen(url) >= MAX_URL_LENGTH) { internal_error(S, SC_BAD_REQUEST, "[error] URL too long"); return NULL; } HttpRequest req = NULL; NEW(req); req->S = S; Util_urlDecode(url); req->url = Str_dup(url); req->method = Str_dup(method); req->protocol = Str_dup(protocol); if (! create_headers(req)) { internal_error(S, SC_BAD_REQUEST, "Headers length exceeds the content limit"); destroy_HttpRequest(req); return NULL; } if (! create_parameters(req)) { internal_error(S, SC_BAD_REQUEST, "Cannot parse Request parameters"); destroy_HttpRequest(req); return NULL; } return req; } /** * Returns a new HttpResponse object wrapping a default response. Use * the set_XXX methods to change the object. */ static HttpResponse create_HttpResponse(Socket_T S) { HttpResponse res = NULL; NEW(res); res->S = S; res->status = SC_OK; res->outputbuffer = StringBuffer_create(256); res->is_committed = false; res->protocol = SERVER_PROTOCOL; res->status_msg = get_status_string(SC_OK); Util_getToken(res->token); return res; } /** * Create HTTP headers for the given request */ static bool create_headers(HttpRequest req) { int contentLength = 0; char line[REQ_STRLEN] = {}; while (Socket_readLine(req->S, line, sizeof(line)) && ! (Str_isEqual(line, "\r\n") || Str_isEqual(line, "\n"))) { contentLength += strlen(line); if (contentLength >= Run.limits.httpContentBuffer) return false; char *value = strchr(line, ':'); if (value) { HttpHeader header = NULL; NEW(header); *value++ = 0; Str_trim(line); Str_trim(value); Str_chomp(value); header->name = Str_dup(line); header->value = Str_dup(value); header->next = req->headers; req->headers = header; } } return true; } /** * Create parameters for the given request. Returns false if an error * occurs. */ static bool create_parameters(HttpRequest req) { char *query_string = NULL; if (IS(req->method, METHOD_POST)) { int len; const char *content_length = get_header(req, "Content-Length"); if (! content_length || sscanf(content_length, "%d", &len) != 1 || len < 0 || len > _httpPostLimit) return false; if (len != 0) { query_string = CALLOC(1, _httpPostLimit + 1); int n = Socket_read(req->S, query_string, len); if (n != len) { FREE(query_string); return false; } } } else if (IS(req->method, METHOD_GET)) { char *p = strchr(req->url, '?'); if (p) { *p++ = 0; query_string = Str_dup(p); } } if (query_string) { if (*query_string) { char *p = strchr(query_string, '/'); if (p) { *p++ = 0; req->pathinfo = Str_dup(p); } req->params = parse_parameters(query_string); } FREE(query_string); } return true; } /* ----------------------------------------------------------------- Cleanup */ /** * Clear the response output buffer and headers */ static void reset_response(HttpResponse res) { if (res->headers) { destroy_entry(res->headers); res->headers = NULL; /* Release Pragma */ } StringBuffer_clear(res->outputbuffer); } /** * Finalize the request and response object. */ static void done(HttpRequest req, HttpResponse res) { destroy_HttpRequest(req); destroy_HttpResponse(res); } /** * Free a HttpRequest object */ static void destroy_HttpRequest(HttpRequest req) { if (req) { FREE(req->method); FREE(req->url); FREE(req->pathinfo); FREE(req->protocol); FREE(req->remote_user); if (req->headers) destroy_entry(req->headers); if (req->params) destroy_entry(req->params); FREE(req); } } /** * Free a HttpResponse object */ static void destroy_HttpResponse(HttpResponse res) { if (res) { StringBuffer_free(&(res->outputbuffer)); if (res->headers) destroy_entry(res->headers); FREE(res); } } /** * Free a (linked list of) http entry object(s). Both HttpHeader and * HttpParameter are of this type. */ static void destroy_entry(void *p) { struct entry *next; for (struct entry *h = p; h; h = next) { if (h) { next = h->next; FREE(h->name); FREE(h->value); FREE(h); } } } /* ----------------------------------------------------- Checkers/Validators */ static bool _isCookieSeparator(int c) { return (c == ' ' || c == '\n' || c == ';' || c == ','); } static bool is_authenticated(HttpRequest req, HttpResponse res) { if (Run.httpd.credentials) { if (! basic_authenticate(req)) { // Send just generic error message to the client to not disclose e.g. username existence in case of credentials harvesting attack send_error(req, res, SC_UNAUTHORIZED, "You are not authorized to access monit. Either you supplied the wrong credentials (e.g. bad password), or your browser doesn't understand how to supply the credentials required"); set_header(res, "WWW-Authenticate", "Basic realm=\"monit\""); return false; } } if (IS(req->method, METHOD_POST)) { // Check CSRF double-submit cookie (https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Double_Submit_Cookie) const char *token = get_parameter(req, "securitytoken"); if (! token) { Log_error("HttpRequest: access denied -- client [%s]: missing CSRF token in HTTP parameter\n", NVLSTR(Socket_getRemoteHost(req->S))); send_error(req, res, SC_FORBIDDEN, "Invalid CSRF Token"); return false; } const char *cookie = get_header(req, "Cookie"); if (! cookie) { Log_error("HttpRequest: access denied -- client [%s]: missing CSRF token cookie\n", NVLSTR(Socket_getRemoteHost(req->S))); send_error(req, res, SC_FORBIDDEN, "Invalid CSRF Token"); return false; } const char *cookieName = "securitytoken="; for (int i = 0, j = 0; cookie[i]; i++) { if (_isCookieSeparator(cookie[i])) { // Cookie separator j = 0; continue; } if (j < 14) { // Cookie name if (cookie[i] == cookieName[j]) { j++; continue; } else { j = 0; } } else if (j == 14) { // Cookie value char cookieValue[STRLEN] = {}; strncpy(cookieValue, cookie + i, sizeof(cookieValue) - 1); for (int k = 0; cookieValue[k]; k++) { if (_isCookieSeparator(cookieValue[k])) { cookieValue[k] = 0; break; } } if (! Str_authcmp(cookieValue, token)) { Log_error("HttpRequest: access denied -- client [%s]: CSRF token mismatch\n", NVLSTR(Socket_getRemoteHost(req->S))); send_error(req, res, SC_FORBIDDEN, "Invalid CSRF Token"); return false; } return true; } } Log_error("HttpRequest: access denied -- client [%s]: no CSRF token in cookie\n", NVLSTR(Socket_getRemoteHost(req->S))); send_error(req, res, SC_FORBIDDEN, "Invalid CSRF Token"); return false; } return true; } /** * Authenticate the basic-credentials (uname/password) submitted by * the user. */ static bool basic_authenticate(HttpRequest req) { const char *credentials = get_header(req, "Authorization"); if (! (credentials && Str_startsWith(credentials, "Basic "))) { Log_debug("HttpRequest: access denied -- client [%s]: missing or invalid Authorization header\n", NVLSTR(Socket_getRemoteHost(req->S))); return false; } char buf[STRLEN] = {0}; strncpy(buf, &credentials[6], sizeof(buf) - 1); char uname[STRLEN] = {0}; if (decode_base64((unsigned char *)uname, buf) <= 0) { Log_debug("HttpRequest: access denied -- client [%s]: invalid Authorization header\n", NVLSTR(Socket_getRemoteHost(req->S))); return false; } if (! *uname) { Log_debug("HttpRequest: access denied -- client [%s]: empty username\n", NVLSTR(Socket_getRemoteHost(req->S))); return false; } char *password = strchr(uname, ':'); if (STR_UNDEF(password)) { Log_debug("HttpRequest: access denied -- client [%s]: empty password\n", NVLSTR(Socket_getRemoteHost(req->S))); return false; } *password++ = 0; /* Check if user exist */ if (! Util_getUserCredentials(uname)) { Log_error("HttpRequest: access denied -- client [%s]: unknown user '%s'\n", NVLSTR(Socket_getRemoteHost(req->S)), uname); return false; } /* Check if user has supplied the right password */ if (! Util_checkCredentials(uname, password)) { Log_error("HttpRequest: access denied -- client [%s]: wrong password for user '%s'\n", NVLSTR(Socket_getRemoteHost(req->S)), uname); return false; } req->remote_user = Str_dup(uname); return true; } /* --------------------------------------------------------------- Utilities */ /** * Send an error message to the client. This is a helper function, * used internal if the service function fails to setup the framework * properly; i.e. with a valid HttpRequest and a valid HttpResponse. */ static void internal_error(Socket_T S, int status, const char *msg) { char date[STRLEN]; char server[STRLEN]; const char *status_msg = get_status_string(status); get_date(date, STRLEN); get_server(server, STRLEN); Socket_print(S, "%s %d %s\r\n" "Date: %s\r\n" "Server: %s\r\n" "Content-Type: text/html\r\n" "Connection: close\r\n" "X-Content-Type-Options: nosniff\r\n" "X-Frame-Options: SAMEORIGIN\r\n" "Content-Security-Policy: frame-ancestors 'self'\r\n" "X-XSS-Protection: 1; mode=block\r\n" "Referrer-Policy: same-origin\r\n" "Permissions-Policy: geolocation=(),camera=(),microphone=()\r\n" "\r\n" "%s" "

%s

%s

" "


%s" "\r\n", SERVER_PROTOCOL, status, status_msg, date, server, status_msg, status_msg, msg, SERVER_URL, server); DEBUG("HttpRequest: error -- client [%s]: %s %d %s\n", NVLSTR(Socket_getRemoteHost(S)), SERVER_PROTOCOL, status, msg ? msg : status_msg); } /** * Parse request parameters from the given query string and return a * linked list of HttpParameters */ static HttpParameter parse_parameters(char *query_string) { #define KEY 1 #define VALUE 2 int token; int cursor = 0; char *key = NULL; char *value = NULL; HttpParameter head = NULL; while ((token = get_next_token(query_string, &cursor, &value))) { if (token == KEY) key = value; else if (token == VALUE) { HttpParameter p = NULL; if (! key) goto error; NEW(p); p->name = key; p->value = Util_urlDecode(value); p->next = head; head = p; key = NULL; } } if (key) FREE(key); return head; error: FREE(key); FREE(value); if (head != NULL) destroy_entry(head); return NULL; } /** * A mini-scanner for tokenizing a query string */ static int get_next_token(char *s, int *cursor, char **r) { int i = *cursor; while (s[*cursor]) { if (s[*cursor+1] == '=') { *cursor += 1; *r = Str_ndup(&s[i], (*cursor-i)); return KEY; } if (s[*cursor] == '=') { while (s[*cursor] && s[*cursor] != '&') *cursor += 1; if (s[*cursor] == '&') { *r = Str_ndup(&s[i+1], (*cursor-i)-1); *cursor += 1; } else { *r = Str_ndup(&s[i+1], (*cursor-i)); } return VALUE; } *cursor += 1; } return 0; } monit-5.35.2/src/http/xml.c0000644000016400001720000010657415007061157012401 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDBOOL_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_UNISTD_H #include #endif // libmonit #include "util/List.h" #include "system/Time.h" #include "monit.h" #include "event.h" #include "protocol.h" /** * XML routines for status and event notification message handling. * * @file */ /* ----------------------------------------------------------------- Private */ /** * Escape the CDATA "]]>" stop sequence in string * @param B Output StringBuffer object * @param buf String to escape */ static void _escapeCDATA(StringBuffer_T B, const char *buf) { for (int i = 0; buf[i]; i++) { if (buf[i] == '>' && i > 1 && (buf[i - 1] == ']' && buf[i - 2] == ']')) StringBuffer_append(B, ">"); else StringBuffer_append(B, "%c", buf[i]); } } /** * Prints a document header into the given buffer. * @param B StringBuffer object * @param V Format version * @param myip The client-side IP address */ static void document_head(StringBuffer_T B, int V, const char *myip) { StringBuffer_append(B, ""); if (V == 2) StringBuffer_append(B, "", Run.id, (long long)Run.incarnation, VERSION); else StringBuffer_append(B, "" "" "%s" "%lld" "%s", Run.id, (long long)Run.incarnation, VERSION); StringBuffer_append(B, "%lld" "%d" "%d" "%s" "%s", (long long)(Time_now() - Run.incarnation), Run.polltime, Run.startdelay, Run.system->name ? Run.system->name : "", Run.files.control ? Run.files.control : ""); if (Run.httpd.flags & Httpd_Net || Run.httpd.flags & Httpd_Unix) { if (Run.httpd.flags & Httpd_Net) StringBuffer_append(B, "
%s
%d%d
", Run.httpd.socket.net.address ? Run.httpd.socket.net.address : myip ? myip : "", Run.httpd.socket.net.port, Run.httpd.socket.net.ssl.flags & SSL_Enabled); else if (Run.httpd.flags & Httpd_Unix) StringBuffer_append(B, "%s", Run.httpd.socket.unix.path ? Run.httpd.socket.unix.path : ""); if (Run.mmonitcredentials) StringBuffer_append(B, "%s%s", Run.mmonitcredentials->uname, Run.mmonitcredentials->passwd); } StringBuffer_append(B, "
" "" "%s" "%s" "%s" "%s" "%d" "%llu" "%llu" "", System_Info.uname.sysname, System_Info.uname.release, System_Info.uname.version, System_Info.uname.machine, System_Info.cpu.count, (unsigned long long)((double)System_Info.memory.size / 1024.), // Send as kB for backward compatibility (unsigned long long)((double)System_Info.swap.size / 1024.)); // Send as kB for backward compatibility } /** * Prints a document footer into the given buffer. * @param B StringBuffer object */ static void document_foot(StringBuffer_T B) { StringBuffer_append(B, "
"); } static void _ioStatisticsPrint(StringBuffer_T B, const char *name, Statistics_T statistics) { if (Statistics_initialized(statistics)) { StringBuffer_append(B, "<%s>" "%.0lf" // per second "%llu" // since boot "", name, Statistics_deltaNormalize(statistics), Statistics_raw(statistics), name); } } static void _ioStatisticsProcess(StringBuffer_T B, const char *name, IOStatistics_T statistics) { StringBuffer_append(B, "<%s>", name); _ioStatisticsPrint(B, "bytesgeneric", &(statistics->bytes)); _ioStatisticsPrint(B, "bytes", &(statistics->bytesPhysical)); _ioStatisticsPrint(B, "operations", &(statistics->operations)); StringBuffer_append(B, "", name); } static void _ioStatisticsFilesystem(StringBuffer_T B, const char *name, IOStatistics_T statistics) { StringBuffer_append(B, "<%s>", name); _ioStatisticsPrint(B, "bytes", &(statistics->bytes)); _ioStatisticsPrint(B, "operations", &(statistics->operations)); StringBuffer_append(B, "", name); } /** * Prints a service status into the given buffer. * @param S Service object * @param B StringBuffer object * @param V Format version */ static void status_service(Service_T S, StringBuffer_T B, int V) { if (V == 2) StringBuffer_append(B, "%d", S->name ? S->name : "", S->type); else StringBuffer_append(B, "%s", S->type, S->name ? S->name : ""); StringBuffer_append(B, "%lld" "%ld" "%d" "%d" "%d" "%d" "%d" "%d", (long long)S->collected.tv_sec, (long)S->collected.tv_usec, S->error, S->error_hint, S->monitor, S->mode, S->onreboot, S->doaction); if (S->every.type != Every_Cycle) { StringBuffer_append(B, "%d", S->every.type); if (S->every.type == Every_SkipCycles) StringBuffer_append(B, "%d%d", S->every.spec.cycle.counter, S->every.spec.cycle.number); else StringBuffer_append(B, "%s", S->every.spec.cron); StringBuffer_append(B, ""); } if (Util_hasServiceStatus(S)) { switch (S->type) { case Service_System: StringBuffer_append(B, "%lld" "%lld" "" "%lld" "%lld" "%lld" "", (long long)(Time_now() - System_Info.booted), (long long)(System_Info.booted), System_Info.filedescriptors.allocated, System_Info.filedescriptors.unused, System_Info.filedescriptors.maximum); break; case Service_File: StringBuffer_append(B, "%o" "%d" "%d" "" "%llu" "%llu" "%llu" "" "%lld" "%lld", S->inf.file->mode & 07777, (int)S->inf.file->uid, (int)S->inf.file->gid, S->inf.file->timestamp.access, S->inf.file->timestamp.change, S->inf.file->timestamp.modify, (long long)S->inf.file->size, (long long)S->inf.file->nlink); if (S->checksum) StringBuffer_append(B, "%s", Checksum_Names[S->checksum->type], S->inf.file->cs_sum); break; case Service_Directory: StringBuffer_append(B, "%o" "%d" "%d" "%lld" "" "%llu" "%llu" "%llu" "", S->inf.directory->mode & 07777, (int)S->inf.directory->uid, (int)S->inf.directory->gid, (long long)S->inf.directory->nlink, S->inf.directory->timestamp.access, S->inf.directory->timestamp.change, S->inf.directory->timestamp.modify); break; case Service_Fifo: StringBuffer_append(B, "%o" "%d" "%d" "%lld" "" "%llu" "%llu" "%llu" "", S->inf.fifo->mode & 07777, (int)S->inf.fifo->uid, (int)S->inf.fifo->gid, (long long)S->inf.fifo->nlink, S->inf.fifo->timestamp.access, S->inf.fifo->timestamp.change, S->inf.fifo->timestamp.modify); break; case Service_Filesystem: StringBuffer_append(B, "%s" "%s" "%o" "%d" "%d" "" "%.1f" "%.1lf" "%.1lf" "", S->inf.filesystem->object.type, S->inf.filesystem->flags.current, S->inf.filesystem->mode & 07777, (int)S->inf.filesystem->uid, (int)S->inf.filesystem->gid, S->inf.filesystem->space_percent, S->inf.filesystem->f_bsize > 0 ? (double)S->inf.filesystem->f_blocksused / 1048576. * (double)S->inf.filesystem->f_bsize : 0., S->inf.filesystem->f_bsize > 0 ? (double)S->inf.filesystem->f_blocks / 1048576. * (double)S->inf.filesystem->f_bsize : 0.); if (S->inf.filesystem->f_files > 0) { StringBuffer_append(B, "" "%.1f" "%lld" "%lld" "", S->inf.filesystem->inode_percent, S->inf.filesystem->f_filesused, S->inf.filesystem->f_files); } _ioStatisticsFilesystem(B, "read", &(S->inf.filesystem->read)); _ioStatisticsFilesystem(B, "write", &(S->inf.filesystem->write)); bool hasReadTime = Statistics_initialized(&(S->inf.filesystem->time.read)); bool hasWriteTime = Statistics_initialized(&(S->inf.filesystem->time.write)); bool hasWaitTime = Statistics_initialized(&(S->inf.filesystem->time.wait)); bool hasRunTime = Statistics_initialized(&(S->inf.filesystem->time.run)); if (hasReadTime || hasWriteTime || hasWaitTime || hasRunTime) { StringBuffer_append(B, ""); if (hasReadTime) StringBuffer_append(B, "%.3f", Statistics_deltaNormalize(&(S->inf.filesystem->time.read))); if (hasWriteTime) StringBuffer_append(B, "%.3f", Statistics_deltaNormalize(&(S->inf.filesystem->time.write))); if (hasWaitTime) StringBuffer_append(B, "%.3f", Statistics_deltaNormalize(&(S->inf.filesystem->time.wait))); if (hasRunTime) StringBuffer_append(B, "%.3f", Statistics_deltaNormalize(&(S->inf.filesystem->time.run))); StringBuffer_append(B, ""); } break; case Service_Net: StringBuffer_append(B, "" "%d" "%lld" "%d" "" "" "%lld" "%lld" "" "" "%lld" "%lld" "" "" "%lld" "%lld" "" "" "" "" "%lld" "%lld" "" "" "%lld" "%lld" "" "" "%lld" "%lld" "" "" "", Link_getState(S->inf.net->stats), Link_getSpeed(S->inf.net->stats), Link_getDuplex(S->inf.net->stats), Link_getPacketsInPerSecond(S->inf.net->stats), Link_getPacketsInTotal(S->inf.net->stats), Link_getBytesInPerSecond(S->inf.net->stats), Link_getBytesInTotal(S->inf.net->stats), Link_getErrorsInPerSecond(S->inf.net->stats), Link_getErrorsInTotal(S->inf.net->stats), Link_getPacketsOutPerSecond(S->inf.net->stats), Link_getPacketsOutTotal(S->inf.net->stats), Link_getBytesOutPerSecond(S->inf.net->stats), Link_getBytesOutTotal(S->inf.net->stats), Link_getErrorsOutPerSecond(S->inf.net->stats), Link_getErrorsOutTotal(S->inf.net->stats)); break; case Service_Process: StringBuffer_append(B, "%d" "%d" "%d" "%d" "%d" "%lld", S->inf.process->pid, S->inf.process->ppid, S->inf.process->uid, S->inf.process->euid, S->inf.process->gid, (long long)S->inf.process->uptime); if (Run.flags & Run_ProcessEngineEnabled) { StringBuffer_append(B, "%d" "%d" "" "%.1f" "%.1f" "%llu" "%llu" "" "" "%.1f" "%.1f" "" "" "%lld" "%lld" "" "%lld" "%lld" "" "", S->inf.process->threads, S->inf.process->children, S->inf.process->mem_percent, S->inf.process->total_mem_percent, (unsigned long long)((double)S->inf.process->mem / 1024.), // Send as kB for backward compatibility (unsigned long long)((double)S->inf.process->total_mem / 1024.), // Send as kB for backward compatibility S->inf.process->cpu_percent, S->inf.process->total_cpu_percent, S->inf.process->filedescriptors.open, S->inf.process->filedescriptors.openTotal, S->inf.process->filedescriptors.limit.soft, S->inf.process->filedescriptors.limit.hard); } _ioStatisticsProcess(B, "read", &(S->inf.process->read)); _ioStatisticsProcess(B, "write", &(S->inf.process->write)); break; default: break; } for (Icmp_T i = S->icmplist; i; i = i->next) { StringBuffer_append(B, "" "%s" "%.6f" "", Icmp_Names[i->type], i->is_available == Connection_Ok ? i->responsetime.current / 1000. : -1.); // We send the response time in [s] for backward compatibility (with microseconds precision) } for (Port_T p = S->portlist; p; p = p->next) { StringBuffer_append(B, "" "%s" "%d" "" "%s" "%s" "%.6f", p->hostname ? p->hostname : "", p->target.net.port, Util_portRequestDescription(p), p->protocol->name ? p->protocol->name : "", Util_portTypeDescription(p), p->is_available == Connection_Ok ? p->responsetime.current / 1000. : -1.); // We send the response time in [s] for backward compatibility (with microseconds precision) if (p->target.net.ssl.options.flags) StringBuffer_append(B, "" "%d" "", p->target.net.ssl.certificate.validDays); StringBuffer_append(B, ""); } for (Port_T p = S->socketlist; p; p = p->next) { StringBuffer_append(B, "" "%s" "%s" "%.6f" "", p->target.unix.pathname ? p->target.unix.pathname : "", p->protocol->name ? p->protocol->name : "", p->is_available == Connection_Ok ? p->responsetime.current / 1000. : -1.); // We send the response time in [s] for backward compatibility (with microseconds precision) } if (S->type == Service_System) { StringBuffer_append(B, "" "" "%.2f" "%.2f" "%.2f" "" "", System_Info.loadavg[0], System_Info.loadavg[1], System_Info.loadavg[2]); if (System_Info.statisticsAvailable & Statistics_CpuUser) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.user > 0. ? System_Info.cpu.usage.user : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSystem) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.system > 0. ? System_Info.cpu.usage.system : 0.); if (System_Info.statisticsAvailable & Statistics_CpuNice) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.nice > 0. ? System_Info.cpu.usage.nice : 0.); if (System_Info.statisticsAvailable & Statistics_CpuIOWait) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.iowait > 0. ? System_Info.cpu.usage.iowait : 0.); if (System_Info.statisticsAvailable & Statistics_CpuHardIRQ) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.hardirq > 0. ? System_Info.cpu.usage.hardirq : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSoftIRQ) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.softirq > 0. ? System_Info.cpu.usage.softirq : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSteal) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.steal > 0. ? System_Info.cpu.usage.steal : 0.); if (System_Info.statisticsAvailable & Statistics_CpuGuest) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.guest > 0. ? System_Info.cpu.usage.guest : 0.); if (System_Info.statisticsAvailable & Statistics_CpuGuestNice) StringBuffer_append(B, "%.1f", System_Info.cpu.usage.guest_nice > 0. ? System_Info.cpu.usage.guest_nice : 0.); StringBuffer_append(B, "" "" "%.1f" "%llu" "" "" "%.1f" "%llu" "" "", System_Info.memory.usage.percent, (unsigned long long)((double)System_Info.memory.usage.bytes / 1024.), // Send as kB for backward compatibility System_Info.swap.usage.percent, (unsigned long long)((double)System_Info.swap.usage.bytes / 1024.)); // Send as kB for backward compatibility } if (S->type == Service_Program && S->program->started) { StringBuffer_append(B, "" "%lld" "%d" "program->started, S->program->exitStatus); _escapeCDATA(B, StringBuffer_toString(S->program->lastOutput)); StringBuffer_append(B, "]]>" ""); } } StringBuffer_append(B, ""); } /** * Prints a servicegroups into the given buffer. * @param SG ServiceGroup object * @param B StringBuffer object */ static void status_servicegroup(ServiceGroup_T SG, StringBuffer_T B) { StringBuffer_append(B, "", SG->name); for (_list_t m = SG->members->head; m; m = m->next) { Service_T s = m->e; StringBuffer_append(B, "%s", s->name); } StringBuffer_append(B, ""); } /** * Prints a event description into the given buffer. * @param E Event object * @param B StringBuffer object */ static void status_event(Event_T E, StringBuffer_T B) { StringBuffer_append(B, "" "%lld" "%ld" "%s" "%d" "%ld" "%d" "%d" "collected.tv_sec, (long)E->collected.tv_usec, E->id == Event_Instance ? "Monit" : E->source->name, E->type, E->id, E->state, Event_get_action(E)); if (E->message) _escapeCDATA(B, E->message); StringBuffer_append(B, "]]>"); StringBuffer_append(B, ""); } /* ------------------------------------------------------------------ Public */ /** * Get a XML formatted message for event notification or general status * of monitored services and resources. * @param E An event object or NULL for general status * @param V Format version * @param myip The client-side IP address * @param mmonit The mmonit configuration object */ void status_xml(StringBuffer_T B, Event_T E, int V, const char *myip, Mmonit_T mmonit) { Service_T S; ServiceGroup_T SG; document_head(B, V, myip); // M/Monit hostgroups membership if (mmonit && mmonit->hostgroups) { StringBuffer_append(B, ""); for (_list_t g = mmonit->hostgroups->head; g; g = g->next) { StringBuffer_append(B, "e); StringBuffer_append(B, "]]>"); } StringBuffer_append(B, ""); } if (V == 2) StringBuffer_append(B, ""); for (S = Service_List_Conf; S; S = S->next_conf) status_service(S, B, V); if (V == 2) { StringBuffer_append(B, ""); for (SG = Service_Group_List; SG; SG = SG->next) status_servicegroup(SG, B); StringBuffer_append(B, ""); } if (E) status_event(E, B); document_foot(B); } monit-5.35.2/src/http/client.h0000644000016400001720000000364515007061157013057 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef HTTPCLIENT_H #define HTTPCLIENT_H /** * Do service action * @param action A string representation of Action_Type * @param services List of services * @return true if succeeded otherwise false */ bool HttpClient_action(const char *action, List_T services); /** * Print service report * @param group Service group or NULL * @param type Report type or NULL * @return true if succeeded otherwise false */ bool HttpClient_report(const char *group, const char *type); /** * Print service status * @param group Service group or NULL * @param service Service name or NULL * @return true if succeeded otherwise false */ bool HttpClient_status(const char *group, const char *service); /** * Print service summary * @param group Service group or NULL * @param service Service name or NULL * @return true if succeeded otherwise false */ bool HttpClient_summary(const char *group, const char *service); #endif monit-5.35.2/src/http/base64.c0000644000016400001720000001271215007061157012653 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "monit.h" #include "base64.h" /** * Implementation of base64 encoding/decoding. * * @file */ /* ----------------------------------------------------------------- Private */ /** * Base64 encode one byte */ static char encode(unsigned char u) { if (u < 26) return 'A' + u; if (u < 52) return 'a' + (u - 26); if (u < 62) return '0' + (u - 52); if (u == 62) return '+'; return '/'; } /** * Decode a base64 character */ static unsigned char decode(char c) { if (c >= 'A' && c <= 'Z') return(c - 'A'); if (c >= 'a' && c <= 'z') return(c - 'a' + 26); if (c >= '0' && c <= '9') return(c - '0' + 52); if (c == '+') return 62; return 63; } /** * Return true if 'c' is a valid base64 character, otherwise false */ static bool is_base64(char c) { return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '+') || (c == '/') || (c == '=')) ? true : false; } /* ------------------------------------------------------------------ Public */ /** * Base64 encode and return size data in 'src'. The caller must free the * returned string. * @param size The size of the data in src * @param src The data to be base64 encode * @return encoded string otherwise NULL */ char *encode_base64(size_t size, unsigned char *src) { if (! src) return NULL; if (! size) size = strlen((char *)src); char *out = CALLOC(sizeof(char), size * 4 / 3 + 4); char *p = out; for (size_t i = 0; i < size; i += 3) { unsigned char b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0; b1 = src[i]; if (i + 1 < size) b2 = src[i + 1]; if (i + 2 < size) b3 = src[i + 2]; b4 = b1 >> 2; b5 = ((b1 & 0x3) << 4) | (b2 >> 4); b6 = ((b2 & 0xf) << 2) | (b3 >> 6); b7 = b3 & 0x3f; *p++ = encode(b4); *p++ = encode(b5); if (i + 1 < size) *p++ = encode(b6); else *p++ = '='; if (i + 2 < size) *p++ = encode(b7); else *p++ = '='; } return out; } /** * Decode the base64 encoded string 'src' into the memory pointed to by * 'dest'. The dest buffer is not NUL terminated. * @param dest Pointer to memory for holding the decoded string. * Must be large enough to receive the decoded string. * @param src A base64 encoded string. * @return the length of the decoded string if decode * succeeded otherwise 0. */ size_t decode_base64(unsigned char *dest, const char *src) { if (src && *src) { unsigned char *p = dest; size_t k, l = strlen(src) + 1; unsigned char *buf = CALLOC(1, l); /* Ignore non base64 chars as per the POSIX standard */ for (k = 0, l = 0; src[k]; k++) if (is_base64(src[k])) buf[l++] = src[k]; for (k = 0; k < l; k += 4) { char c1 = 'A', c2 = 'A', c3 = 'A', c4 = 'A'; unsigned char b1 = 0, b2 = 0, b3 = 0, b4 = 0; c1 = buf[k]; if (k + 1 < l) c2 = buf[k + 1]; if (k + 2 < l) c3 = buf[k + 2]; if (k + 3 < l) c4 = buf[k + 3]; b1 = decode(c1); b2 = decode(c2); b3 = decode(c3); b4 = decode(c4); *p++ = ((b1 << 2) | (b2 >> 4)); if (c3 != '=') *p++ = (((b2&0xf) << 4) | (b3 >> 2)); if (c4 != '=') *p++ = (((b3 & 0x3) << 6) | b4); } FREE(buf); return (p - dest); } return 0; } monit-5.35.2/src/http/base64.h0000644000016400001720000000226215007061157012657 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef BASE64_H #define BASE64_H #include "config.h" size_t decode_base64(unsigned char *dest, const char *src); char *encode_base64(size_t size, unsigned char *src); #endif monit-5.35.2/src/http/httpstatus.h0000644000016400001720000000627215007061157014023 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef HTTPSTATUS_H #define HTTPSTATUS_H /* HTTP Status Codes */ #define SC_CONTINUE 100 #define SC_SWITCHING_PROTOCOLS 101 #define SC_PROCESSING 102 #define SC_OK 200 #define SC_CREATED 201 #define SC_ACCEPTED 202 #define SC_NON_AUTHORITATIVE 203 #define SC_NO_CONTENT 204 #define SC_RESET_CONTENT 205 #define SC_PARTIAL_CONTENT 206 #define SC_MULTI_STATUS 207 #define SC_MULTIPLE_CHOICES 300 #define SC_MOVED_PERMANENTLY 301 #define SC_MOVED_TEMPORARILY 302 #define SC_SEE_OTHER 303 #define SC_NOT_MODIFIED 304 #define SC_USE_PROXY 305 #define SC_TEMPORARY_REDIRECT 307 #define SC_BAD_REQUEST 400 #define SC_UNAUTHORIZED 401 #define SC_PAYMENT_REQUIRED 402 #define SC_FORBIDDEN 403 #define SC_NOT_FOUND 404 #define SC_METHOD_NOT_ALLOWED 405 #define SC_NOT_ACCEPTABLE 406 #define SC_PROXY_AUTHENTICATION_REQUIRED 407 #define SC_REQUEST_TIMEOUT 408 #define SC_CONFLICT 409 #define SC_GONE 410 #define SC_LENGTH_REQUIRED 411 #define SC_PRECONDITION_FAILED 412 #define SC_REQUEST_ENTITY_TOO_LARGE 413 #define SC_REQUEST_URI_TOO_LARGE 414 #define SC_UNSUPPORTED_MEDIA_TYPE 415 #define SC_RANGE_NOT_SATISFIABLE 416 #define SC_EXPECTATION_FAILED 417 #define SC_UNPROCESSABLE_ENTITY 422 #define SC_LOCKED 423 #define SC_FAILED_DEPENDENCY 424 #define SC_INTERNAL_SERVER_ERROR 500 #define SC_NOT_IMPLEMENTED 501 #define SC_BAD_GATEWAY 502 #define SC_SERVICE_UNAVAILABLE 503 #define SC_GATEWAY_TIMEOUT 504 #define SC_VERSION_NOT_SUPPORTED 505 #define SC_VARIANT_ALSO_VARIES 506 #define SC_INSUFFICIENT_STORAGE 507 #define SC_NOT_EXTENDED 510 #endif monit-5.35.2/src/http/engine.h0000644000016400001720000000347615007061157013050 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef ENGINE_H #define ENGINE_H /** * Start the HTTPD server */ void Engine_start(void); /** * Set the stopped flag */ void Engine_setStopped(bool stop); /** * Stop the HTTPD server. */ void Engine_stop(void); /** * Cleanup the HTTPD server resources (remove unix socket). */ void Engine_cleanup(void); /** * Add network/host allowed to connect to this server. * @param pattern A hostname, IP address or network identifier in IP/mask format to be added to the allow list * @return true if the the pattern was added, otherwise false */ bool Engine_addAllow(char *pattern); /** * Are any hosts present in the host allow list? * @return true if the host allow list is non-empty, otherwise false */ bool Engine_hasAllow(void); /** * Free the host allow list */ void Engine_destroyAllow(void); #endif monit-5.35.2/src/http/engine.c0000644000016400001720000004735015007061157013042 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_SYS_UN_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_POLL_H #include #endif #include "monit.h" #include "engine.h" #include "processor.h" #include "cervlet.h" #include "net/net.h" #include "SslServer.h" // libmonit #include "system/Net.h" #include "exceptions/AssertException.h" #include "exceptions/IOException.h" /** * A naive http 1.0 server. The server delegates handling of a HTTP * request and response to the processor module. * * NOTE * This server does not use threads or forks; Requests are * serialized and pending requests will be popped from the * connection queue when the current request finish. * * Since this server is written for monit, low traffic is expected. * Connect from not-authenticated clients will be closed down * promptly. The authentication schema or access control is based * on client name/address/pam and only requests from known clients are * accepted. Hosts allowed to connect to this server should be * added to the access control list by calling Engine_addHostAllow(). * * @file */ /* ------------------------------------------------------------- Definitions */ typedef struct HostsAllow_T { uint32_t address[4]; // IPv4 or IPv6 address uint32_t mask[4]; // mask /* For internal use */ struct HostsAllow_T *next; } *HostsAllow_T; #define MAX_SERVER_SOCKETS 3 static struct { Socket_Family family; union { struct sockaddr_storage addr_in; struct sockaddr_un addr_un; } _addr; struct sockaddr *addr; socklen_t addrlen; #ifdef HAVE_OPENSSL SslServer_T ssl; #endif } data[MAX_SERVER_SOCKETS] = {}; static volatile bool stopped = false; static int myServerSocketsCount = 0; static struct pollfd myServerSockets[3] = {}; static HostsAllow_T allowlist = NULL; /* ----------------------------------------------------------------- Private */ static bool _hasAllow(HostsAllow_T host) { for (HostsAllow_T p = allowlist; p; p = p->next) if (memcmp(p->address, &(host->address), 16) == 0 && memcmp(p->mask, &(host->mask), 16) == 0) return true; return false; } static void _pushAllow(HostsAllow_T h, const char *pattern) { char buf[INET6_ADDRSTRLEN] = {}; if (! Str_sub(pattern, "/")) inet_ntop(AF_INET6, &(h->address), buf, sizeof(buf)); if (_hasAllow(h)) { if (*buf) Log_warning("Skipping 'allow %s' -- host resolved to [%s] which is present in ACL already\n", pattern, buf); else Log_warning("Skipping 'allow %s' -- present in ACL already\n", pattern); FREE(h); } else { if (*buf) DEBUG("Adding 'allow %s' -- host resolved to [%s]\n", pattern, buf); else DEBUG("Adding 'allow %s'\n", pattern); h->next = allowlist; allowlist = h; } } static bool _matchAllow(uint32_t address1[4], uint32_t address2[4], uint32_t mask[4]) { for (int i = 0; i < 4; i++) if ((address1[i] & mask[i]) != (address2[i] & mask[i])) return false; return true; } static bool _isAllowed(uint32_t address[4]) { if (allowlist) { for (HostsAllow_T p = allowlist; p; p = p->next) if (_matchAllow(p->address, address, p->mask)) return true; return false; } return true; } static HostsAllow_T _copyAllow(HostsAllow_T source) { HostsAllow_T copy; NEW(copy); memcpy(copy, source, sizeof(struct HostsAllow_T)); return copy; } static void _mapIPv4toIPv6(uint32_t *address4, uint32_t *address6) { // Map IPv4 address to IPv6 "::ffff:x.x.x.x" notation, so we can compare IPv4 address in IPv6 namespace *(address6 + 0) = 0x00000000; *(address6 + 1) = 0x00000000; *(address6 + 2) = htonl(0x0000ffff); *(address6 + 3) = *address4; } static bool _parseNetwork(char *pattern) { char *longmask = NULL; int shortmask = 0; int slashcount = 0; int dotcount = 0; int columncount = 0; int count = 0; char buf[STRLEN]; strncpy(buf, pattern, sizeof(buf) - 1); char *temp = buf; Socket_Family family = Socket_Ip4; // check if we have IPv4/IPv6 CIDR notation (x.x.x.x/yyy or x::/y) or IPv4 dot-decimal (x.x.x.x/y.y.y.y) while (*temp) { if (*temp == '/') { if (slashcount > 0 || (family == Socket_Ip4 && dotcount != 3) || (family == Socket_Ip6 && columncount < 2)) return false; // The "/" was found already or its prefix doesn't look like valid address *temp = 0; longmask = *(temp + 1) ? temp + 1 : NULL; slashcount++; dotcount = columncount = count = 0; } else if (*temp == '.') { if (family == Socket_Ip6 && slashcount > 0) return false; // No "." allowed past "/" for IPv6 address dotcount++; } else if (*temp == ':') { if (slashcount > 0) return false; // ":" not allowed past "/" columncount++; family = Socket_Ip6; } else { if (slashcount == 0) { // [0-9a-fA-F] allowed before "/" if (! isxdigit((int)*temp)) return false; } else { // only [0-9] allowed past "/" if (! isdigit((int)*temp)) return false; } count++; } temp++; } if (slashcount == 0) { // Host part only return false; } else if (dotcount == 0 && count > 0 && count < 4) { // Mask in CIDR notation if (longmask) { shortmask = atoi(longmask); longmask = NULL; } } else if (family == Socket_Ip4 && dotcount != 3) { // The IPv4 dot-decimal mask requires three dots return false; } struct HostsAllow_T net = {}; if (family == Socket_Ip4) { struct sockaddr_in addr; if (inet_pton(AF_INET, buf, &(addr.sin_addr)) != 1) return false; _mapIPv4toIPv6((uint32_t *)&(addr.sin_addr), net.address); } else { #ifdef HAVE_IPV6 struct sockaddr_in6 addr; if (inet_pton(AF_INET6, buf, &(addr.sin6_addr)) != 1) return false; memcpy(net.address, &(addr.sin6_addr), 16); #else THROW(AssertException, "IPv6 not supported on this system"); #endif } if (longmask == NULL) { // Convert CIDR notation to integer mask if (shortmask < 0) return false; if (family == Socket_Ip4) { if (shortmask > 32) { return false; } else if (shortmask == 32) { memset(net.mask, 0xff, 16); } else if (shortmask > 0) { memset(net.mask, 0xff, 16); net.mask[3] = htonl(0xffffffff << (32 - shortmask)); } } else { if (shortmask > 128) { return false; } else if (shortmask == 128) { memset(net.mask, 0xff, 16); } else { for (int i = 0; i < 4; i++) { if (shortmask > 32) { net.mask[i] = 0xffffffff; shortmask -= 32; } else if (shortmask > 0) { net.mask[i] = htonl(0xffffffff << (32 - shortmask)); shortmask = 0; } else { net.mask[i] = 0x00000000; } } } } } else { // Parse IPv4 dot-decimal mask struct sockaddr_in addr; if (! inet_aton(longmask, &(addr.sin_addr))) return false; _mapIPv4toIPv6((uint32_t *)&(addr.sin_addr), net.mask); } _pushAllow(_copyAllow(&net), pattern); return true; } //FIXME: don't store the translated hostname->IPaddress on Monit startup to support DHCP hosts ... resolve the hostname in _authenticateHost() static bool _parseHost(char *pattern) { struct addrinfo *res, hints = { .ai_protocol = IPPROTO_TCP }; int added = 0; if (! getaddrinfo(pattern, NULL, &hints, &res)) { for (struct addrinfo *_res = res; _res; _res = _res->ai_next) { HostsAllow_T h = NULL; if (_res->ai_family == AF_INET) { NEW(h); struct sockaddr_in *sin = (struct sockaddr_in *)_res->ai_addr; _mapIPv4toIPv6((uint32_t *)&(sin->sin_addr), h->address); } #ifdef HAVE_IPV6 else if (_res->ai_family == AF_INET6) { NEW(h); struct sockaddr_in6 *sin = (struct sockaddr_in6 *)_res->ai_addr; memcpy(&h->address, &(sin->sin6_addr), 16); } #endif if (h) { memset(h->mask, 0xff, 16); // compare all 128 bits _pushAllow(h, pattern); added++; } } freeaddrinfo(res); } return added ? true : false; } static bool _authenticateHost(struct sockaddr *addr) { if (addr->sa_family == AF_INET) { bool allow = false; struct sockaddr_in *a = (struct sockaddr_in *)addr; uint32_t address[4]; _mapIPv4toIPv6((uint32_t *)&(a->sin_addr), (uint32_t *)&address); if (! (allow = _isAllowed(address))) Log_error("Denied connection from non-authorized client [%s]\n", inet_ntop(addr->sa_family, &a->sin_addr, (char[INET_ADDRSTRLEN]){}, INET_ADDRSTRLEN)); return allow; } #ifdef HAVE_IPV6 else if (addr->sa_family == AF_INET6) { bool allow = false; struct sockaddr_in6 *a = (struct sockaddr_in6 *)addr; if (! (allow = _isAllowed((uint32_t *)&(a->sin6_addr)))) Log_error("Denied connection from non-authorized client [%s]\n", inet_ntop(addr->sa_family, &(a->sin6_addr), (char[INET6_ADDRSTRLEN]){}, INET6_ADDRSTRLEN)); return allow; } #endif else if (addr->sa_family == AF_UNIX) { return true; } return false; } static Socket_T _socketProducer(void) { int r = 0; do { r = poll(myServerSockets, myServerSocketsCount, 1000); } while (r == -1 && errno == EINTR); if (r > 0) { for (int i = 0; i < myServerSocketsCount; i++) { if (myServerSockets[i].revents & POLLIN) { int client = accept(myServerSockets[i].fd, data[i].addr, &(data[i].addrlen)); if (client < 0) { Log_error("HTTP server: cannot accept connection -- %s\n", stopped ? "service stopped" : STRERROR); return NULL; } if (!Net_setNonBlocking(client) || !Net_canRead(client, 500) || !Net_canWrite(client, 500) || ! _authenticateHost(data[i].addr)) { Net_abort(client); return NULL; } #ifdef HAVE_OPENSSL return Socket_createAccepted(client, data[i].addr, data[i].ssl); #else return Socket_createAccepted(client, data[i].addr, NULL); #endif } } } return NULL; } static void _createTcpServer(Socket_Family family, char error[STRLEN]) { myServerSockets[myServerSocketsCount].fd = create_server_socket_tcp(Run.httpd.socket.net.address, Run.httpd.socket.net.port, family, 1024, error); if (myServerSockets[myServerSocketsCount].fd != -1) { #ifdef HAVE_OPENSSL if (Run.httpd.socket.net.ssl.flags & SSL_Enabled) { if (! (data[myServerSocketsCount].ssl = SslServer_new(myServerSockets[myServerSocketsCount].fd, &(Run.httpd.socket.net.ssl)))) { strncpy(error, "Could not initialize SSL engine", STRLEN - 1); Net_close(myServerSockets[myServerSocketsCount].fd); return; } } #endif data[myServerSocketsCount].family = family; data[myServerSocketsCount].addr = (struct sockaddr *)&(data[myServerSocketsCount]._addr.addr_in); data[myServerSocketsCount].addrlen = sizeof(struct sockaddr_storage); myServerSockets[myServerSocketsCount].events = POLLIN; myServerSocketsCount++; } } static void _createUnixServer(char error[STRLEN]) { myServerSockets[myServerSocketsCount].fd = create_server_socket_unix(Run.httpd.socket.unix.path, 1024, error); if (myServerSockets[myServerSocketsCount].fd != -1) { if (Run.httpd.flags & Httpd_UnixPermission) { if (chmod(Run.httpd.socket.unix.path, Run.httpd.socket.unix.permission) != 0) { snprintf(error, STRLEN, "Could not change unix socket permission -- %s", STRERROR); goto error; } } if (Run.httpd.flags & Httpd_UnixUid) { if (chown(Run.httpd.socket.unix.path, Run.httpd.socket.unix.uid, -1) != 0) { snprintf(error, STRLEN, "Could not change unix socket uid -- %s", STRERROR); goto error; } } if (Run.httpd.flags & Httpd_UnixGid) { if (chown(Run.httpd.socket.unix.path, -1, Run.httpd.socket.unix.gid) != 0) { snprintf(error, STRLEN, "Could not change unix socket gid -- %s", STRERROR); goto error; } } data[myServerSocketsCount].family = Socket_Unix; data[myServerSocketsCount].addr = (struct sockaddr *)&(data[myServerSocketsCount]._addr.addr_un); data[myServerSocketsCount].addrlen = sizeof(struct sockaddr_un); myServerSockets[myServerSocketsCount].events = POLLIN; myServerSocketsCount++; } return; error: Net_close(myServerSockets[myServerSocketsCount].fd); unlink(Run.httpd.socket.unix.path); } /* ------------------------------------------------------------------ Public */ void Engine_start(void) { if (Run.flags & Run_Stopped) { return; } Engine_cleanup(); init_service(); char error[MAX_SERVER_SOCKETS][STRLEN] = {}; if (Run.httpd.flags & Httpd_Net) { _createTcpServer(Socket_Ip4, error[0]); _createTcpServer(Socket_Ip6, error[1]); } if (Run.httpd.flags & Httpd_Unix) { _createUnixServer(error[2]); } if (myServerSocketsCount == 0) { // Log error only if no socket was created for (int i = 0; i < MAX_SERVER_SOCKETS; i++) if (STR_DEF(error[i])) Log_error("HTTP server -- %s\n", error[i]); } else { while (! stopped) { Socket_T S = _socketProducer(); if (S) http_processor(S); } for (int i = 0; i < myServerSocketsCount; i++) { #ifdef HAVE_OPENSSL if (data[i].ssl) SslServer_free(&(data[i].ssl)); #endif Net_close(myServerSockets[i].fd); } Engine_cleanup(); } } void Engine_setStopped(bool stop) { stopped = stop; } void Engine_stop(void) { Engine_setStopped(true); } void Engine_cleanup(void) { myServerSocketsCount = 0; if (Run.httpd.flags & Httpd_Unix && Run.httpd.socket.unix.path) unlink(Run.httpd.socket.unix.path); } bool Engine_addAllow(char *pattern) { assert(pattern); if (_parseNetwork(pattern) || _parseHost(pattern)) return true; return false; } bool Engine_hasAllow(void) { return allowlist ? true : false; } void Engine_destroyAllow(void) { for (HostsAllow_T current = allowlist, next = NULL; current; current = next) { next = current->next; FREE(current); } allowlist = NULL; } monit-5.35.2/src/http/cervlet.c0000644000016400001720000050241415007061157013236 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDBOOL_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_CTYPE_H #include #endif // libmonit #include "system/Time.h" #include "util/Fmt.h" #include "util/List.h" #include "monit.h" #include "cervlet.h" #include "engine.h" #include "processor.h" #include "base64.h" #include "event.h" #include "alert.h" #include "ProcessTree.h" #include "device.h" #include "protocol.h" #include "TextColor.h" #include "TextBox.h" #define ACTION(c) ! strncasecmp(req->url, c, sizeof(c)) /* URL Commands supported */ #define HOME "/" #define TEST "/_monit" #define ABOUT "/_about" #define PING "/_ping" #define GETID "/_getid" #define STATUS "/_status" #define STATUS2 "/_status2" #define SUMMARY "/_summary" #define REPORT "/_report" #define RUNTIME "/_runtime" #define VIEWLOG "/_viewlog" #define DOACTION "/_doaction" #define FAVICON "/favicon.ico" // Limit for the viewlog response #define VIEWLOG_LIMIT 1048576 typedef enum { TXT = 0, HTML } Output_Type; typedef struct ServiceMap_T { int found; union { struct { const char *name; const char *token; Action_Type id; } action; struct { HttpResponse res; } status; struct { TextBox_T box; } summary; } data; } *ServiceMap_T; typedef struct ReportStatics_T { float up; float down; float init; float unmonitored; float total; } *ReportStatics_T; /* Private prototypes */ static bool is_readonly(HttpRequest); static void printFavicon(HttpResponse); static void doGet(HttpRequest, HttpResponse); static void doPost(HttpRequest, HttpResponse); static void do_head(HttpResponse res, const char *path, const char *name, int refresh); static void do_foot(HttpResponse res); static void do_home(HttpResponse); static void do_home_system(HttpResponse); static void do_home_filesystem(HttpResponse); static void do_home_directory(HttpResponse); static void do_home_file(HttpResponse); static void do_home_fifo(HttpResponse); static void do_home_net(HttpResponse); static void do_home_process(HttpResponse); static void do_home_program(HttpResponse); static void do_home_host(HttpResponse); static void do_about(HttpResponse); static void do_ping(HttpResponse); static void do_getid(HttpResponse); static void do_runtime(HttpRequest, HttpResponse); static void do_viewlog(HttpRequest, HttpResponse); static void handle_service(HttpRequest, HttpResponse); static void handle_service_action(HttpRequest, HttpResponse); static void handle_doaction(HttpRequest, HttpResponse); static void handle_runtime(HttpRequest, HttpResponse); static void handle_runtime_action(HttpRequest, HttpResponse); static void is_monit_running(HttpResponse); static void do_service(HttpRequest, HttpResponse, Service_T); static void print_alerts(HttpResponse, Mail_T); static void print_buttons(HttpRequest, HttpResponse, Service_T); static void print_service_rules_timeout(HttpResponse, Service_T); static void print_service_rules_nonexistence(HttpResponse, Service_T); static void print_service_rules_existence(HttpResponse, Service_T); static void print_service_rules_port(HttpResponse, Service_T); static void print_service_rules_socket(HttpResponse, Service_T); static void print_service_rules_icmp(HttpResponse, Service_T); static void print_service_rules_perm(HttpResponse, Service_T); static void print_service_rules_uid(HttpResponse, Service_T); static void print_service_rules_euid(HttpResponse, Service_T); static void print_service_rules_gid(HttpResponse, Service_T); static void print_service_rules_timestamp(HttpResponse, Service_T); static void print_service_rules_fsflags(HttpResponse, Service_T); static void print_service_rules_filesystem(HttpResponse, Service_T); static void print_service_rules_size(HttpResponse, Service_T); static void print_service_rules_nlink(HttpResponse, Service_T); static void print_service_rules_linkstatus(HttpResponse, Service_T); static void print_service_rules_linkspeed(HttpResponse, Service_T); static void print_service_rules_linksaturation(HttpResponse, Service_T); static void print_service_rules_uploadbytes(HttpResponse, Service_T); static void print_service_rules_uploadpackets(HttpResponse, Service_T); static void print_service_rules_downloadbytes(HttpResponse, Service_T); static void print_service_rules_downloadpackets(HttpResponse, Service_T); static void print_service_rules_uptime(HttpResponse, Service_T); static void print_service_rules_content(HttpResponse, Service_T); static void print_service_rules_checksum(HttpResponse, Service_T); static void print_service_rules_pid(HttpResponse, Service_T); static void print_service_rules_ppid(HttpResponse, Service_T); static void print_service_rules_program(HttpResponse, Service_T); static void print_service_rules_resource(HttpResponse, Service_T); static void print_service_rules_secattr(HttpResponse, Service_T); static void print_service_rules_filedescriptors(HttpResponse, Service_T); static void print_status(HttpRequest, HttpResponse, int); static void print_summary(HttpRequest, HttpResponse); static void _printReport(HttpRequest req, HttpResponse res); static void status_service_txt(Service_T, HttpResponse); static char *get_monitoring_status(Output_Type, Service_T s, char *, int); static char *get_service_status(Output_Type, Service_T, char *, int); /** * Implementation of doGet and doPost routines used by the cervlet * processor module. This particilary cervlet will provide * information about the monit daemon and programs monitored by * monit. * * @file */ /* ------------------------------------------------------------------ Public */ /** * Callback hook to the Processor module for registering this modules * doGet and doPost methods. */ void init_service(void) { add_Impl(doGet, doPost); } /* ----------------------------------------------------------------- Private */ static void _printServiceSummary(TextBox_T t, Service_T s) { TextBox_setColumn(t, 1, "%s", s->name); TextBox_setColumn(t, 2, "%s", get_service_status(TXT, s, (char[STRLEN]){}, STRLEN)); TextBox_setColumn(t, 3, "%s", Servicetype_Names[s->type]); TextBox_printRow(t); } static void _serviceMapByName(const char *pattern, void (*callback)(Service_T s, ServiceMap_T ap), ServiceMap_T ap) { // Check the service name using the following sequence: // 1) if the pattern is NULL, any service will match // 2) backard compatibility: before monit 5.28.0 there was no support for regular expresion => check verbatim match before trying regex (the service may contain special characters) // 3) regex match if (pattern) { int rv; regex_t r; char patternEscaped[STRLEN]; const char *patternCursor; // If the pattern doesn't contain "^" or "$" already, wrap it as "^$" to prevent match with services that contain the given substring only if (! Str_has("^$", pattern)) { snprintf(patternEscaped, sizeof(patternEscaped), "^%s$", pattern); patternCursor = patternEscaped; } else { patternCursor = pattern; } // The pattern is set, try to compile it as regex if ((rv = regcomp(&r, patternCursor, REG_NOSUB | REG_EXTENDED | REG_ICASE))) { // Pattern compilation failed, fallback to verbatim match (before monit 5.28.0 there was no support for regular expresion) char error[STRLEN]; regerror(rv, &r, error, STRLEN); regfree(&r); DEBUG("Regex %s parsing error: %s\n", patternCursor, error); for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (IS(pattern, s->name)) { // Use the unescaped/original pattern callback(s, ap); ap->found++; } } } else { // Regular expression match for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (! regexec(&r, s->name, 0, NULL, 0)) { callback(s, ap); ap->found++; } } regfree(&r); } } else { // Pattern is not set, any service will match for (Service_T s = Service_List_Conf; s; s = s->next_conf) { callback(s, ap); ap->found++; } } } static void _serviceMapByType(Service_Type type, void (*callback)(Service_T s, ServiceMap_T ap), ServiceMap_T ap) { for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type == type) { callback(s, ap); ap->found++; } } } static void _serviceMapSummary(Service_T s, ServiceMap_T ap) { _printServiceSummary(ap->data.summary.box, s); } static void _serviceMapStatus(Service_T s, ServiceMap_T ap) { status_service_txt(s, ap->data.status.res); } static void _serviceMapAction(Service_T s, ServiceMap_T ap) { s->doaction = ap->data.action.id; Log_info("'%s' %s on user request\n", s->name, ap->data.action.name); } static char *_getUptime(time_t delta, char s[256]) { static int min = 60; static int hour = 3600; static int day = 86400; long rest_d; long rest_h; long rest_m; char *p = s; if (delta < 0) { *s = 0; } else { if ((rest_d = delta / day) > 0) { p += snprintf(p, 256 - (p - s), "%ldd ", rest_d); delta -= rest_d * day; } if ((rest_h = delta / hour) > 0 || (rest_d > 0)) { p += snprintf(p, 256 - (p - s), "%ldh ", rest_h); delta -= rest_h * hour; } rest_m = delta / min; snprintf(p, 256 - (p - s), "%ldm", rest_m); } return s; } __attribute__((format (printf, 7, 8))) static void _formatStatus(const char *name, Event_Type errorType, Output_Type type, HttpResponse res, Service_T s, bool validValue, const char *value, ...) { if (type == HTML) { StringBuffer_append(res->outputbuffer, "%c%s", toupper(name[0]), name + 1); } else { StringBuffer_append(res->outputbuffer, " %-28s ", name); } if (! validValue) { StringBuffer_append(res->outputbuffer, type == HTML ? "-" : COLOR_DARKGRAY "-" COLOR_RESET); } else { va_list ap; va_start(ap, value); char *_value = Str_vcat(value, ap); va_end(ap); if (errorType != Event_Null && s->error & errorType) StringBuffer_append(res->outputbuffer, type == HTML ? "" : COLOR_LIGHTRED); else StringBuffer_append(res->outputbuffer, type == HTML ? "" : COLOR_DEFAULT); if (type == HTML) { // If the output contains multiple line, wrap use
, otherwise keep as is
                        bool multiline = strrchr(_value, '\n') ? true : false;
                        if (multiline)
                                StringBuffer_append(res->outputbuffer, "
");
                        escapeHTML(res->outputbuffer, _value);
                        StringBuffer_append(res->outputbuffer, "%s", multiline ? "
" : ""); } else { int column = 0; for (int i = 0; _value[i]; i++) { if (_value[i] == '\r') { // Discard CR continue; } else if (_value[i] == '\n') { // Indent 2nd+ line if (_value[i + 1]) StringBuffer_append(res->outputbuffer, "\n "); column = 0; continue; } else if (column <= 200) { StringBuffer_append(res->outputbuffer, "%c", _value[i]); column++; } } StringBuffer_append(res->outputbuffer, COLOR_RESET); } FREE(_value); } StringBuffer_append(res->outputbuffer, type == HTML ? "" : "\n"); } static void _printIOStatistics(Output_Type type, HttpResponse res, Service_T s, IOStatistics_T io, const char *name) { char header[STRLEN] = {}; if (Statistics_initialized(&(io->bytes))) { snprintf(header, sizeof(header), "%s bytes", name); double deltaBytesPerSec = Statistics_deltaNormalize(&(io->bytes)); _formatStatus(header, Event_Resource, type, res, s, true, "%s/s [%s total]", Fmt_bytes2str(deltaBytesPerSec, (char[10]){}), Fmt_bytes2str(Statistics_raw(&(io->bytes)), (char[10]){})); } if (Statistics_initialized(&(io->bytesPhysical))) { snprintf(header, sizeof(header), "disk %s bytes", name); double deltaBytesPerSec = Statistics_deltaNormalize(&(io->bytesPhysical)); _formatStatus(header, Event_Resource, type, res, s, true, "%s/s [%s total]", Fmt_bytes2str(deltaBytesPerSec, (char[10]){}), Fmt_bytes2str(Statistics_raw(&(io->bytesPhysical)), (char[10]){})); } if (Statistics_initialized(&(io->operations))) { snprintf(header, sizeof(header), "disk %s operations", name); double deltaOpsPerSec = Statistics_deltaNormalize(&(io->operations)); _formatStatus(header, Event_Resource, type, res, s, true, "%.1f %ss/s [%llu %ss total]", deltaOpsPerSec, name, Statistics_raw(&(io->operations)), name); } } static void _printStatus(Output_Type type, HttpResponse res, Service_T s) { if (Util_hasServiceStatus(s)) { switch (s->type) { case Service_System: { _formatStatus("load average", Event_Resource, type, res, s, true, "[%.2f] [%.2f] [%.2f]", System_Info.loadavg[0], System_Info.loadavg[1], System_Info.loadavg[2]); StringBuffer_T sb = StringBuffer_create(256); if (System_Info.statisticsAvailable & Statistics_CpuUser) StringBuffer_append(sb, "%.1f%%usr ", System_Info.cpu.usage.user > 0. ? System_Info.cpu.usage.user : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSystem) StringBuffer_append(sb, "%.1f%%sys ", System_Info.cpu.usage.system > 0. ? System_Info.cpu.usage.system : 0.); if (System_Info.statisticsAvailable & Statistics_CpuNice) StringBuffer_append(sb, "%.1f%%nice ", System_Info.cpu.usage.nice > 0. ? System_Info.cpu.usage.nice : 0.); if (System_Info.statisticsAvailable & Statistics_CpuIOWait) StringBuffer_append(sb, "%.1f%%iowait ", System_Info.cpu.usage.iowait > 0. ? System_Info.cpu.usage.iowait : 0.); if (System_Info.statisticsAvailable & Statistics_CpuHardIRQ) StringBuffer_append(sb, "%.1f%%hardirq ", System_Info.cpu.usage.hardirq > 0. ? System_Info.cpu.usage.hardirq : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSoftIRQ) StringBuffer_append(sb, "%.1f%%softirq ", System_Info.cpu.usage.softirq > 0. ? System_Info.cpu.usage.softirq : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSteal) StringBuffer_append(sb, "%.1f%%steal ", System_Info.cpu.usage.steal > 0. ? System_Info.cpu.usage.steal : 0.); if (System_Info.statisticsAvailable & Statistics_CpuGuest) StringBuffer_append(sb, "%.1f%%guest ", System_Info.cpu.usage.guest > 0. ? System_Info.cpu.usage.guest : 0.); if (System_Info.statisticsAvailable & Statistics_CpuGuestNice) StringBuffer_append(sb, "%.1f%%guestnice ", System_Info.cpu.usage.guest_nice > 0. ? System_Info.cpu.usage.guest_nice : 0.); _formatStatus("cpu", Event_Resource, type, res, s, true, "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); _formatStatus("memory usage", Event_Resource, type, res, s, true, "%s [%.1f%%]", Fmt_bytes2str(System_Info.memory.usage.bytes, (char[10]){}), System_Info.memory.usage.percent); _formatStatus("swap usage", Event_Resource, type, res, s, true, "%s [%.1f%%]", Fmt_bytes2str(System_Info.swap.usage.bytes, (char[10]){}), System_Info.swap.usage.percent); _formatStatus("uptime", Event_Uptime, type, res, s, System_Info.booted > 0, "%s", _getUptime(Time_now() - System_Info.booted, (char[256]){})); _formatStatus("boot time", Event_Null, type, res, s, true, "%s", Time_localStr(System_Info.booted, (char[32]){})); if (System_Info.statisticsAvailable & Statistics_FiledescriptorsPerSystem) { if (System_Info.filedescriptors.maximum > 0) _formatStatus("filedescriptors", Event_Resource, type, res, s, true, "%lld [%.1f%% of %lld limit]", System_Info.filedescriptors.allocated, (float)100 * (float)System_Info.filedescriptors.allocated / (float)System_Info.filedescriptors.maximum, System_Info.filedescriptors.maximum); else _formatStatus("filedescriptors", Event_Resource, type, res, s, true, "N/A"); } } break; case Service_File: _formatStatus("permission", Event_Permission, type, res, s, s->inf.file->mode >= 0, "%o", s->inf.file->mode & 07777); _formatStatus("uid", Event_Uid, type, res, s, s->inf.file->uid >= 0, "%d", s->inf.file->uid); _formatStatus("gid", Event_Gid, type, res, s, s->inf.file->gid >= 0, "%d", s->inf.file->gid); _formatStatus("size", Event_Size, type, res, s, s->inf.file->size >= 0, "%s", Fmt_bytes2str(s->inf.file->size, (char[10]){})); _formatStatus("hardlink", Event_Resource, type, res, s, s->inf.file->nlink != -1LL, "%llu", (unsigned long long)s->inf.file->nlink); _formatStatus("access timestamp", Event_Timestamp, type, res, s, s->inf.file->timestamp.access > 0, "%s", Time_localStr(s->inf.file->timestamp.access, (char[32]){})); _formatStatus("change timestamp", Event_Timestamp, type, res, s, s->inf.file->timestamp.change > 0, "%s", Time_localStr(s->inf.file->timestamp.change, (char[32]){})); _formatStatus("modify timestamp", Event_Timestamp, type, res, s, s->inf.file->timestamp.modify > 0, "%s", Time_localStr(s->inf.file->timestamp.modify, (char[32]){})); if (s->matchlist) _formatStatus("content match", Event_Content, type, res, s, true, "%s", (s->error & Event_Content) ? "yes" : "no"); if (s->checksum) _formatStatus("checksum", Event_Checksum, type, res, s, *s->inf.file->cs_sum, "%s (%s)", s->inf.file->cs_sum, Checksum_Names[s->checksum->type]); break; case Service_Directory: _formatStatus("permission", Event_Permission, type, res, s, s->inf.directory->mode >= 0, "%o", s->inf.directory->mode & 07777); _formatStatus("uid", Event_Uid, type, res, s, s->inf.directory->uid >= 0, "%d", s->inf.directory->uid); _formatStatus("gid", Event_Gid, type, res, s, s->inf.directory->gid >= 0, "%d", s->inf.directory->gid); _formatStatus("hardlink", Event_Resource, type, res, s, s->inf.directory->nlink != -1LL, "%llu", (unsigned long long)s->inf.directory->nlink); _formatStatus("access timestamp", Event_Timestamp, type, res, s, s->inf.directory->timestamp.access > 0, "%s", Time_localStr(s->inf.directory->timestamp.access, (char[32]){})); _formatStatus("change timestamp", Event_Timestamp, type, res, s, s->inf.directory->timestamp.change > 0, "%s", Time_localStr(s->inf.directory->timestamp.change, (char[32]){})); _formatStatus("modify timestamp", Event_Timestamp, type, res, s, s->inf.directory->timestamp.modify > 0, "%s", Time_localStr(s->inf.directory->timestamp.modify, (char[32]){})); break; case Service_Fifo: _formatStatus("permission", Event_Permission, type, res, s, s->inf.fifo->mode >= 0, "%o", s->inf.fifo->mode & 07777); _formatStatus("uid", Event_Uid, type, res, s, s->inf.fifo->uid >= 0, "%d", s->inf.fifo->uid); _formatStatus("gid", Event_Gid, type, res, s, s->inf.fifo->gid >= 0, "%d", s->inf.fifo->gid); _formatStatus("hardlink", Event_Resource, type, res, s, s->inf.fifo->nlink != -1LL, "%llu", (unsigned long long)s->inf.fifo->nlink); _formatStatus("access timestamp", Event_Timestamp, type, res, s, s->inf.fifo->timestamp.access > 0, "%s", Time_localStr(s->inf.fifo->timestamp.access, (char[32]){})); _formatStatus("change timestamp", Event_Timestamp, type, res, s, s->inf.fifo->timestamp.change > 0, "%s", Time_localStr(s->inf.fifo->timestamp.change, (char[32]){})); _formatStatus("modify timestamp", Event_Timestamp, type, res, s, s->inf.fifo->timestamp.modify > 0, "%s", Time_localStr(s->inf.fifo->timestamp.modify, (char[32]){})); break; case Service_Net: { long long speed = Link_getSpeed(s->inf.net->stats); long long ierrors = Link_getErrorsInPerSecond(s->inf.net->stats); long long oerrors = Link_getErrorsOutPerSecond(s->inf.net->stats); long long ibytes = Link_getBytesInPerSecond(s->inf.net->stats); long long obytes = Link_getBytesOutPerSecond(s->inf.net->stats); long long ipackets = Link_getPacketsInPerSecond(s->inf.net->stats); long long opackets = Link_getPacketsOutPerSecond(s->inf.net->stats); if (ierrors >= 0 && oerrors >= 0) { _formatStatus("link", Event_Link, type, res, s, Link_getState(s->inf.net->stats) == 1, "%lld errors", ierrors + oerrors); } if (ibytes >= 0 && obytes >= 0) { if (speed > 0) { _formatStatus("capacity", Event_Speed, type, res, s, Link_getState(s->inf.net->stats) == 1, "%.0lf Mb/s %s-duplex", (double)speed / 1000000., Link_getDuplex(s->inf.net->stats) == 1 ? "full" : "half"); _formatStatus("download bytes", Event_ByteIn, type, res, s, Link_getState(s->inf.net->stats) == 1, "%s/s (%.1f%% link saturation)", Fmt_bytes2str(ibytes, (char[10]){}), 100. * ibytes * 8 / (double)speed); _formatStatus("upload bytes", Event_ByteOut, type, res, s, Link_getState(s->inf.net->stats) == 1, "%s/s (%.1f%% link saturation)", Fmt_bytes2str(obytes, (char[10]){}), 100. * obytes * 8 / (double)speed); } else { _formatStatus("download bytes", Event_ByteIn, type, res, s, Link_getState(s->inf.net->stats) == 1, "%s/s", Fmt_bytes2str(ibytes, (char[10]){})); _formatStatus("upload bytes", Event_ByteOut, type, res, s, Link_getState(s->inf.net->stats) == 1, "%s/s", Fmt_bytes2str(obytes, (char[10]){})); } } if (ipackets >= 0) { _formatStatus("download packets", Event_PacketIn, type, res, s, Link_getState(s->inf.net->stats) == 1, "%lld per second", ipackets); } if (opackets >= 0) { _formatStatus("upload packets", Event_PacketOut, type, res, s, Link_getState(s->inf.net->stats) == 1, "%lld per second", opackets); } } break; case Service_Filesystem: _formatStatus("filesystem type", Event_Null, type, res, s, *(s->inf.filesystem->object.type), "%s", s->inf.filesystem->object.type); _formatStatus("filesystem flags", Event_FsFlag, type, res, s, *(s->inf.filesystem->flags.current), "%s", s->inf.filesystem->flags.current); _formatStatus("permission", Event_Permission, type, res, s, s->inf.filesystem->mode >= 0, "%o", s->inf.filesystem->mode & 07777); _formatStatus("uid", Event_Uid, type, res, s, s->inf.filesystem->uid >= 0, "%d", s->inf.filesystem->uid); _formatStatus("gid", Event_Gid, type, res, s, s->inf.filesystem->gid >= 0, "%d", s->inf.filesystem->gid); _formatStatus("block size", Event_Null, type, res, s, true, "%s", Fmt_bytes2str(s->inf.filesystem->f_bsize, (char[10]){})); _formatStatus("space total", Event_Null, type, res, s, true, "%s (of which %.1f%% is reserved for root user)", s->inf.filesystem->f_bsize > 0 ? Fmt_bytes2str(s->inf.filesystem->f_blocks * s->inf.filesystem->f_bsize, (char[10]){}) : "0 MB", s->inf.filesystem->f_blocks > 0 ? ((float)100 * (float)(s->inf.filesystem->f_blocksfreetotal - s->inf.filesystem->f_blocksfree) / (float)s->inf.filesystem->f_blocks) : 0); _formatStatus("space free for non superuser", Event_Null, type, res, s, true, "%s [%.1f%%]", s->inf.filesystem->f_bsize > 0 ? Fmt_bytes2str(s->inf.filesystem->f_blocksfree * s->inf.filesystem->f_bsize, (char[10]){}) : "0 MB", s->inf.filesystem->f_blocks > 0 ? ((float)100 * (float)s->inf.filesystem->f_blocksfree / (float)s->inf.filesystem->f_blocks) : 0); _formatStatus("space free total", Event_Resource, type, res, s, true, "%s [%.1f%%]", s->inf.filesystem->f_bsize > 0 ? Fmt_bytes2str(s->inf.filesystem->f_blocksfreetotal * s->inf.filesystem->f_bsize, (char[10]){}) : "0 MB", s->inf.filesystem->f_blocks > 0 ? ((float)100 * (float)s->inf.filesystem->f_blocksfreetotal / (float)s->inf.filesystem->f_blocks) : 0); if (s->inf.filesystem->f_files > 0) { _formatStatus("inodes total", Event_Null, type, res, s, true, "%lld", s->inf.filesystem->f_files); if (s->inf.filesystem->f_filesfree > 0) _formatStatus("inodes free", Event_Resource, type, res, s, true, "%lld [%.1f%%]", s->inf.filesystem->f_filesfree, (float)100 * (float)s->inf.filesystem->f_filesfree / (float)s->inf.filesystem->f_files); } _printIOStatistics(type, res, s, &(s->inf.filesystem->read), "read"); _printIOStatistics(type, res, s, &(s->inf.filesystem->write), "write"); bool hasReadTime = Statistics_initialized(&(s->inf.filesystem->time.read)); bool hasWriteTime = Statistics_initialized(&(s->inf.filesystem->time.write)); bool hasWaitTime = Statistics_initialized(&(s->inf.filesystem->time.wait)); bool hasRunTime = Statistics_initialized(&(s->inf.filesystem->time.run)); double deltaOperations = Statistics_delta(&(s->inf.filesystem->read.operations)) + Statistics_delta(&(s->inf.filesystem->write.operations)); if (hasReadTime && hasWriteTime) { double readTime = deltaOperations > 0. ? Statistics_deltaNormalize(&(s->inf.filesystem->time.read)) / deltaOperations : 0.; double writeTime = deltaOperations > 0. ? Statistics_deltaNormalize(&(s->inf.filesystem->time.write)) / deltaOperations : 0.; _formatStatus("service time", Event_Null, type, res, s, true, "%.3f ms/operation (of which read %.3f ms, write %.3f ms)", readTime + writeTime, readTime, writeTime); } else if (hasWaitTime && hasRunTime) { double waitTime = deltaOperations > 0. ? Statistics_deltaNormalize(&(s->inf.filesystem->time.wait)) / deltaOperations : 0.; double runTime = deltaOperations > 0. ? Statistics_deltaNormalize(&(s->inf.filesystem->time.run)) / deltaOperations : 0.; _formatStatus("service time", Event_Null, type, res, s, true, "%.3f ms/operation (of which queue %.3f ms, active %.3f ms)", waitTime + runTime, waitTime, runTime); } else if (hasWaitTime) { double waitTime = deltaOperations > 0. ? Statistics_deltaNormalize(&(s->inf.filesystem->time.wait)) / deltaOperations : 0.; _formatStatus("service time", Event_Null, type, res, s, true, "%.3f ms/operation", waitTime); } else if (hasRunTime) { double runTime = deltaOperations > 0. ? Statistics_deltaNormalize(&(s->inf.filesystem->time.run)) / deltaOperations : 0.; _formatStatus("service time", Event_Null, type, res, s, true, "%.3f ms/operation", runTime); } break; case Service_Process: _formatStatus("pid", Event_Pid, type, res, s, s->inf.process->pid >= 0, "%d", s->inf.process->pid); _formatStatus("parent pid", Event_PPid, type, res, s, s->inf.process->ppid >= 0, "%d", s->inf.process->ppid); _formatStatus("uid", Event_Uid, type, res, s, s->inf.process->uid >= 0, "%d", s->inf.process->uid); _formatStatus("effective uid", Event_Uid, type, res, s, s->inf.process->euid >= 0, "%d", s->inf.process->euid); _formatStatus("gid", Event_Gid, type, res, s, s->inf.process->gid >= 0, "%d", s->inf.process->gid); _formatStatus("uptime", Event_Uptime, type, res, s, s->inf.process->uptime >= 0, "%s", _getUptime(s->inf.process->uptime, (char[256]){})); if (Run.flags & Run_ProcessEngineEnabled) { _formatStatus("threads", Event_Resource, type, res, s, s->inf.process->threads >= 0, "%d", s->inf.process->threads); _formatStatus("children", Event_Resource, type, res, s, s->inf.process->children >= 0, "%d", s->inf.process->children); _formatStatus("cpu", Event_Resource, type, res, s, s->inf.process->cpu_percent >= 0, "%.1f%%", s->inf.process->cpu_percent); _formatStatus("cpu total", Event_Resource, type, res, s, s->inf.process->total_cpu_percent >= 0, "%.1f%%", s->inf.process->total_cpu_percent); _formatStatus("memory", Event_Resource, type, res, s, s->inf.process->mem_percent >= 0, "%.1f%% [%s]", s->inf.process->mem_percent, Fmt_bytes2str(s->inf.process->mem, (char[10]){})); _formatStatus("memory total", Event_Resource, type, res, s, s->inf.process->total_mem_percent >= 0, "%.1f%% [%s]", s->inf.process->total_mem_percent, Fmt_bytes2str(s->inf.process->total_mem, (char[10]){})); #ifdef LINUX _formatStatus("security attribute", Event_Invalid, type, res, s, *(s->inf.process->secattr), "%s", s->inf.process->secattr); long long limit = s->inf.process->filedescriptors.limit.soft < s->inf.process->filedescriptors.limit.hard ? s->inf.process->filedescriptors.limit.soft : s->inf.process->filedescriptors.limit.hard; if (limit > 0) _formatStatus("filedescriptors", Event_Resource, type, res, s, s->inf.process->filedescriptors.open != -1LL, "%lld [%.1f%% of %lld limit]", s->inf.process->filedescriptors.open, (float)100 * (float)s->inf.process->filedescriptors.open / (float)limit, limit); else _formatStatus("filedescriptors", Event_Resource, type, res, s, s->inf.process->filedescriptors.open != -1LL, "N/A"); _formatStatus("total filedescriptors", Event_Resource, type, res, s, s->inf.process->filedescriptors.openTotal != -1LL, "%lld", s->inf.process->filedescriptors.openTotal); #endif } _printIOStatistics(type, res, s, &(s->inf.process->read), "read"); _printIOStatistics(type, res, s, &(s->inf.process->write), "write"); break; case Service_Program: if (s->program->started) { _formatStatus("last exit value", Event_Status, type, res, s, true, "%d", s->program->exitStatus); _formatStatus("last output", Event_Status, type, res, s, StringBuffer_length(s->program->lastOutput), "%s", StringBuffer_toString(s->program->lastOutput)); } break; default: break; } for (Icmp_T i = s->icmplist; i; i = i->next) { if (i->is_available == Connection_Failed) _formatStatus("ping response time", i->check_invers ? Event_Null : Event_Icmp, type, res, s, true, "connection failed"); else _formatStatus("ping response time", i->check_invers ? Event_Icmp : Event_Null, type, res, s, i->is_available != Connection_Init && i->responsetime.current >= 0., "%s", Fmt_time2str(i->responsetime.current, (char[11]){})); } for (Port_T p = s->portlist; p; p = p->next) { if (p->is_available == Connection_Failed) { Event_Type highlight = p->check_invers ? Event_Null : Event_Connection; _formatStatus("port response time", highlight, type, res, s, true, "FAILED to [%s]:%d%s type %s/%s %sprotocol %s", p->hostname, p->target.net.port, Util_portRequestDescription(p), Util_portTypeDescription(p), Util_portIpDescription(p), p->target.net.ssl.options.flags ? "using TLS " : "", p->protocol->name); } else { char buf[STRLEN] = {}; if (p->target.net.ssl.options.flags) snprintf(buf, sizeof(buf), "using TLS (certificate valid for %d days) ", p->target.net.ssl.certificate.validDays); Event_Type highlight = p->check_invers ? Event_Connection : Event_Null; if (p->target.net.ssl.certificate.validDays < p->target.net.ssl.certificate.minimumDays) highlight |= Event_Timestamp; _formatStatus("port response time", highlight, type, res, s, p->is_available != Connection_Init, "%s to %s:%d%s type %s/%s %sprotocol %s", Fmt_time2str(p->responsetime.current, (char[11]){}), p->hostname, p->target.net.port, Util_portRequestDescription(p), Util_portTypeDescription(p), Util_portIpDescription(p), buf, p->protocol->name); } } for (Port_T p = s->socketlist; p; p = p->next) { if (p->is_available == Connection_Failed) { _formatStatus("unix socket response time", p->check_invers ? Event_Null : Event_Connection, type, res, s, true, "FAILED to %s type %s protocol %s", p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name); } else { _formatStatus("unix socket response time", p->check_invers ? Event_Connection : Event_Null, type, res, s, p->is_available != Connection_Init, "%s to %s type %s protocol %s", Fmt_time2str(p->responsetime.current, (char[11]){}), p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name); } } } _formatStatus("data collected", Event_Null, type, res, s, true, "%s", Time_localStr(s->collected.tv_sec, (char[32]){})); } __attribute__((format (printf, 5, 6))) static void _displayTableRow(HttpResponse res, bool escape, const char *class, const char *key, const char *value, ...) { va_list ap; va_start(ap, value); char *_value = Str_vcat(value, ap); va_end(ap); if (STR_DEF(class)) StringBuffer_append(res->outputbuffer, "%s", class, key); else StringBuffer_append(res->outputbuffer, "%s", key); if (escape) { // If the data contains multiple lines, wrap use
, otherwise keep as is
                bool multiline = strrchr(_value, '\n') ? true : false;
                if (multiline)
                        StringBuffer_append(res->outputbuffer, "
");
                escapeHTML(res->outputbuffer, _value);
                if (multiline)
                        StringBuffer_append(res->outputbuffer, "
"); } else { StringBuffer_append(res->outputbuffer, "%s", _value); } StringBuffer_append(res->outputbuffer, ""); FREE(_value); } static void _formatAction(HttpResponse res, const char *type, command_t cmd) { char key[STRLEN] = {}; snprintf(key, sizeof(key), "%s program", type); StringBuffer_T sb = StringBuffer_create(256); StringBuffer_append(sb, "'%s'", Util_commandDescription(cmd, (char[STRLEN]){})); if (cmd->has_uid) StringBuffer_append(sb, " as uid %d", cmd->uid); if (cmd->has_gid) StringBuffer_append(sb, " as gid %d", cmd->gid); StringBuffer_append(sb, " timeout %s", Fmt_time2str(cmd->timeout, (char[11]){})); _displayTableRow(res, true, NULL, key, "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } static void _formatAddress(HttpResponse res, const char *type, Address_T addr) { char key[STRLEN] = {}; snprintf(key, sizeof(key), "Default mail %s", type); if (addr->name) _displayTableRow(res, true, NULL, key, "%s <%s>", addr->name, addr->address); else _displayTableRow(res, true, NULL, key, "%s", addr->address); } /** * Called by the Processor (via the service method) * to handle a POST request. */ static void doPost(HttpRequest req, HttpResponse res) { set_content_type(res, "text/html"); if (ACTION(RUNTIME)) handle_runtime_action(req, res); else if (ACTION(VIEWLOG)) do_viewlog(req, res); else if (ACTION(STATUS)) print_status(req, res, 1); else if (ACTION(STATUS2)) print_status(req, res, 2); else if (ACTION(SUMMARY)) print_summary(req, res); else if (ACTION(REPORT)) _printReport(req, res); else if (ACTION(DOACTION)) handle_doaction(req, res); else handle_service_action(req, res); if (STR_DEF(req->url)) { // Send a proper status to handle errors if (res->status <= 300) { // #1009: Redirect back to the same url so a reload in the browser does not perform a POST again set_status(res, SC_MOVED_TEMPORARILY); set_header(res, "Location", "%s", req->url); } } } /** * Called by the Processor (via the service method) * to handle a GET request. */ static void doGet(HttpRequest req, HttpResponse res) { set_content_type(res, "text/html"); if (ACTION(HOME)) { LOCK(Run.mutex) do_home(res); END_LOCK; } else if (ACTION(RUNTIME)) { handle_runtime(req, res); } else if (ACTION(TEST)) { is_monit_running(res); } else if (ACTION(ABOUT)) { do_about(res); } else if (ACTION(FAVICON)) { printFavicon(res); } else if (ACTION(PING)) { do_ping(res); } else if (ACTION(GETID)) { do_getid(res); } else if (ACTION(STATUS)) { print_status(req, res, 1); } else if (ACTION(STATUS2)) { print_status(req, res, 2); } else if (ACTION(SUMMARY)) { print_summary(req, res); } else if (ACTION(REPORT)) { _printReport(req, res); } else if (ACTION(VIEWLOG)) { do_viewlog(req, res); } else { handle_service(req, res); } } /* ----------------------------------------------------------------- Helpers */ static void is_monit_running(HttpResponse res) { set_status(res, exist_daemon() ? SC_OK : SC_GONE); } static void printFavicon(HttpResponse res) { static size_t l; Socket_T S = res->S; static unsigned char *favicon = NULL; if (! favicon) { favicon = CALLOC(sizeof(unsigned char), strlen(FAVICON_ICO)); l = decode_base64(favicon, FAVICON_ICO); } if (l) { res->is_committed = true; Socket_print(S, "HTTP/1.0 200 OK\r\n"); Socket_print(S, "Content-length: %lu\r\n", (unsigned long)l); Socket_print(S, "Content-Type: image/x-icon\r\n"); Socket_print(S, "Connection: close\r\n\r\n"); if (Socket_write(S, favicon, l) < 0) { Log_error("Error sending favicon data -- %s\n", STRERROR); } } } static void do_head(HttpResponse res, const char *path, const char *name, int refresh) { StringBuffer_T system_htmlescaped = escapeHTML(StringBuffer_create(16), Run.system->name); StringBuffer_append(res->outputbuffer, ""\ ""\ ""\ "Monit: %s "\ ""\ " "\ " "\ " "\ "" \ ""\ ""\ "
" \ ""\ " "\ " "\ " "\ " "\ " "\ ""\ "
", StringBuffer_toString(system_htmlescaped), refresh, path, name, VERSION); StringBuffer_free(&system_htmlescaped); } static void do_foot(HttpResponse res) { StringBuffer_append(res->outputbuffer, "
" ""); } static void do_home(HttpResponse res) { do_head(res, "", "", Run.polltime); StringBuffer_T system_htmlescaped = escapeHTML(StringBuffer_create(16), Run.system->name); StringBuffer_append(res->outputbuffer, "" " " " " " " "", StringBuffer_toString(system_htmlescaped)); StringBuffer_free(&system_htmlescaped); do_home_system(res); do_home_process(res); do_home_program(res); do_home_filesystem(res); do_home_file(res); do_home_fifo(res); do_home_directory(res); do_home_net(res); do_home_host(res); do_foot(res); } static void do_about(HttpResponse res) { StringBuffer_append(res->outputbuffer, "about monit" "

" "monit " VERSION "

"); StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, "
"); StringBuffer_append(res->outputbuffer, "

This program is free software; you can redistribute it and/or " "modify it under the terms of the GNU Affero General Public License version 3

" "

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 AFFERO GENERAL PUBLIC LICENSE for more details.

"); StringBuffer_append(res->outputbuffer, "

[Back to Monit]

"); } static void do_ping(HttpResponse res) { StringBuffer_append(res->outputbuffer, "pong"); } static void do_getid(HttpResponse res) { escapeHTML(res->outputbuffer, Run.id); } static void do_runtime(HttpRequest req, HttpResponse res) { int pid = exist_daemon(); char buf[STRLEN]; do_head(res, "_runtime", "Runtime", 1000); StringBuffer_append(res->outputbuffer, "

Monit runtime status

"); StringBuffer_append(res->outputbuffer, "" "" ""); _displayTableRow(res, true, NULL, "Monit ID", "%s", Run.id); _displayTableRow(res, true, NULL, "Host", "%s", Run.system->name); _displayTableRow(res, false, NULL, "Process id", "%d", pid); _displayTableRow(res, true, NULL, "Effective user running Monit", "%s", Run.Env.user); _displayTableRow(res, true, NULL, "Controlfile", "%s", Run.files.control); if (Run.files.log) _displayTableRow(res, true, NULL, "Logfile", "%s", Run.files.log); _displayTableRow(res, true, NULL, "Pidfile", "%s", Run.files.pid); _displayTableRow(res, true, NULL, "State file", "%s", Run.files.state); _displayTableRow(res, true, NULL, "Debug", "%s", Run.debug ? "True" : "False"); _displayTableRow(res, true, NULL, "Log", "%s", (Run.flags & Run_Log) ? "True" : "False"); _displayTableRow(res, true, NULL, "Use syslog", "%s", (Run.flags & Run_UseSyslog) ? "True" : "False"); if (Run.eventlist_dir) { if (Run.eventlist_slots < 0) _displayTableRow(res, true, NULL, "Event queue", "base directory %s with unlimited slots", Run.eventlist_dir); else _displayTableRow(res, true, NULL, "Event queue", "base directory %s with %d slots", Run.eventlist_dir, Run.eventlist_slots); } #ifdef HAVE_OPENSSL { char opt[STRLEN] = {}; const char *options = Ssl_printOptions(&(Run.ssl), opt, STRLEN); if (options && *options) _displayTableRow(res, true, NULL, "SSL options", "%s", options); } #endif if (Run.mmonits) { StringBuffer_append(res->outputbuffer, ""); } if (Run.mailservers) { StringBuffer_append(res->outputbuffer, ""); } if (Run.MailFormat.from) _formatAddress(res, "from", Run.MailFormat.from); if (Run.MailFormat.replyto) _formatAddress(res, "reply to", Run.MailFormat.replyto); if (Run.MailFormat.subject) _displayTableRow(res, true, NULL, "Default mail subject", "%s", Run.MailFormat.subject); if (Run.MailFormat.message) _displayTableRow(res, true, NULL, "Default mail message", "%s", Run.MailFormat.message); _displayTableRow(res, false, NULL, "Limit for Send/Expect buffer", "%s", Fmt_bytes2str(Run.limits.sendExpectBuffer, buf)); _displayTableRow(res, false, NULL, "Limit for file content buffer", "%s", Fmt_bytes2str(Run.limits.fileContentBuffer, buf)); _displayTableRow(res, false, NULL, "Limit for HTTP content buffer", "%s", Fmt_bytes2str(Run.limits.httpContentBuffer, buf)); _displayTableRow(res, false, NULL, "Limit for program output", "%s", Fmt_bytes2str(Run.limits.programOutput, buf)); _displayTableRow(res, false, NULL, "Limit for network timeout", "%s", Fmt_time2str(Run.limits.networkTimeout, (char[11]){})); _displayTableRow(res, false, NULL, "Limit for check program timeout", "%s", Fmt_time2str(Run.limits.programTimeout, (char[11]){})); _displayTableRow(res, false, NULL, "Limit for service stop timeout", "%s", Fmt_time2str(Run.limits.stopTimeout, (char[11]){})); _displayTableRow(res, false, NULL, "Limit for service start timeout", "%s", Fmt_time2str(Run.limits.startTimeout, (char[11]){})); _displayTableRow(res, false, NULL, "Limit for service restart timeout", "%s", Fmt_time2str(Run.limits.restartTimeout, (char[11]){})); _displayTableRow(res, false, NULL, "Limit for test action exec timeout","%s", Fmt_time2str(Run.limits.execTimeout, (char[11]){})); _displayTableRow(res, false, NULL, "On reboot", "%s", onReboot_Names[Run.onreboot]); _displayTableRow(res, false, NULL, "Poll time", "%d seconds with start delay %d seconds", Run.polltime, Run.startdelay); if (Run.httpd.flags & Httpd_Net) { _displayTableRow(res, true, NULL, "httpd bind address", "%s", Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "Any/All"); _displayTableRow(res, false, NULL, "httpd portnumber", "%d", Run.httpd.socket.net.port); _displayTableRow(res, false, NULL, "httpd net readonly", "%s", Run.httpd.socket.net.readonly ? "True" : "False"); #ifdef HAVE_OPENSSL const char *options = Ssl_printOptions(&(Run.httpd.socket.net.ssl), (char[STRLEN]){}, STRLEN); if (options && *options) _displayTableRow(res, false, NULL, "httpd encryption", "%s", options); #endif } if (Run.httpd.flags & Httpd_Unix) { _displayTableRow(res, true, NULL, "httpd unix socket", "%s", Run.httpd.socket.unix.path); _displayTableRow(res, false, NULL, "httpd unix readonly", "%s", Run.httpd.socket.unix.readonly ? "True" : "False"); } _displayTableRow(res, false, NULL, "httpd signature", "%s", Run.httpd.flags & Httpd_Signature ? "True" : "False"); _displayTableRow(res, false, NULL, "httpd auth. style", "%s", Run.httpd.credentials && Engine_hasAllow() ? "Basic Authentication and Host/Net allow list" : Run.httpd.credentials ? "Basic Authentication" : Engine_hasAllow() ? "Host/Net allow list" : "No authentication"); print_alerts(res, Run.maillist); StringBuffer_append(res->outputbuffer, "
ParameterValue
M/Monit server(s)"); for (Mmonit_T c = Run.mmonits; c; c = c->next) { escapeHTML(res->outputbuffer, c->url->url); StringBuffer_append(res->outputbuffer, "
  with timeout %s
", Fmt_time2str(c->timeout, (char[11]){})); #ifdef HAVE_OPENSSL if (c->ssl.flags) { StringBuffer_append(res->outputbuffer, "  using TLS"); const char *options = Ssl_printOptions(&c->ssl, (char[STRLEN]){}, STRLEN); if (options && *options) StringBuffer_append(res->outputbuffer, " with options {%s}", options); if (c->ssl.checksum) { StringBuffer_append(res->outputbuffer, " and certificate checksum %s equal to '", Checksum_Names[c->ssl.checksumType]); escapeHTML(res->outputbuffer, c->ssl.checksum); StringBuffer_append(res->outputbuffer, "'"); } StringBuffer_append(res->outputbuffer, "
"); } #endif if (Run.flags & Run_MmonitCredentials && c->url->user) StringBuffer_append(res->outputbuffer, "  with credentials
"); if (c->hostgroups) { int hostgroups = 0; StringBuffer_append(res->outputbuffer, "  with hostgroups ["); for (_list_t g = c->hostgroups->head; g; g = g->next) { StringBuffer_append(res->outputbuffer, "%s\"%s\"", hostgroups++ ? ", " : "", (const char *)g->e); } StringBuffer_append(res->outputbuffer, "]
"); } if (c->next) StringBuffer_append(res->outputbuffer, "
 "); } StringBuffer_append(res->outputbuffer, "
Mail server(s)"); for (MailServer_T mta = Run.mailservers; mta; mta = mta->next) { escapeHTML(res->outputbuffer, mta->host); StringBuffer_append(res->outputbuffer, ":%d", mta->port); #ifdef HAVE_OPENSSL if (mta->ssl.flags) { StringBuffer_append(res->outputbuffer, " using TLS"); char opt[STRLEN] = {}; const char *options = Ssl_printOptions(&mta->ssl, opt, STRLEN); if (options && *options) StringBuffer_append(res->outputbuffer, " with options {%s}", options); if (mta->ssl.checksum) { StringBuffer_append(res->outputbuffer, " and certificate checksum %s equal to '", Checksum_Names[mta->ssl.checksumType]); escapeHTML(res->outputbuffer, mta->ssl.checksum); StringBuffer_append(res->outputbuffer, "'"); } } #endif if (mta->next) StringBuffer_append(res->outputbuffer, "
 "); } StringBuffer_append(res->outputbuffer, "
"); if (! is_readonly(req)) { StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, "", res->token); StringBuffer_append(res->outputbuffer, "", res->token); if ((Run.flags & Run_Log) && ! (Run.flags & Run_UseSyslog)) { StringBuffer_append(res->outputbuffer, "", res->token); } StringBuffer_append(res->outputbuffer, "
" "
Stop Monit http server? " "" "" "" "
" "
" "
Force validate now? " "" "" "" "
" "
" "
View Monit logfile? " "" "" "
" "
"); } do_foot(res); } static void do_viewlog(HttpRequest req, HttpResponse res) { if (is_readonly(req)) { send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page"); return; } do_head(res, "_viewlog", "View log", 100); if ((Run.flags & Run_Log) && ! (Run.flags & Run_UseSyslog)) { FILE *f = fopen(Run.files.log, "r"); if (f) { size_t n; size_t total = 0; char buf[512]; StringBuffer_append(res->outputbuffer, "

"); } else { StringBuffer_append(res->outputbuffer, "Error opening logfile: %s", STRERROR); } } else { StringBuffer_append(res->outputbuffer, "Cannot view logfile:
"); if (! (Run.flags & Run_Log)) StringBuffer_append(res->outputbuffer, "Monit was started without logging"); else StringBuffer_append(res->outputbuffer, "Monit uses syslog"); } do_foot(res); } static void handle_service(HttpRequest req, HttpResponse res) { char *name = req->url; if (! name) { send_error(req, res, SC_NOT_FOUND, "Service name required"); return; } Service_T s = Util_getService(++name); if (! s) { send_error(req, res, SC_NOT_FOUND, "There is no service named \"%s\"", name); return; } do_service(req, res, s); } // Do action for the service (the service name is the last component of the URL path) static void handle_service_action(HttpRequest req, HttpResponse res) { char *name = req->url; if (! name) { send_error(req, res, SC_NOT_FOUND, "Service name required"); return; } struct ServiceMap_T ap = {.found = 0, .data.action.name = get_parameter(req, "action")}; if (ap.data.action.name) { if (is_readonly(req)) { send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page"); } else { ap.data.action.id = Util_getAction(ap.data.action.name); if (ap.data.action.id == Action_Ignored) { send_error(req, res, SC_BAD_REQUEST, "Invalid action \"%s\"", ap.data.action.name); } else { Service_T s = Util_getService(++name); if (! s) { send_error(req, res, SC_NOT_FOUND, "There is no service named \"%s\"", name); return; } _serviceMapAction(s, &ap); Run.flags |= Run_ActionPending; /* set the global flag */ do_wakeupcall(); do_service(req, res, s); } } } } // Do action for all services listed in "service" HTTP parameter (may have multiple value) static void handle_doaction(HttpRequest req, HttpResponse res) { struct ServiceMap_T ap = {.found = 0, .data.action.name = get_parameter(req, "action")}; if (ap.data.action.name) { if (is_readonly(req)) { send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page"); return; } else { if ((ap.data.action.id = Util_getAction(ap.data.action.name)) == Action_Ignored) { send_error(req, res, SC_BAD_REQUEST, "Invalid action \"%s\"", ap.data.action.name); return; } for (HttpParameter p = req->params; p; p = p->next) { if (IS(p->name, "service")) { _serviceMapByName(p->value, _serviceMapAction, &ap); if (ap.found == 0) { send_error(req, res, SC_BAD_REQUEST, "There is no service named \"%s\"", p->value ? p->value : ""); return; } } } if (ap.found > 0) { Run.flags |= Run_ActionPending; do_wakeupcall(); } } } } static void handle_runtime(HttpRequest req, HttpResponse res) { LOCK(Run.mutex) do_runtime(req, res); END_LOCK; } static void handle_runtime_action(HttpRequest req, HttpResponse res) { const char *action = get_parameter(req, "action"); if (action) { if (is_readonly(req)) { send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page"); return; } if (IS(action, "validate")) { Log_info("The Monit http server woke up on user request\n"); do_wakeupcall(); } else if (IS(action, "stop")) { Log_info("The Monit http server stopped on user request\n"); send_error(req, res, SC_SERVICE_UNAVAILABLE, "The Monit http server is stopped"); Engine_stop(); return; } } handle_runtime(req, res); } static void do_service(HttpRequest req, HttpResponse res, Service_T s) { assert(s); char buf[STRLEN] = {}; do_head(res, s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), Run.polltime); StringBuffer_append(res->outputbuffer, "

%s status

" "" "" "" "" "", Servicetype_Names[s->type]); _displayTableRow(res, true, NULL, "Name", "%s", s->name); if (s->type == Service_Process) _displayTableRow(res, true, NULL, s->matchlist ? "Match" : "Pid file", "%s", s->path); else if (s->type == Service_Host) _displayTableRow(res, true, NULL, "Address", "%s", s->path); else if (s->type == Service_Net) _displayTableRow(res, true, NULL, "Interface", "%s", s->path); else if (s->type != Service_System) _displayTableRow(res, true, NULL, "Path", "%s", s->path); _displayTableRow(res, false, NULL, "Status", "%s", get_service_status(HTML, s, buf, sizeof(buf))); for (ServiceGroup_T sg = Service_Group_List; sg; sg = sg->next) { for (_list_t m = sg->members->head; m; m = m->next) if (m->e == s) _displayTableRow(res, false, NULL, "Group", "%s", sg->name); } _displayTableRow(res, false, NULL, "Monitoring status", "%s", get_monitoring_status(HTML, s, buf, sizeof(buf))); _displayTableRow(res, false, NULL, "Monitoring mode", "%s", Mode_Names[s->mode]); _displayTableRow(res, false, NULL, "On reboot", "%s", onReboot_Names[s->onreboot]); for (Dependant_T d = s->dependantlist; d; d = d->next) { if (d->dependant != NULL) _displayTableRow(res, false, NULL, "Depends on service", "%s", d->dependant_urlescaped, StringBuffer_toString(d->dependant_htmlescaped)); } if (s->start) _formatAction(res, "Start", s->start); if (s->stop) _formatAction(res, "Stop", s->stop); if (s->restart) _formatAction(res, "Restart", s->restart); if (s->every.type != Every_Cycle) { if (s->every.type == Every_SkipCycles) _displayTableRow(res, false, NULL, "Check service", "every %d cycle", s->every.spec.cycle.number); else if (s->every.type == Every_Cron) _displayTableRow(res, false, NULL, "Check service", "every \"%s\"", s->every.spec.cron); else if (s->every.type == Every_NotInCron) _displayTableRow(res, false, NULL, "Check service", "not every \"%s\"", s->every.spec.cron); } _printStatus(HTML, res, s); // Rules print_service_rules_timeout(res, s); print_service_rules_nonexistence(res, s); print_service_rules_existence(res, s); print_service_rules_icmp(res, s); print_service_rules_port(res, s); print_service_rules_socket(res, s); print_service_rules_perm(res, s); print_service_rules_uid(res, s); print_service_rules_euid(res, s); print_service_rules_secattr(res, s); print_service_rules_filedescriptors(res, s); print_service_rules_gid(res, s); print_service_rules_timestamp(res, s); print_service_rules_fsflags(res, s); print_service_rules_filesystem(res, s); print_service_rules_size(res, s); print_service_rules_nlink(res, s); print_service_rules_linkstatus(res, s); print_service_rules_linkspeed(res, s); print_service_rules_linksaturation(res, s); print_service_rules_uploadbytes(res, s); print_service_rules_uploadpackets(res, s); print_service_rules_downloadbytes(res, s); print_service_rules_downloadpackets(res, s); print_service_rules_uptime(res, s); print_service_rules_content(res, s); print_service_rules_checksum(res, s); print_service_rules_pid(res, s); print_service_rules_ppid(res, s); print_service_rules_program(res, s); print_service_rules_resource(res, s); print_alerts(res, s->maillist); StringBuffer_append(res->outputbuffer, "
ParameterValue
"); print_buttons(req, res, s); do_foot(res); } static void do_home_system(HttpResponse res) { Service_T s = Run.system; char buf[STRLEN]; StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" "" "" "" "" "" "" ""); StringBuffer_append(res->outputbuffer, "", System_Info.memory.usage.percent, Fmt_bytes2str(System_Info.memory.usage.bytes, buf)); StringBuffer_append(res->outputbuffer, "", System_Info.swap.usage.percent, Fmt_bytes2str(System_Info.swap.usage.bytes, buf)); StringBuffer_append(res->outputbuffer, "" "
SystemStatusLoadCPUMemorySwap
%s%s[%.2f] [%.2f] [%.2f]", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf)), System_Info.loadavg[0], System_Info.loadavg[1], System_Info.loadavg[2]); if (System_Info.statisticsAvailable & Statistics_CpuUser) StringBuffer_append(res->outputbuffer, "%.1f%%us ", System_Info.cpu.usage.user > 0. ? System_Info.cpu.usage.user : 0.); if (System_Info.statisticsAvailable & Statistics_CpuSystem) StringBuffer_append(res->outputbuffer, "%.1f%%sy ", System_Info.cpu.usage.system > 0. ? System_Info.cpu.usage.system : 0.); if (System_Info.statisticsAvailable & Statistics_CpuNice) StringBuffer_append(res->outputbuffer, "%.1f%%ni ", System_Info.cpu.usage.nice > 0. ? System_Info.cpu.usage.nice : 0.); if (System_Info.statisticsAvailable & Statistics_CpuIOWait) StringBuffer_append(res->outputbuffer, "%.1f%%wa ", System_Info.cpu.usage.iowait > 0. ? System_Info.cpu.usage.iowait : 0.); StringBuffer_append(res->outputbuffer, "%.1f%% [%s]%.1f%% [%s]
"); } static void do_home_process(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Process) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? " class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! (Run.flags & Run_ProcessEngineEnabled) || ! Util_hasServiceStatus(s) || s->inf.process->uptime < 0) { StringBuffer_append(res->outputbuffer, ""); } else { StringBuffer_append(res->outputbuffer, "", _getUptime(s->inf.process->uptime, (char[256]){})); } if (! (Run.flags & Run_ProcessEngineEnabled) || ! Util_hasServiceStatus(s) || s->inf.process->total_cpu_percent < 0) { StringBuffer_append(res->outputbuffer, ""); } else { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", s->inf.process->total_cpu_percent); } if (! (Run.flags & Run_ProcessEngineEnabled) || ! Util_hasServiceStatus(s) || s->inf.process->total_mem_percent < 0) { StringBuffer_append(res->outputbuffer, ""); } else { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", s->inf.process->total_mem_percent, Fmt_bytes2str(s->inf.process->total_mem, buf)); } bool hasReadBytes = Statistics_initialized(&(s->inf.process->read.bytes)); bool hasReadOperations = Statistics_initialized(&(s->inf.process->read.operations)); if (! (Run.flags & Run_ProcessEngineEnabled) || ! Util_hasServiceStatus(s) || (! hasReadBytes && ! hasReadOperations)) { StringBuffer_append(res->outputbuffer, ""); } else if (hasReadBytes) { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", Fmt_bytes2str(Statistics_deltaNormalize(&(s->inf.process->read.bytes)), (char[10]){})); } else if (hasReadOperations) { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", Statistics_deltaNormalize(&(s->inf.process->read.operations))); } bool hasWriteBytes = Statistics_initialized(&(s->inf.process->write.bytes)); bool hasWriteOperations = Statistics_initialized(&(s->inf.process->write.operations)); if (! (Run.flags & Run_ProcessEngineEnabled) || ! Util_hasServiceStatus(s) || (! hasWriteBytes && ! hasWriteOperations)) { StringBuffer_append(res->outputbuffer, ""); } else if (hasWriteBytes) { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", Fmt_bytes2str(Statistics_deltaNormalize(&(s->inf.process->write.bytes)), (char[10]){})); } else if (hasWriteOperations) { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", Statistics_deltaNormalize(&(s->inf.process->write.operations))); } StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
ProcessStatusUptimeCPU TotalMemory TotalReadWrite
%s%s-%s-%.1f%%-%.1f%% [%s]-%s/s%.1f/s-%s/s%.1f/s
"); } static void do_home_program(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Program) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s)) { StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, ""); } else { if (s->program->started) { StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, "", Time_localFmt((char[32]){}, 32, "%d %b %Y %H:%M:%S", s->program->started)); StringBuffer_append(res->outputbuffer, "", s->program->exitStatus); } else { StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, ""); } } StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
ProgramStatusOutputLast startedExit value
%s%s---"); if (StringBuffer_length(s->program->lastOutput)) { // Print first line only (escape HTML characters if any) const char *output = StringBuffer_toString(s->program->lastOutput); for (int i = 0; output[i]; i++) { if (output[i] == '<') StringBuffer_append(res->outputbuffer, "<"); else if (output[i] == '>') StringBuffer_append(res->outputbuffer, ">"); else if (output[i] == '&') StringBuffer_append(res->outputbuffer, "&"); else if (output[i] == '\r' || output[i] == '\n') break; else StringBuffer_append(res->outputbuffer, "%c", output[i]); } } else { StringBuffer_append(res->outputbuffer, "no output"); } StringBuffer_append(res->outputbuffer, "%s%d-Not yet started-
"); } static void do_home_net(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Net) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s) || Link_getState(s->inf.net->stats) != 1) { StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, ""); } else { StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(Link_getBytesOutPerSecond(s->inf.net->stats), buf)); StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(Link_getBytesInPerSecond(s->inf.net->stats), buf)); } StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
NetStatusUploadDownload
%s%s--%s/s%s/s
"); } static void do_home_filesystem(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Filesystem) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s)) { StringBuffer_append(res->outputbuffer, "" "" "" ""); } else { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", s->inf.filesystem->space_percent, s->inf.filesystem->f_bsize > 0 ? Fmt_bytes2str(s->inf.filesystem->f_blocksused * s->inf.filesystem->f_bsize, buf) : "0 MB"); if (s->inf.filesystem->f_files > 0) { StringBuffer_append(res->outputbuffer, "", (s->error & Event_Resource) ? " red-text" : "", s->inf.filesystem->inode_percent, s->inf.filesystem->f_filesused); } else { StringBuffer_append(res->outputbuffer, ""); } StringBuffer_append(res->outputbuffer, "" "", (s->error & Event_Resource) ? " red-text" : "", Fmt_bytes2str(Statistics_deltaNormalize(&(s->inf.filesystem->read.bytes)), (char[10]){}), (s->error & Event_Resource) ? " red-text" : "", Fmt_bytes2str(Statistics_deltaNormalize(&(s->inf.filesystem->write.bytes)), (char[10]){})); } StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
FilesystemStatusSpace usageInodes usageReadWrite
%s%s- [-]- [-]- [-]- [-]%.1f%% [%s]%.1f%% [%lld objects]not supported by filesystem%s/s%s/s
"); } static void do_home_file(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_File) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s) || s->inf.file->size < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(s->inf.file->size, (char[10]){})); if (! Util_hasServiceStatus(s) || s->inf.file->mode < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.file->mode & 07777); if (! Util_hasServiceStatus(s) || s->inf.file->uid < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.file->uid); if (! Util_hasServiceStatus(s) || s->inf.file->gid < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.file->gid); StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
FileStatusSizePermissionUIDGID
%s%s-%s-%04o-%d-%d
"); } static void do_home_fifo(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Fifo) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s) || s->inf.fifo->mode < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.fifo->mode & 07777); if (! Util_hasServiceStatus(s) || s->inf.fifo->uid < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.fifo->uid); if (! Util_hasServiceStatus(s) || s->inf.fifo->gid < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.fifo->gid); StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
FifoStatusPermissionUIDGID
%s%s-%04o-%d-%d
"); } static void do_home_directory(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Directory) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s) || s->inf.directory->mode < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.directory->mode & 07777); if (! Util_hasServiceStatus(s) || s->inf.directory->uid < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.directory->uid); if (! Util_hasServiceStatus(s) || s->inf.directory->gid < 0) StringBuffer_append(res->outputbuffer, ""); else StringBuffer_append(res->outputbuffer, "", s->inf.directory->gid); StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
DirectoryStatusPermissionUIDGID
%s%s-%04o-%d-%d
"); } static void do_home_host(HttpResponse res) { char buf[STRLEN]; bool on = true; bool header = true; for (Service_T s = Service_List_Conf; s; s = s->next_conf) { if (s->type != Service_Host) continue; if (header) { StringBuffer_append(res->outputbuffer, "" "" "" "" "" ""); header = false; } StringBuffer_append(res->outputbuffer, "" "" "", on ? "class='stripe'" : "", s->name_urlescaped, StringBuffer_toString(s->name_htmlescaped), get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s)) { StringBuffer_append(res->outputbuffer, ""); } else { StringBuffer_append(res->outputbuffer, ""); } StringBuffer_append(res->outputbuffer, ""); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "
HostStatusProtocol(s)
%s%s-"); for (Icmp_T icmp = s->icmplist; icmp; icmp = icmp->next) { if (icmp != s->icmplist) StringBuffer_append(res->outputbuffer, "  |  "); switch (icmp->is_available) { case Connection_Init: StringBuffer_append(res->outputbuffer, "[Ping]"); break; case Connection_Failed: StringBuffer_append(res->outputbuffer, "[Ping]"); break; default: StringBuffer_append(res->outputbuffer, "[Ping]"); break; } } if (s->icmplist && s->portlist) StringBuffer_append(res->outputbuffer, "  |  "); for (Port_T port = s->portlist; port; port = port->next) { if (port != s->portlist) StringBuffer_append(res->outputbuffer, "  |  "); switch (port->is_available) { case Connection_Init: StringBuffer_append(res->outputbuffer, "[%s] at port %d", port->protocol->name, port->target.net.port); break; case Connection_Failed: StringBuffer_append(res->outputbuffer, "[%s] at port %d", port->protocol->name, port->target.net.port); break; default: if (port->target.net.ssl.options.flags && port->target.net.ssl.certificate.validDays < port->target.net.ssl.certificate.minimumDays) StringBuffer_append(res->outputbuffer, "[%s] at port %d", port->protocol->name, port->target.net.port); else StringBuffer_append(res->outputbuffer, "[%s] at port %d", port->protocol->name, port->target.net.port); break; } } StringBuffer_append(res->outputbuffer, "
"); } /* ------------------------------------------------------------------------- */ static void print_alerts(HttpResponse res, Mail_T s) { for (Mail_T r = s; r; r = r->next) { _displayTableRow(res, true, NULL, "Alert mail to", "%s", r->to ? r->to : ""); StringBuffer_append(res->outputbuffer, "Alert on"); if (r->events == Event_Null) { StringBuffer_append(res->outputbuffer, "No events"); } else if (r->events == Event_All) { StringBuffer_append(res->outputbuffer, "All events"); } else { if (IS_EVENT_SET(r->events, Event_Action)) StringBuffer_append(res->outputbuffer, "Action "); if (IS_EVENT_SET(r->events, Event_ByteIn)) StringBuffer_append(res->outputbuffer, "ByteIn "); if (IS_EVENT_SET(r->events, Event_ByteOut)) StringBuffer_append(res->outputbuffer, "ByteOut "); if (IS_EVENT_SET(r->events, Event_Checksum)) StringBuffer_append(res->outputbuffer, "Checksum "); if (IS_EVENT_SET(r->events, Event_Connection)) StringBuffer_append(res->outputbuffer, "Connection "); if (IS_EVENT_SET(r->events, Event_Content)) StringBuffer_append(res->outputbuffer, "Content "); if (IS_EVENT_SET(r->events, Event_Data)) StringBuffer_append(res->outputbuffer, "Data "); if (IS_EVENT_SET(r->events, Event_Exec)) StringBuffer_append(res->outputbuffer, "Exec "); if (IS_EVENT_SET(r->events, Event_Exist)) StringBuffer_append(res->outputbuffer, "Exist "); if (IS_EVENT_SET(r->events, Event_FsFlag)) StringBuffer_append(res->outputbuffer, "Fsflags "); if (IS_EVENT_SET(r->events, Event_Gid)) StringBuffer_append(res->outputbuffer, "Gid "); if (IS_EVENT_SET(r->events, Event_Instance)) StringBuffer_append(res->outputbuffer, "Instance "); if (IS_EVENT_SET(r->events, Event_Invalid)) StringBuffer_append(res->outputbuffer, "Invalid "); if (IS_EVENT_SET(r->events, Event_Link)) StringBuffer_append(res->outputbuffer, "Link "); if (IS_EVENT_SET(r->events, Event_NonExist)) StringBuffer_append(res->outputbuffer, "Nonexist "); if (IS_EVENT_SET(r->events, Event_Permission)) StringBuffer_append(res->outputbuffer, "Permission "); if (IS_EVENT_SET(r->events, Event_PacketIn)) StringBuffer_append(res->outputbuffer, "PacketIn "); if (IS_EVENT_SET(r->events, Event_PacketOut)) StringBuffer_append(res->outputbuffer, "PacketOut "); if (IS_EVENT_SET(r->events, Event_Pid)) StringBuffer_append(res->outputbuffer, "PID "); if (IS_EVENT_SET(r->events, Event_Icmp)) StringBuffer_append(res->outputbuffer, "Ping "); if (IS_EVENT_SET(r->events, Event_PPid)) StringBuffer_append(res->outputbuffer, "PPID "); if (IS_EVENT_SET(r->events, Event_Resource)) StringBuffer_append(res->outputbuffer, "Resource "); if (IS_EVENT_SET(r->events, Event_Saturation)) StringBuffer_append(res->outputbuffer, "Saturation "); if (IS_EVENT_SET(r->events, Event_Size)) StringBuffer_append(res->outputbuffer, "Size "); if (IS_EVENT_SET(r->events, Event_Speed)) StringBuffer_append(res->outputbuffer, "Speed "); if (IS_EVENT_SET(r->events, Event_Status)) StringBuffer_append(res->outputbuffer, "Status "); if (IS_EVENT_SET(r->events, Event_Timeout)) StringBuffer_append(res->outputbuffer, "Timeout "); if (IS_EVENT_SET(r->events, Event_Timestamp)) StringBuffer_append(res->outputbuffer, "Timestamp "); if (IS_EVENT_SET(r->events, Event_Uid)) StringBuffer_append(res->outputbuffer, "Uid "); if (IS_EVENT_SET(r->events, Event_Uptime)) StringBuffer_append(res->outputbuffer, "Uptime "); } StringBuffer_append(res->outputbuffer, ""); if (r->reminder) _displayTableRow(res, false, NULL, "Alert reminder", "%u cycles", r->reminder); } } static void print_buttons(HttpRequest req, HttpResponse res, Service_T s) { if (is_readonly(req)) { // A read-only REMOTE_USER does not get access to these buttons return; } StringBuffer_append(res->outputbuffer, ""); /* Start program */ if (s->start) StringBuffer_append(res->outputbuffer, "", s->name_urlescaped, res->token); /* Stop program */ if (s->stop) StringBuffer_append(res->outputbuffer, "", s->name_urlescaped, res->token); /* Restart program */ if ((s->start && s->stop) || s->restart) StringBuffer_append(res->outputbuffer, "", s->name_urlescaped, res->token); /* (un)monitor */ StringBuffer_append(res->outputbuffer, "", s->name_urlescaped, res->token, s->monitor ? "unmonitor" : "monitor", s->monitor ? "Disable monitoring" : "Enable monitoring"); StringBuffer_append(res->outputbuffer, "
" "
" "" "" "" "
" "
" "
" "" "" "" "
" "
" "
" "" "" "" "
" "
" "
" "" "" "" "
" "
"); } static void print_service_rules_timeout(HttpResponse res, Service_T s) { for (ActionRate_T ar = s->actionratelist; ar; ar = ar->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Timeout", "If restarted %d times within %d cycle(s) then %s", ar->count, ar->cycle, StringBuffer_toString(Util_printAction(ar->action->failed, sb))); StringBuffer_free(&sb); } } static void print_service_rules_nonexistence(HttpResponse res, Service_T s) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Existence", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If doesn't exist"))); StringBuffer_free(&sb); } } static void print_service_rules_existence(HttpResponse res, Service_T s) { for (Exist_T l = s->existlist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Non-Existence", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If exist"))); StringBuffer_free(&sb); } } static void print_service_rules_port(HttpResponse res, Service_T s) { for (Port_T p = s->portlist; p; p = p->next) { StringBuffer_T sb = StringBuffer_create(256); StringBuffer_T buf = StringBuffer_create(64); StringBuffer_append(buf, "If %s [%s]:%d%s", p->check_invers ? "succeeded" : "failed", p->hostname, p->target.net.port, Util_portRequestDescription(p)); if (p->outgoing.ip) StringBuffer_append(buf, " via address %s", p->outgoing.ip); StringBuffer_append(buf, " type %s/%s protocol %s with timeout %s", Util_portTypeDescription(p), Util_portIpDescription(p), p->protocol->name, Fmt_time2str(p->timeout, (char[11]){})); if (p->retry > 1) StringBuffer_append(buf, " and retry %d times", p->retry); if (p->responsetime.limit > -1.) StringBuffer_append(buf, " and responsetime %s %s", Operator_Names[p->responsetime.operator], Fmt_time2str(p->responsetime.limit, (char[11]){})); #ifdef HAVE_OPENSSL if (p->target.net.ssl.options.flags) { StringBuffer_append(buf, " using TLS"); const char *options = Ssl_printOptions(&p->target.net.ssl.options, (char[STRLEN]){}, STRLEN); if (options && *options) StringBuffer_append(buf, " with options {%s}", options); if (p->target.net.ssl.certificate.minimumDays > 0) StringBuffer_append(buf, " and certificate valid for at least %d days", p->target.net.ssl.certificate.minimumDays); if (p->target.net.ssl.options.checksum) StringBuffer_append(buf, " and certificate checksum %s equal to '%s'", Checksum_Names[p->target.net.ssl.options.checksumType], p->target.net.ssl.options.checksum); } #endif _displayTableRow(res, true, "rule", "Port", "%s", StringBuffer_toString(Util_printRule(p->check_invers, sb, p->action, "%s", StringBuffer_toString(buf)))); StringBuffer_free(&buf); StringBuffer_free(&sb); } } static void print_service_rules_socket(HttpResponse res, Service_T s) { for (Port_T p = s->socketlist; p; p = p->next) { StringBuffer_T sb = StringBuffer_create(256); StringBuffer_T buf = StringBuffer_create(64); StringBuffer_append(buf, "If %s %s type %s protocol %s with timeout %s", p->check_invers ? "succeeded" : "failed", p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name, Fmt_time2str(p->timeout, (char[11]){})); if (p->retry > 1) StringBuffer_append(buf, " and retry %d times", p->retry); if (p->responsetime.limit > -1.) StringBuffer_append(buf, " and responsetime %s %s", Operator_Names[p->responsetime.operator], Fmt_time2str(p->responsetime.limit, (char[11]){})); _displayTableRow(res, true, "rule", "Unix Socket", "%s", StringBuffer_toString(Util_printRule(p->check_invers, sb, p->action, "%s", StringBuffer_toString(buf)))); StringBuffer_free(&buf); StringBuffer_free(&sb); } } static void print_service_rules_icmp(HttpResponse res, Service_T s) { for (Icmp_T i = s->icmplist; i; i = i->next) { const char *key; StringBuffer_T sb = StringBuffer_create(256); StringBuffer_T buf = StringBuffer_create(64); switch (i->family) { case Socket_Ip4: key = "Ping4"; break; case Socket_Ip6: key = "Ping6"; break; default: key = "Ping"; break; } StringBuffer_append(buf, "If %s count %d size %d with timeout %s", i->check_invers ? "succeeded" : "failed", i->count, i->size, Fmt_time2str(i->timeout, (char[11]){})); if (i->outgoing.ip) StringBuffer_append(buf, " via address %s", i->outgoing.ip); if (i->responsetime.limit > -1.) StringBuffer_append(buf, " and responsetime %s %s", Operator_Names[i->responsetime.operator], Fmt_time2str(i->responsetime.limit, (char[11]){})); _displayTableRow(res, true, "rule", key, "%s", StringBuffer_toString(Util_printRule(i->check_invers, sb, i->action, "%s", StringBuffer_toString(buf)))); StringBuffer_free(&buf); StringBuffer_free(&sb); } } static void print_service_rules_perm(HttpResponse res, Service_T s) { if (s->perm) { StringBuffer_T sb = StringBuffer_create(256); if (s->perm->test_changes) Util_printRule(false, sb, s->perm->action, "If changed"); else Util_printRule(false, sb, s->perm->action, "If failed %o", s->perm->perm); _displayTableRow(res, true, "rule", "Permissions", "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } static void print_service_rules_uid(HttpResponse res, Service_T s) { if (s->uid) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "UID", "%s", StringBuffer_toString(Util_printRule(false, sb, s->uid->action, "If failed %d", s->uid->uid))); StringBuffer_free(&sb); } } static void print_service_rules_euid(HttpResponse res, Service_T s) { if (s->euid) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "EUID", "%s", StringBuffer_toString(Util_printRule(false, sb, s->euid->action, "If failed %d", s->euid->uid))); StringBuffer_free(&sb); } } static void print_service_rules_filedescriptors(HttpResponse res, Service_T s) { for (Filedescriptors_T o = s->filedescriptorslist; o; o = o->next) { StringBuffer_T sb = StringBuffer_create(256); if (o->total) { _displayTableRow(res, true, "rule", "Total filedescriptors", "%s", StringBuffer_toString(Util_printRule(false, sb, o->action, "If %s %lld", Operator_Names[o->operator], o->limit_absolute))); } else { if (o->limit_absolute > -1LL) _displayTableRow(res, true, "rule", "Filedescriptors", "%s", StringBuffer_toString(Util_printRule(false, sb, o->action, "If %s %lld", Operator_Names[o->operator], o->limit_absolute))); else _displayTableRow(res, true, "rule", "Filedescriptors", "%s", StringBuffer_toString(Util_printRule(false, sb, o->action, "If %s %.1f%%", Operator_Names[o->operator], o->limit_percent))); } StringBuffer_free(&sb); } } static void print_service_rules_gid(HttpResponse res, Service_T s) { if (s->gid) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "GID", "%s", StringBuffer_toString(Util_printRule(false, sb, s->gid->action, "If failed %d", s->gid->gid))); StringBuffer_free(&sb); } } static void print_service_rules_secattr(HttpResponse res, Service_T s) { for (SecurityAttribute_T a = s->secattrlist; a; a = a->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Security attribute", "%s", StringBuffer_toString(Util_printRule(false, sb, a->action, "If failed %s", a->attribute))); StringBuffer_free(&sb); } } static void print_service_rules_timestamp(HttpResponse res, Service_T s) { for (Timestamp_T t = s->timestamplist; t; t = t->next) { char key[STRLEN]; snprintf(key, sizeof(key), "%c%s", toupper(Timestamp_Names[t->type][0]), Timestamp_Names[t->type] + 1); StringBuffer_T sb = StringBuffer_create(256); if (t->test_changes) Util_printRule(false, sb, t->action, "If changed"); else Util_printRule(false, sb, t->action, "If %s %s", Operator_Names[t->operator], Fmt_time2str(t->time * 1000., (char[11]){})); _displayTableRow(res, true, "rule", key, "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } static void print_service_rules_fsflags(HttpResponse res, Service_T s) { for (FsFlag_T l = s->fsflaglist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Filesystem flags", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If changed"))); StringBuffer_free(&sb); } } static void print_service_rules_filesystem(HttpResponse res, Service_T s) { for (FileSystem_T dl = s->filesystemlist; dl; dl = dl->next) { StringBuffer_T sb = StringBuffer_create(256); switch (dl->resource) { case Resource_Inode: if (dl->limit_absolute > -1) Util_printRule(false, sb, dl->action, "If %s %lld", Operator_Names[dl->operator], dl->limit_absolute); else Util_printRule(false, sb, dl->action, "If %s %.1f%%", Operator_Names[dl->operator], dl->limit_percent); _displayTableRow(res, true, "rule", "Inodes usage limit", "%s", StringBuffer_toString(sb)); break; case Resource_InodeFree: if (dl->limit_absolute > -1) Util_printRule(false, sb, dl->action, "If %s %lld", Operator_Names[dl->operator], dl->limit_absolute); else Util_printRule(false, sb, dl->action, "If %s %.1f%%", Operator_Names[dl->operator], dl->limit_percent); _displayTableRow(res, true, "rule", "Inodes free limit", "%s", StringBuffer_toString(sb)); break; case Resource_Space: if (dl->limit_absolute > -1) Util_printRule(false, sb, dl->action, "If %s %s", Operator_Names[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})); else Util_printRule(false, sb, dl->action, "If %s %.1f%%", Operator_Names[dl->operator], dl->limit_percent); _displayTableRow(res, true, "rule", "Space usage limit", "%s", StringBuffer_toString(sb)); break; case Resource_SpaceFree: if (dl->limit_absolute > -1) Util_printRule(false, sb, dl->action, "If %s %s", Operator_Names[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})); else Util_printRule(false, sb, dl->action, "If %s %.1f%%", Operator_Names[dl->operator], dl->limit_percent); _displayTableRow(res, true, "rule", "Space free limit", "%s", StringBuffer_toString(sb)); break; case Resource_ReadBytes: _displayTableRow(res, true, "rule", "Read limit", "%s", StringBuffer_toString(Util_printRule(false, sb, dl->action, "If read %s %s/s", Operator_Names[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})))); break; case Resource_ReadOperations: _displayTableRow(res, true, "rule", "Read limit", "%s", StringBuffer_toString(Util_printRule(false, sb, dl->action, "If read %s %llu operations/s", Operator_Names[dl->operator], dl->limit_absolute))); break; case Resource_WriteBytes: _displayTableRow(res, true, "rule", "Write limit", "%s", StringBuffer_toString(Util_printRule(false, sb, dl->action, "If write %s %s/s", Operator_Names[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})))); break; case Resource_WriteOperations: _displayTableRow(res, true, "rule", "Write limit", "%s", StringBuffer_toString(Util_printRule(false, sb, dl->action, "If write %s %llu operations/s", Operator_Names[dl->operator], dl->limit_absolute))); break; case Resource_ServiceTime: _displayTableRow(res, true, "rule", "Service time limit", "%s", StringBuffer_toString(Util_printRule(false, sb, dl->action, "If service time %s %s/operation", Operator_Names[dl->operator], Fmt_time2str(dl->limit_absolute, (char[11]){})))); break; default: break; } StringBuffer_free(&sb); } } static void print_service_rules_size(HttpResponse res, Service_T s) { for (Size_T sl = s->sizelist; sl; sl = sl->next) { StringBuffer_T sb = StringBuffer_create(256); if (sl->test_changes) Util_printRule(false, sb, sl->action, "If changed"); else Util_printRule(false, sb, sl->action, "If %s %llu byte(s)", Operator_Names[sl->operator], sl->size); _displayTableRow(res, true, "rule", "Size", "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } static void print_service_rules_nlink(HttpResponse res, Service_T s) { for (NLink_T sl = s->nlinklist; sl; sl = sl->next) { StringBuffer_T sb = StringBuffer_create(256); if (sl->test_changes) Util_printRule(false, sb, sl->action, "If changed"); else Util_printRule(false, sb, sl->action, "If %s %llu", Operator_Names[sl->operator], sl->nlink); _displayTableRow(res, true, "rule", "Hardlink", "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } static void print_service_rules_linkstatus(HttpResponse res, Service_T s) { for (LinkStatus_T l = s->linkstatuslist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Link status", "%s", StringBuffer_toString(Util_printRule(l->check_invers, sb, l->action, "If %s", l->check_invers ? "up" : "down"))); StringBuffer_free(&sb); } } static void print_service_rules_linkspeed(HttpResponse res, Service_T s) { for (LinkSpeed_T l = s->linkspeedlist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Link capacity", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If changed"))); StringBuffer_free(&sb); } } static void print_service_rules_linksaturation(HttpResponse res, Service_T s) { for (LinkSaturation_T l = s->linksaturationlist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Link saturation", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If %s %.1f%%", Operator_Names[l->operator], l->limit))); StringBuffer_free(&sb); } } static void print_service_rules_uploadbytes(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->uploadbyteslist; bl; bl = bl->next) { StringBuffer_T sb = StringBuffer_create(256); if (bl->range == Time_Second) _displayTableRow(res, true, "rule", "Upload bytes", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %s/s", Operator_Names[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){})))); else _displayTableRow(res, true, "rule", "Total upload bytes", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %s in last %d %s(s)", Operator_Names[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){}), bl->rangecount, Util_timestr(bl->range)))); StringBuffer_free(&sb); } } static void print_service_rules_uploadpackets(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->uploadpacketslist; bl; bl = bl->next) { StringBuffer_T sb = StringBuffer_create(256); if (bl->range == Time_Second) _displayTableRow(res, true, "rule", "Upload packets", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %lld packets/s", Operator_Names[bl->operator], bl->limit))); else _displayTableRow(res, true, "rule", "Total upload packets", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %lld packets in last %d %s(s)", Operator_Names[bl->operator], bl->limit, bl->rangecount, Util_timestr(bl->range)))); StringBuffer_free(&sb); } } static void print_service_rules_downloadbytes(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->downloadbyteslist; bl; bl = bl->next) { StringBuffer_T sb = StringBuffer_create(256); if (bl->range == Time_Second) _displayTableRow(res, true, "rule", "Download bytes", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %s/s", Operator_Names[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){})))); else _displayTableRow(res, true, "rule", "Total download bytes", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %s in last %d %s(s)", Operator_Names[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){}), bl->rangecount, Util_timestr(bl->range)))); StringBuffer_free(&sb); } } static void print_service_rules_downloadpackets(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->downloadpacketslist; bl; bl = bl->next) { StringBuffer_T sb = StringBuffer_create(256); if (bl->range == Time_Second) _displayTableRow(res, true, "rule", "Download packets", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %lld packets/s", Operator_Names[bl->operator], bl->limit))); else _displayTableRow(res, true, "rule", "Total download packets", "%s", StringBuffer_toString(Util_printRule(false, sb, bl->action, "If %s %lld packets in last %d %s(s)", Operator_Names[bl->operator], bl->limit, bl->rangecount, Util_timestr(bl->range)))); StringBuffer_free(&sb); } } static void print_service_rules_uptime(HttpResponse res, Service_T s) { for (Uptime_T ul = s->uptimelist; ul; ul = ul->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Uptime", "%s", StringBuffer_toString(Util_printRule(false, sb, ul->action, "If %s %s", Operator_Names[ul->operator], _getUptime(ul->uptime, (char[256]){})))); StringBuffer_free(&sb); } } static void print_service_rules_content(HttpResponse res, Service_T s) { if (s->type != Service_Process) { for (Match_T ml = s->matchignorelist; ml; ml = ml->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Ignore content", "%s", StringBuffer_toString(Util_printRule(false, sb, ml->action, "If content %s \"%s\"", ml->not ? "!=" : "=", ml->match_string))); StringBuffer_free(&sb); } for (Match_T ml = s->matchlist; ml; ml = ml->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Content match", "%s", StringBuffer_toString(Util_printRule(false, sb, ml->action, "If content %s \"%s\"", ml->not ? "!=" : "=", ml->match_string))); StringBuffer_free(&sb); } for (OutputChange_T oc = s->outputchangelist; oc; oc = oc->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "Content change", "%s", StringBuffer_toString(Util_printRule(false, sb, oc->action, "If content %schanged", oc->check_invers ? "not " : ""))); StringBuffer_free(&sb); } } } static void print_service_rules_checksum(HttpResponse res, Service_T s) { if (s->checksum) { StringBuffer_T sb = StringBuffer_create(256); if (s->checksum->test_changes) Util_printRule(false, sb, s->checksum->action, "If changed %s", Checksum_Names[s->checksum->type]); else Util_printRule(false, sb, s->checksum->action, "If failed %s(%s)", s->checksum->hash, Checksum_Names[s->checksum->type]); _displayTableRow(res, true, "rule", "Checksum", "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } static void print_service_rules_pid(HttpResponse res, Service_T s) { for (Pid_T l = s->pidlist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "PID", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If changed"))); StringBuffer_free(&sb); } } static void print_service_rules_ppid(HttpResponse res, Service_T s) { for (Pid_T l = s->ppidlist; l; l = l->next) { StringBuffer_T sb = StringBuffer_create(256); _displayTableRow(res, true, "rule", "PPID", "%s", StringBuffer_toString(Util_printRule(false, sb, l->action, "If changed"))); StringBuffer_free(&sb); } } static void print_service_rules_program(HttpResponse res, Service_T s) { if (s->type == Service_Program) { _displayTableRow(res, false, "rule", "Program timeout", "Terminate the program if not finished within %s", Fmt_time2str(s->program->timeout, (char[11]){})); for (Status_T status = s->statuslist; status; status = status->next) { StringBuffer_T sb = StringBuffer_create(256); if (status->operator == Operator_Changed) Util_printRule(false, sb, status->action, "If exit value changed"); else Util_printRule(false, sb, status->action, "If exit value %s %d", OperatorShort_Names[status->operator], status->return_value); _displayTableRow(res, true, "rule", "Test Exit value", "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } } static void print_service_rules_resource(HttpResponse res, Service_T s) { char buf[STRLEN]; for (Resource_T q = s->resourcelist; q; q = q->next) { const char *key = NULL; StringBuffer_T sb = StringBuffer_create(256); switch (q->resource_id) { case Resource_CpuPercent: key = "CPU usage limit"; break; case Resource_CpuPercentTotal: key = "CPU usage limit (incl. children)"; break; case Resource_CpuUser: key = "CPU user limit"; break; case Resource_CpuSystem: key = "CPU system limit"; break; case Resource_CpuWait: key = "CPU I/O wait limit"; break; case Resource_CpuNice: key = "CPU nice limit"; break; case Resource_CpuHardIRQ: key = "CPU hardware IRQ limit"; break; case Resource_CpuSoftIRQ: key = "CPU software IRQ limit"; break; case Resource_CpuSteal: key = "CPU steal limit"; break; case Resource_CpuGuest: key = "CPU guest limit"; break; case Resource_CpuGuestNice: key = "CPU guest nice limit"; break; case Resource_MemoryPercent: key = "Memory usage limit"; break; case Resource_MemoryKbyte: key = "Memory amount limit"; break; case Resource_SwapPercent: key = "Swap usage limit"; break; case Resource_SwapKbyte: key = "Swap amount limit"; break; case Resource_LoadAverage1m: key = "Load average (1m)"; break; case Resource_LoadAverage5m: key = "Load average (5m)"; break; case Resource_LoadAverage15m: key = "Load average (15m)"; break; case Resource_LoadAveragePerCore1m: key = "Load average per core (1m)"; break; case Resource_LoadAveragePerCore5m: key = "Load average per core (5m)"; break; case Resource_LoadAveragePerCore15m: key = "Load average per core (15m)"; break; case Resource_Threads: key = "Threads"; break; case Resource_Children: key = "Children"; break; case Resource_MemoryKbyteTotal: key = "Memory amount limit (incl. children)"; break; case Resource_MemoryPercentTotal: key = "Memory usage limit (incl. children)"; break; case Resource_ReadBytes: key = "Disk read limit"; break; case Resource_ReadOperations: key = "Disk read limit"; break; case Resource_WriteBytes: key = "Disk write limit"; break; case Resource_WriteOperations: key = "Disk write limit"; break; default: break; } switch (q->resource_id) { case Resource_CpuPercent: case Resource_CpuPercentTotal: case Resource_MemoryPercentTotal: case Resource_CpuUser: case Resource_CpuSystem: case Resource_CpuWait: case Resource_CpuNice: case Resource_CpuHardIRQ: case Resource_CpuSoftIRQ: case Resource_CpuSteal: case Resource_CpuGuest: case Resource_CpuGuestNice: case Resource_MemoryPercent: case Resource_SwapPercent: Util_printRule(false, sb, q->action, "If %s %.1f%%", Operator_Names[q->operator], q->limit); break; case Resource_MemoryKbyte: case Resource_SwapKbyte: case Resource_MemoryKbyteTotal: Util_printRule(false, sb, q->action, "If %s %s", Operator_Names[q->operator], Fmt_bytes2str(q->limit, buf)); break; case Resource_LoadAverage1m: case Resource_LoadAverage5m: case Resource_LoadAverage15m: case Resource_LoadAveragePerCore1m: case Resource_LoadAveragePerCore5m: case Resource_LoadAveragePerCore15m: Util_printRule(false, sb, q->action, "If %s %.1f", Operator_Names[q->operator], q->limit); break; case Resource_Threads: case Resource_Children: Util_printRule(false, sb, q->action, "If %s %.0f", Operator_Names[q->operator], q->limit); break; case Resource_ReadBytes: case Resource_ReadBytesPhysical: case Resource_WriteBytes: case Resource_WriteBytesPhysical: Util_printRule(false, sb, q->action, "if %s %s", Operator_Names[q->operator], Fmt_bytes2str(q->limit, (char[10]){})); break; case Resource_ReadOperations: case Resource_WriteOperations: Util_printRule(false, sb, q->action, "if %s %.0f operations/s", Operator_Names[q->operator], q->limit); break; default: break; } if (key) _displayTableRow(res, true, "rule", key, "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); } } static bool is_readonly(HttpRequest req) { Socket_Family sfam = Socket_getFamily(req->S); if ((Run.httpd.socket.net.readonly && (sfam != Socket_Unix)) || (Run.httpd.socket.unix.readonly && (sfam == Socket_Unix)) ) { return true; } if (req->remote_user) { Auth_T user_creds = Util_getUserCredentials(req->remote_user); return (user_creds ? user_creds->is_readonly : true); } return false; } /* ----------------------------------------------------------- Status output */ /* Print status in the given format. Text status is default. */ static void print_status(HttpRequest req, HttpResponse res, int version) { const char *stringFormat = get_parameter(req, "format"); if (stringFormat && Str_startsWith(stringFormat, "xml")) { char buf[STRLEN]; StringBuffer_T sb = StringBuffer_create(256); status_xml(sb, NULL, version, Socket_getLocalHost(req->S, buf, sizeof(buf)), NULL); StringBuffer_append(res->outputbuffer, "%s", StringBuffer_toString(sb)); StringBuffer_free(&sb); set_content_type(res, "text/xml"); } else { set_content_type(res, "text/plain"); StringBuffer_append(res->outputbuffer, "Monit %s uptime: %s\n\n", VERSION, _getUptime(ProcessTree_getProcessUptime(getpid()), (char[256]){})); struct ServiceMap_T ap = {.found = 0, .data.status.res = res}; const char *stringGroup = Util_urlDecode((char *)get_parameter(req, "group")); const char *stringService = Util_urlDecode((char *)get_parameter(req, "service")); if (stringGroup) { for (ServiceGroup_T sg = Service_Group_List; sg; sg = sg->next) { if (IS(stringGroup, sg->name)) { for (_list_t m = sg->members->head; m; m = m->next) { status_service_txt(m->e, res); ap.found++; } break; } } } else { _serviceMapByName(stringService, _serviceMapStatus, &ap); } if (ap.found == 0) { if (stringGroup) send_error(req, res, SC_BAD_REQUEST, "Service group '%s' not found", stringGroup); else if (stringService) send_error(req, res, SC_BAD_REQUEST, "Service '%s' not found", stringService); else send_error(req, res, SC_BAD_REQUEST, "No service found"); } } } static void print_summary(HttpRequest req, HttpResponse res) { set_content_type(res, "text/plain"); StringBuffer_append(res->outputbuffer, "Monit %s uptime: %s\n", VERSION, _getUptime(ProcessTree_getProcessUptime(getpid()), (char[256]){})); struct ServiceMap_T ap = {.found = 0}; const char *stringGroup = Util_urlDecode((char *)get_parameter(req, "group")); const char *stringService = Util_urlDecode((char *)get_parameter(req, "service")); ap.data.summary.box = TextBox_new(res->outputbuffer, 3, (TextBoxColumn_T []){ {.name = "Service Name", .width = 31, .wrap = false, .align = TextBoxAlign_Left}, {.name = "Status", .width = 26, .wrap = false, .align = TextBoxAlign_Left}, {.name = "Type", .width = 13, .wrap = false, .align = TextBoxAlign_Left} }, true); if (stringGroup) { for (ServiceGroup_T sg = Service_Group_List; sg; sg = sg->next) { if (IS(stringGroup, sg->name)) { for (_list_t m = sg->members->head; m; m = m->next) { _printServiceSummary(ap.data.summary.box, m->e); ap.found++; } break; } } } else if (stringService) { _serviceMapByName(stringService, _serviceMapSummary, &ap); } else { _serviceMapByType(Service_System, _serviceMapSummary, &ap); _serviceMapByType(Service_Process, _serviceMapSummary, &ap); _serviceMapByType(Service_File, _serviceMapSummary, &ap); _serviceMapByType(Service_Fifo, _serviceMapSummary, &ap); _serviceMapByType(Service_Directory, _serviceMapSummary, &ap); _serviceMapByType(Service_Filesystem, _serviceMapSummary, &ap); _serviceMapByType(Service_Host, _serviceMapSummary, &ap); _serviceMapByType(Service_Net, _serviceMapSummary, &ap); _serviceMapByType(Service_Program, _serviceMapSummary, &ap); } TextBox_free(&ap.data.summary.box); if (ap.found == 0) { if (stringGroup) send_error(req, res, SC_BAD_REQUEST, "Service group '%s' not found", stringGroup); else if (stringService) send_error(req, res, SC_BAD_REQUEST, "Service '%s' not found", stringService); else send_error(req, res, SC_BAD_REQUEST, "No service found"); } } static void _updateReportStatistics(Service_T s, ReportStatics_T statistics) { if (s->monitor == Monitor_Not) statistics->unmonitored++; else if (s->monitor & Monitor_Init) statistics->init++; else if (s->error) statistics->down++; else statistics->up++; statistics->total++; } static void _printReport(HttpRequest req, HttpResponse res) { set_content_type(res, "text/plain"); const char *type = get_parameter(req, "type"); const char *group = Util_urlDecode((char *)get_parameter(req, "group")); struct ReportStatics_T reportStatics = {}; if (group) { for (ServiceGroup_T sg = Service_Group_List; sg; sg = sg->next) { if (IS(group, sg->name)) { for (_list_t m = sg->members->head; m; m = m->next) { _updateReportStatistics(m->e, &reportStatics); } } } } else { for (Service_T s = Service_List; s; s = s->next) { _updateReportStatistics(s, &reportStatics); } } if (! type) { StringBuffer_append(res->outputbuffer, "up: %*.0f (%.1f%%)\n" "down: %*.0f (%.1f%%)\n" "initialising: %*.0f (%.1f%%)\n" "unmonitored: %*.0f (%.1f%%)\n" "total: %*.0f services\n", 3, reportStatics.up, 100. * reportStatics.up / reportStatics.total, 3, reportStatics.down, 100. * reportStatics.down / reportStatics.total, 3, reportStatics.init, 100. * reportStatics.init / reportStatics.total, 3, reportStatics.unmonitored, 100. * reportStatics.unmonitored / reportStatics.total, 3, reportStatics.total); } else if (Str_isEqual(type, "up")) { StringBuffer_append(res->outputbuffer, "%.0f\n", reportStatics.up); } else if (Str_isEqual(type, "down")) { StringBuffer_append(res->outputbuffer, "%.0f\n", reportStatics.down); } else if (Str_startsWith(type, "initiali")) { // allow 'initiali(s|z)ing' StringBuffer_append(res->outputbuffer, "%.0f\n", reportStatics.init); } else if (Str_isEqual(type, "unmonitored")) { StringBuffer_append(res->outputbuffer, "%.0f\n", reportStatics.unmonitored); } else if (Str_isEqual(type, "total")) { StringBuffer_append(res->outputbuffer, "%.0f\n", reportStatics.total); } else { send_error(req, res, SC_BAD_REQUEST, "Invalid report type: '%s'", type); } } static void status_service_txt(Service_T s, HttpResponse res) { char buf[STRLEN]; StringBuffer_append(res->outputbuffer, COLOR_BOLDCYAN "%s '%s'" COLOR_RESET "\n" " %-28s %s\n", Servicetype_Names[s->type], s->name, "status", get_service_status(TXT, s, buf, sizeof(buf))); StringBuffer_append(res->outputbuffer, " %-28s %s\n", "monitoring status", get_monitoring_status(TXT, s, buf, sizeof(buf))); StringBuffer_append(res->outputbuffer, " %-28s %s\n", "monitoring mode", Mode_Names[s->mode]); StringBuffer_append(res->outputbuffer, " %-28s %s\n", "on reboot", onReboot_Names[s->onreboot]); _printStatus(TXT, res, s); StringBuffer_append(res->outputbuffer, "\n"); } static char *get_monitoring_status(Output_Type type, Service_T s, char *buf, int buflen) { assert(s); assert(buf); if (s->monitor == Monitor_Not) { if (type == HTML) snprintf(buf, buflen, "Not monitored"); else snprintf(buf, buflen, TextColor_lightYellow("Not monitored")); } else if (s->monitor & Monitor_Waiting) { if (type == HTML) snprintf(buf, buflen, "Waiting"); else snprintf(buf, buflen, TextColor_white("Waiting")); } else if (s->monitor & Monitor_Init) { if (type == HTML) snprintf(buf, buflen, "Initializing"); else snprintf(buf, buflen, TextColor_lightBlue("Initializing")); } else if (s->monitor & Monitor_Yes) { if (type == HTML) snprintf(buf, buflen, "Monitored"); else snprintf(buf, buflen, "Monitored"); } return buf; } static char *get_service_status(Output_Type type, Service_T s, char *buf, int buflen) { assert(s); assert(buf); if (s->monitor == Monitor_Not || s->monitor & Monitor_Init) { get_monitoring_status(type, s, buf, buflen); } else if (s->error == 0) { snprintf(buf, buflen, type == HTML ? "OK" : TextColor_lightGreen("OK")); } else { // In the case that the service has actually some failure, the error bitmap will be non zero char *p = buf; EventTable_T *et = Event_Table; while ((*et).id) { if (s->error & (*et).id) { bool inverse = false; if ((*et).id == Event_Link && s->inverseStatus) inverse = true; if (p > buf) p += snprintf(p, buflen - (p - buf), " | "); if (s->error_hint & (*et).id) { if (type == HTML) p += snprintf(p, buflen - (p - buf), "%s", (*et).description_changed); else p += snprintf(p, buflen - (p - buf), TextColor_lightYellow("%s", (*et).description_changed)); } else { if (type == HTML) p += snprintf(p, buflen - (p - buf), "%s", inverse ? (*et).description_succeeded : (*et).description_failed); else p += snprintf(p, buflen - (p - buf), TextColor_lightRed("%s", inverse ? (*et).description_succeeded : (*et).description_failed)); } } et++; } } if (s->doaction) snprintf(buf + strlen(buf), buflen - strlen(buf) - 1, " - %s pending", Action_Names[s->doaction]); return buf; } monit-5.35.2/src/http/cervlet.h0000644000016400001720000002031415007061157013235 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef CERVLET_H #define CERVLET_H #include "config.h" #include "monit.h" void init_service(void); #define FAVICON_ICO "AAABAAIAEBAAAAAAIABoBAAAJgAAACAgAAAAACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAADAAAAAgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAADAAAABMAAAAXAAAAFwAAABMAAAAMAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAFAAAACgAAAA3AAAAPwAAAD8AAAA3AAAAKAAAABQAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEwAAAC8AjlOHALVkxBzVe+4r3H/uALdoxACOU4cAAAAvAAAAEwAAAAQAAAAAAAAAAAAAAAAAAAABAAAACwAAACUAhUqfAMV6/0j0t/90/9j/hP/f/1b3vv8AyH3/AIdLnwAAACUAAAALAAAAAQAAAAAAAAAAAAAAAgAAABAAbC94AKNY/wDllP8A6Z3/GvCw/yX0t/8A66X/AOaV/wCjWP8AbC94AAAAEAAAAAIAAAAAAAAAAAAAAAIAAAASAGslugCsSv8A1Xr/ANqF/wDbi/8A3ZD/AN+S/wDWfv8Aq0j/AGslugAAABIAAAACAAAAAAAAAAAAAAACAAAAEABmHuoAqzv/Esdp/xTNdv8Uz33/FNKB/xTSgP8Sx2r/AKs7/wBmHuoAAAAQAAAAAgAAAAAAAAAAAAAAAgAAAAsAXxbpDq1N/yC8Yf81xXT/Ncl5/zXJev81xXT/ILxe/w6tTf8AXxbpAAAACwAAAAIAAAAAAAAAAAAAAAEAAAAGAFYQsSOcUP9hzYj/etid/2TPjP9kz4z/etid/2HNiP8jnFD/AFYQsQAAAAYAAAABAAAAAAAAAAAAAAAAAAAAAgBaC2ABcyT/cMyM/67pwf/Q+N3/0Pjd/67pwf9wzIz/AXMk/wBaC2AAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAE4CggJuIP9ns33/iM6a/4jOmv9ns33/Am4g/wBOAoIAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAUgBdAEkArABFAOcARQDnAEkArABSAF0AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAPgfAADwDwAA8A8AAOAHAADgBwAA4AcAAOAHAADwDwAA8A8AAPw/AAD//wAA//8AAP//AAAoAAAAIAAAAEAAAAABACAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAIAAAACAAAAAwAAAAMAAAACAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACAAAAAcAAAAGAAAABQAAAAQAAAADAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAUAAAAHAAAACgAAAA0AAAAPAAAAEQAAABIAAAASAAAAEQAAAA8AAAANAAAACgAAAAcAAAAFAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAAHAAAACwAAABAAAAAVAAAAGQAAAB0AAAAfAAAAIQAAACEAAAAfAAAAHQAAABkAAAAVAAAAEAAAAAsAAAAHAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAABwAAAA0AAAAUAAAAHAAAACQAAAAqAAAALwAAADMAAAA1AAAANQAAADMAAAAvAAAAKgAAACQAAAAcAAAAFAAAAA0AAAAHAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAYAAAANAAAAFgAcDiQAQiY2AFAvRgBcNFMDZzleCnJAZxF3RWsVekVrEXRDZwVqPF4AXzRTAFAvRgBCJjYAHA4kAAAAFgAAAA0AAAAGAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAGAAAADAAAABUAAAAiAD4jOgBzQl0AjFB8AJ5YlAatYqkTvWy6HcZywiPJc8IewnC6C7JlqQCgW5QAjFB8AHNCXQA+IzoAAAAiAAAAFQAAAAwAAAAGAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABAAAAAoAAAATACMOJAA+IT4Abj9hAJZZjwasabERv3bIHc6E2yzZjus24ZTzPuOX8zjfk+sk0ojbFMJ8yAevbLEAl1uPAG4/YQA+IT4AIw4kAAAAEwAAAAoAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAHAAAADwAAABoAQyQ5AG88agCRVJsAsWvKDseB5Svcmu1D6q3zVfK6+WP2xPtr98f7ZPTB+U/ts/M035/tEsuE5QCzbsoAklabAHE+agBDJDkAAAAaAAAADwAAAAcAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAkAIQsXADIWLgBkNFkAhkiYAKJeyQDBdu0N1o3/KOml/0D0uP9T+cf/YfzQ/2j81P9h+87/S/a//zDrq/8Q2ZD/AMR47QClX8kAiEqYAGQ0WQAyFi4AIQsXAAAACQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAACwBCHSMAWydOAHs8hACWUMYAr2TtAM+A+QThk/8N6J7/Ge6p/ynytf8z9bz/Ofa//zP1vP8f8bH/EOuk/wXjlv8A0IL5AK9l7QCWUMYAezyEAFsnTgBCHSMAAAALAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAAMAE4cLgBnKWoAgTqmAJtO4gC0Y/8A0n//AOKQ/wDllf8E55v/Duqj/xXsqf8Z7qz/FO2q/wbqpP8A55z/AOSU/wDTgP8AtGP/AJtO4gCBOqYAZylqAE4cLgAAAAwAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAABQAAAA0ATxw3AGclgwCAM78AnUXqALZa/wDNdP8A24P/AN2I/wHfjf8E4JL/B+GW/wjimP8G45n/AuOY/wDgkv8A3Ij/AM52/wC1Wv8AnUTqAIAzvwBnJYMATxw3AAAADQAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAADQBSGT4AZiGZAHwt1QCdPvEBtVL/A8hq/wTTef8E1n7/BdeD/wXYhv8F2Yn/BdqL/wXbjf8F3I3/BNqI/wTVfv8DyWz/AbVS/wCdPfEAfCzVAGYhmQBSGT4AAAANAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAAMAFIWRABkHqsAeSjnAJw49wOzSv8Kw2H/Dcxw/w7Pd/8P0Xv/D9J//w/Tgv8P1IT/D9WF/w/Vhf8O03//Dc50/wrDY/8Ds0r/AJw39wB5KOcAZB6rAFIWRAAAAAwAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAABQAAAAsAVRZFAGIbswB3Je8Cmzf6CLJJ/xG+Xf8Xxmv/Gspy/xzMd/8czXr/HM59/xzPfv8c0H//HM9+/xrMd/8Xx2z/Eb5d/wiySf8Cmzf6AHcl7wBiG7MAVRZFAAAACwAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAAACQBUE0MAXheyAnUk7webPfoPsU//GLpc/yDBZ/8oxXD/LMh2/yzKef8sy3r/LMt7/yzLe/8syXj/KMZx/yDBZv8Yulv/D7FO/webPfoCdSTvAF4XsgBUE0MAAAAJAAAABAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAAHAFIQPgBbFKcEciTkDphA9hqvVf8pu2P/NcNw/0DIef9Fyn7/Qst+/0DLfv9Ay37/Qst+/0XKfv9AyHn/NcNu/ym7Yv8ar1T/DphA9gRyJOQAWxSnAFIQPgAAAAcAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAUATQ41AFgQkQlvJM8XkkLvKqtb/0S/cv9XzIP/Y9GO/2TSkP9cz4r/WM6H/1jOh/9cz4r/ZNKQ/2PRjf9XzIP/RL9y/yqrW/8XkkLvCW8kzwBYEJEATQ41AAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwBNDCsAVg13CGsitRWHO+ctoVb/Ur54/23RkP9+2Z//hdyl/4Haov9/2qD/f9qg/4Haov+F3KX/ftmf/23RkP9Svnj/LaFW/xWHO+cIayK1AFYNdwBNDCsAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAFIIHwBXDFgDZxuXCHgp3SKRRv9TuXT/edOW/5Tfrf+m57z/sOzF/7Xuyf+17sn/sOzF/6bnvP+U363/edOW/1O5dP8ikUb/CHgp3QNnG5cAVwxYAFIIHwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAUQATAFoJNgBkFW4Aax26F4A16EGkXfhmvoH/itKg/6Xgt/+26cX/vu7N/77uzf+26cX/peC3/4rSoP9mvoH/QaRd+BeANegAax26AGQVbgBaCTYAUQATAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVAAYAUQATAFsNOwBcDn8Kah65GH4y6DSUUP9isnn/gceV/5LTpP+a2av/mtmr/5LTpP+Bx5X/YrJ5/zSUUP8YfjLoCmoeuQBcDn8AWw07AFEAEwBVAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEARwAZAE0ASQBaDH8BZxm6F3gv3ECSVOZZpGruY6py9miudvlornb5Y6py9lmkau5AklTmF3gv3AFnGboAWgx/AE0ASQBHABkAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAgARwAZAFgJOgBeDmwKZBaUG2gksiJrKcwkaijiJWop7SVqKe0kaijiImspzBtoJLIKZBaUAF4ObABYCToARwAZAEAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARwASAE4ANABPAFQASgByAEcAjABFAKIARQCtAEUArQBFAKIARwCMAEoAcgBPAFQATgA0AEcAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqAAYASwARAEkAHABKACYASAAuAEIANgBDADkAQwA5AEIANgBIAC4ASgAmAEkAHABLABEAKgAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////////////////////////////////wD///wAP//4AB//8AAP/+AAB//gAAf/wAAD/8AAA//AAAP/wAAD/8AAA//AAAP/wAAD/+AAB//gAAf/8AAP//gAH//8AD///gB///+B//////////////////////////////////" #endif monit-5.35.2/src/terminal/0000755000016400001720000000000015007061157012334 500000000000000monit-5.35.2/src/terminal/TextBox.h0000644000016400001720000000526215007061157014027 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef BOX_INCLUDED #define BOX_INCLUDED /** * Class for terminal table output. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ typedef enum { TextBoxAlign_Left = 0, TextBoxAlign_Right } TextBoxAlign_T; typedef struct TexBoxColumn_T { const char *name; char *value; // Options int width; bool wrap; TextBoxAlign_T align; // Internal int _colorLength; unsigned long _valueLength; unsigned long _cursor; char _color[8]; } TextBoxColumn_T; #define T TextBox_T typedef struct T *T; /** * Constructs a terminal table object. * @param b The output stringbuffer * @param columnsCount Count of table columns * @param columns Array of BoxColumn_T columns specification * @param printHeader true if the header should be printed otherwise false * @return A new terminal table object */ T TextBox_new(StringBuffer_T b, int columnsCount, TextBoxColumn_T *columns, bool printHeader); /** * Close and destroy a Box object and free allocated resources * @param t a Box object reference */ void TextBox_free(T *t); /** * Set a table column value * @param t The terminal table object * @param index Column index * @param format A format string with optional var args */ void TextBox_setColumn(T t, unsigned int index, const char *format, ...) __attribute__((format (printf, 3, 4))); /** * Print a table row * @param t The terminal table object */ void TextBox_printRow(T t); /** * Strip the UTF-8 table control characters in the string. * @param s The string to strip * @return A pointer to s */ char *TextBox_strip(char *s); #undef T #endif monit-5.35.2/src/terminal/TextColor.h0000644000016400001720000001172015007061157014351 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef TEXTCOLOR_INCLUDED #define TEXTCOLOR_INCLUDED /** * Class for terminal color output. * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ #define COLOR_RESET "\033[0m" #define COLOR_BOLD "\033[1m" #define COLOR_BLACK "\033[0;30m" #define COLOR_RED "\033[0;31m" #define COLOR_GREEN "\033[0;32m" #define COLOR_YELLOW "\033[0;33m" #define COLOR_BLUE "\033[0;34m" #define COLOR_MAGENTA "\033[0;35m" #define COLOR_CYAN "\033[0;36m" #define COLOR_WHITE "\033[0;37m" #define COLOR_DEFAULT "\033[0;39m" #define COLOR_BOLDBLACK "\033[1;30m" #define COLOR_BOLDRED "\033[1;31m" #define COLOR_BOLDGREEN "\033[1;32m" #define COLOR_BOLDYELLOW "\033[1;33m" #define COLOR_BOLDBLUE "\033[1;34m" #define COLOR_BOLDMAGENTA "\033[1;35m" #define COLOR_BOLDCYAN "\033[1;36m" #define COLOR_BOLDWHITE "\033[1;37m" #define COLOR_DARKGRAY "\033[0;90m" #define COLOR_LIGHTRED "\033[0;91m" #define COLOR_LIGHTGREEN "\033[0;92m" #define COLOR_LIGHTYELLOW "\033[0;93m" #define COLOR_LIGHTBLUE "\033[0;94m" #define COLOR_LIGHTMAGENTA "\033[0;95m" #define COLOR_LIGHTCYAN "\033[0;96m" #define COLOR_LIGHTWHITE "\033[0;97m" #define TextColor_black(format, ...) COLOR_BLACK format COLOR_RESET, ##__VA_ARGS__ #define TextColor_red(format, ...) COLOR_RED format COLOR_RESET, ##__VA_ARGS__ #define TextColor_green(format, ...) COLOR_GREEN format COLOR_RESET, ##__VA_ARGS__ #define TextColor_yellow(format, ...) COLOR_YELLOW format COLOR_RESET, ##__VA_ARGS__ #define TextColor_blue(format, ...) COLOR_BLUE format COLOR_RESET, ##__VA_ARGS__ #define TextColor_magenta(format, ...) COLOR_MAGENTA format COLOR_RESET, ##__VA_ARGS__ #define TextColor_cyan(format, ...) COLOR_CYAN format COLOR_RESET, ##__VA_ARGS__ #define TextColor_white(format, ...) COLOR_WHITE format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldBlack(format, ...) COLOR_BOLDBLACK format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldRed(format, ...) COLOR_BOLDRED format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldGreen(format, ...) COLOR_BOLDGREEN format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldYellow(format, ...) COLOR_BOLDYELLOW format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldBlue(format, ...) COLOR_BOLDBLUE format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldMagenta(format, ...) COLOR_BOLDMAGENTA format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldCyan(format, ...) COLOR_BOLDCYAN format COLOR_RESET, ##__VA_ARGS__ #define TextColor_boldWhite(format, ...) COLOR_BOLDWHITE format COLOR_RESET, ##__VA_ARGS__ #define TextColor_darkGray(format, ...) COLOR_DARKGRAY format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightRed(format, ...) COLOR_LIGHTRED format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightGreen(format, ...) COLOR_LIGHTGREEN format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightYellow(format, ...) COLOR_LIGHTYELLOW format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightBlue(format, ...) COLOR_LIGHTBLUE format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightMagenta(format, ...) COLOR_LIGHTMAGENTA format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightCyan(format, ...) COLOR_LIGHTCYAN format COLOR_RESET, ##__VA_ARGS__ #define TextColor_lightWhite(format, ...) COLOR_LIGHTWHITE format COLOR_RESET, ##__VA_ARGS__ /** * Test terminal color support * @return true if colors are supported, otherwise false */ bool TextColor_support(void); /** * Return length of ANSI color sequences in the string. * @return bytes used by control sequences or 0 if the string has no colors */ int TextColor_length(char *s); /** * Strip the ANSI color sequences in the string. * Example: *
 * char s[] = "\033[31mHello\033[0m";
 * Color_strip(s) -> Hello
 * 
* @param s The string to strip * @return A pointer to s */ char *TextColor_strip(char *s); #endif monit-5.35.2/src/terminal/TextBox.c0000644000016400001720000002675515007061157014034 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #include "monit.h" #include "TextColor.h" #include "TextBox.h" // libmonit #include "util/Str.h" /** * Implementation of the Terminal table interface using UTF-8 box: * https://www.unicode.org/charts/PDF/U2500.pdf * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* ------------------------------------------------------------ Definitions */ #define BOX_HORIZONTAL "\u2500" // ─ #define BOX_HORIZONTAL_DOWN "\u252c" // ┬ #define BOX_VERTICAL "\u2502" // │ #define BOX_VERTICAL_HORIZONTAL "\u253c" // ┼ #define BOX_VERTICAL_RIGHT "\u251c" // ├ #define BOX_VERTICAL_LEFT "\u2524" // ┤ #define BOX_DOWN_RIGHT "\u250c" // ┌ #define BOX_DOWN_LEFT "\u2510" // ┐ #define BOX_UP_HORIZONTAL "\u2534" // ┴ #define BOX_UP_RIGHT "\u2514" // └ #define BOX_UP_LEFT "\u2518" // ┘ #define T TextBox_T struct T { struct { unsigned int row; unsigned int column; } index; struct { struct { bool enabled; const char *color; } header; } options; unsigned int columnsCount; TextBoxColumn_T *columns; StringBuffer_T b; }; /* ------------------------------------------------------- Private Methods */ static void _printBorderTop(T t) { StringBuffer_append(t->b, COLOR_DARKGRAY BOX_DOWN_RIGHT BOX_HORIZONTAL); for (unsigned int i = 0; i < t->columnsCount; i++) { for (int j = 0; j < t->columns[i].width; j++) StringBuffer_append(t->b, BOX_HORIZONTAL); if (i < t->columnsCount - 1) StringBuffer_append(t->b, BOX_HORIZONTAL BOX_HORIZONTAL_DOWN BOX_HORIZONTAL); } StringBuffer_append(t->b, BOX_HORIZONTAL BOX_DOWN_LEFT COLOR_RESET "\n"); } static void _printBorderMiddle(T t) { StringBuffer_append(t->b, COLOR_DARKGRAY BOX_VERTICAL_RIGHT BOX_HORIZONTAL); for (unsigned int i = 0; i < t->columnsCount; i++) { for (int j = 0; j < t->columns[i].width; j++) StringBuffer_append(t->b, BOX_HORIZONTAL); if (i < t->columnsCount - 1) StringBuffer_append(t->b, BOX_HORIZONTAL BOX_VERTICAL_HORIZONTAL BOX_HORIZONTAL); } StringBuffer_append(t->b, BOX_HORIZONTAL BOX_VERTICAL_LEFT COLOR_RESET "\n"); } static void _printBorderBottom(T t) { StringBuffer_append(t->b, COLOR_DARKGRAY BOX_UP_RIGHT BOX_HORIZONTAL); for (unsigned int i = 0; i < t->columnsCount; i++) { for (int j = 0; j < t->columns[i].width; j++) StringBuffer_append(t->b, BOX_HORIZONTAL); if (i < t->columnsCount - 1) StringBuffer_append(t->b, BOX_HORIZONTAL BOX_UP_HORIZONTAL BOX_HORIZONTAL); } StringBuffer_append(t->b, BOX_HORIZONTAL BOX_UP_LEFT COLOR_RESET "\n"); } static void _printHeader(T t) { for (unsigned int i = 0; i < t->columnsCount; i++) { StringBuffer_append(t->b, COLOR_DARKGRAY BOX_VERTICAL COLOR_RESET " "); StringBuffer_append(t->b, "%s%-*s%s", t->options.header.color, t->columns[i].width, t->columns[i].name, COLOR_RESET); StringBuffer_append(t->b, " "); } StringBuffer_append(t->b, COLOR_DARKGRAY BOX_VERTICAL COLOR_RESET "\n"); t->index.row++; } static void _cacheColor(TextBoxColumn_T *column) { bool ansi = false; if (column->value) { for (int i = 0, k = 0; column->value[i]; i++) { if (column->value[i] == '\033' && column->value[i + 1] == '[') { // Escape sequence start column->_color[k++] = '\033'; column->_color[k++] = '['; i++; ansi = true; } else if (ansi) { column->_color[k++] = column->value[i]; // Escape sequence stop if (column->value[i] >= 64 && column->value[i] <= 126) break; } } } } // Print a row. If wrap is enabled and the text excceeds width, return true (printed text up to column width, repetition possible to print the rest), otherwise false static bool _printRow(T t) { bool repeat = false; for (unsigned int i = 0; i < t->columnsCount; i++) { StringBuffer_append(t->b, COLOR_DARKGRAY BOX_VERTICAL COLOR_RESET " "); if (*(t->columns[i]._color)) StringBuffer_append(t->b, "%s", t->columns[i]._color); if (! t->columns[i].value || t->columns[i]._cursor > strlen(t->columns[i].value) - 1) { // Empty column padding StringBuffer_append(t->b, "%*s", t->columns[i].width, " "); } else if (strlen(t->columns[i].value + t->columns[i]._cursor) > (unsigned long)t->columns[i].width) { if (t->columns[i].wrap) { // The value exceeds the column width and should be wrapped int column = 0; for (; t->columns[i].value[t->columns[i]._cursor] && (column == 0 || t->columns[i]._cursor % t->columns[i].width > 0); t->columns[i]._cursor++, column++) StringBuffer_append(t->b, "%c", t->columns[i].value[t->columns[i]._cursor]); if (t->columns[i]._cursor < t->columns[i]._valueLength) repeat = true; } else { // The value exceeds the column width and should be truncated Str_trunc(t->columns[i].value, t->columns[i].width); StringBuffer_append(t->b, t->columns[i].align == TextBoxAlign_Right ? "%*s" : "%-*s", t->columns[i].width, t->columns[i].value); t->columns[i]._cursor = t->columns[i]._valueLength; } } else { // The whole value fits in the column width StringBuffer_append(t->b, t->columns[i].align == TextBoxAlign_Right ? "%*s" : "%-*s", t->columns[i].width, t->columns[i].value + t->columns[i]._cursor); t->columns[i]._cursor = t->columns[i]._valueLength; } StringBuffer_append(t->b, " "); if (*(t->columns[i]._color)) StringBuffer_append(t->b, COLOR_RESET); } StringBuffer_append(t->b, COLOR_DARKGRAY BOX_VERTICAL COLOR_RESET "\n"); t->index.row++; return repeat; } static void _resetColumn(TextBoxColumn_T *column) { FREE(column->value); column->_cursor = column->_colorLength = column->_valueLength = 0; memset(column->_color, 0, sizeof(column->_color)); } static void _resetRow(T t) { for (unsigned int i = 0; i < t->columnsCount; i++) _resetColumn(&(t->columns[i])); } /* -------------------------------------------------------- Public Methods */ T TextBox_new(StringBuffer_T b, int columnsCount, TextBoxColumn_T *columns, bool printHeader) { assert(b); assert(columns); assert(columnsCount > 0); T t; NEW(t); t->b = b; t->columnsCount = columnsCount; t->columns = columns; // Default options t->options.header.color = COLOR_BOLDCYAN; // Note: hardcoded, option setting can be implemented if needed // Options t->options.header.enabled = printHeader; return t; } void TextBox_free(T *t) { assert(t && *t); if ((*t)->index.row > 0) _printBorderBottom(*t); for (unsigned int i = 0; i < (*t)->columnsCount; i++) FREE((*t)->columns[i].value); FREE(*t); } void TextBox_setColumn(T t, unsigned int index, const char *format, ...) { assert(t); assert(index > 0); assert(index <= t->columnsCount); int _index = index - 1; _resetColumn(&(t->columns[_index])); if (format) { va_list ap; va_start(ap, format); t->columns[_index].value = Str_vcat(format, ap); va_end(ap); if ((t->columns[_index]._colorLength = TextColor_length(t->columns[_index].value))) { _cacheColor(&(t->columns[_index])); TextColor_strip(t->columns[_index].value); // Strip the escape sequences, so we can safely break the line } t->columns[_index]._valueLength = strlen(t->columns[_index].value); } } void TextBox_printRow(T t) { assert(t); if (t->index.row == 0) { _printBorderTop(t); if (t->options.header.enabled) { _printHeader(t); _printBorderMiddle(t); } } else { _printBorderMiddle(t); } bool repeat = false; do { repeat = _printRow(t); } while (repeat); _resetRow(t); } char *TextBox_strip(char *s) { if (STR_DEF(s)) { int x, y; unsigned char *_s = (unsigned char *)s; bool separator = false; for (x = 0, y = 0; s[y]; y++) { if (! separator) { if (_s[y] == 0xE2 && _s[y + 1] == 0x94) { if (_s[y + 2] == 0x8c || _s[y + 2] == 0x94 || _s[y + 2] == 0x9c) separator = true; // Drop the whole separator line else if (_s[y + 2] >= 0x80 && _s[y + 2] <= 0xBF) y += 2; // to skip 3 characters of UTF-8 box drawing character } else { _s[x++] = _s[y]; } } else if (_s[y] == '\n') { separator = false; } } _s[x] = 0; } return s; } monit-5.35.2/src/terminal/TextColor.c0000644000016400001720000000751615007061157014354 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "monit.h" #include "TextColor.h" // libmonit #include "util/Str.h" /** * Implementation of the Terminal color interface * * @author https://www.tildeslash.com/ * @see https://mmonit.com/ * @file */ /* -------------------------------------------------------- Public Methods */ bool TextColor_support(void) { if (! (Run.flags & Run_Batch) && isatty(STDOUT_FILENO)) { if (getenv("COLORTERM")) { return true; } else { char *term = getenv("TERM"); if (term) { if (Str_startsWith(term, "screen") || Str_startsWith(term, "xterm") || Str_startsWith(term, "vt100") || Str_startsWith(term, "ansi") || Str_startsWith(term, "linux") || Str_startsWith(term, "rxvt") || Str_sub(term, "color")) return true; } } } return false; } int TextColor_length(char *s) { if (STR_DEF(s)) { int length = 0; bool ansi = false; for (int i = 0; s[i]; i++) { if (s[i] == '\033' && s[i + 1] == '[') { // Escape sequence start ansi = true; length += 2; i++; } else if (ansi) { length++; // Escape sequence stop if (s[i] >= 64 && s[i] <= 126) ansi = false; } } return length; } return 0; } char *TextColor_strip(char *s) { if (STR_DEF(s)) { int x, y; bool ansi = false; for (x = 0, y = 0; s[y]; y++) { if (s[y] == '\033' && s[y + 1] == '[') { // Escape sequence start ansi = true; y++; // ++ to skip 'ESC[' } else if (ansi) { // Escape sequence stop if (s[y] >= 64 && s[y] <= 126) ansi = false; } else { s[x++] = s[y]; } } s[x] = 0; } return s; } monit-5.35.2/src/state.h0000644000016400001720000000574315007061157011743 00000000000000/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_STATE_H #define MONIT_STATE_H /** * Management of the persistent service properties. * * If Monit runs in daemon mode, it saves the persistent properties of every * service to the state file at the end of every poll cycle. When Monit is * restarted or reloaded, it restores the state of the services from this file. * * The location of the state file defaults to ~/.monit.state and can be * overridden on the command line or using the "set statefile" statement in the * configuration file. * * @file */ /** * Open the state file * @return true if succeeded, otherwise false */ bool State_open(void); /** * Close the state file */ void State_close(void); /** * Mark the state file as dirty */ void State_dirty(void); /** * Save the state if dirty */ void State_saveIfDirty(void); /** * Save the state file */ void State_save(void); /** * Update the current service list with data from the state file. We * do change only services found in *both* the monitrc file and in * the state file. The algorithm: * * Assume the control file was changed and a new service (B) was added * so the monitrc file now contains the services: A B and C. The * running monit daemon only knows the services A and C. Upon restart * after a crash the monit daemon first read the monitrc file and * creates the service list structure with A B and C. We then read the * state file and update the service A and C since they are found in * the state file, B is not found in this file and therefore not * changed. * * The same strategy is used if a service was removed, e.g. if the * service A was removed from monitrc; when reading the state file, * service A is not found in the current service list (the list is * always generated from monitrc) and therefore A is simply discarded. */ void State_restore(void); /** * Check if the system rebooted since last cycle. * @return true if reboot occurred since last cycle, otherwise false */ bool State_reboot(void); #endif monit-5.35.2/bootstrap0000755000016400001720000000077715007061157011630 00000000000000#!/bin/sh # Use this script to re-create configure. Requires the following auto-tools, # autoconf >= 2.59 # automake >= 1.10 # libtool >= 1.4 if (glibtoolize -f -c 2>/dev/null || libtoolize -f -c) && aclocal --force -I config && autoheader -f && automake -f --foreign --add-missing --copy && autoconf then if cd libmonit && ./bootstrap then echo "Success bootstrapping Monit" exit 0; fi fi echo "Failed bootstrapping Monit" exit 1; monit-5.35.2/monitrc0000644000016400001720000003233415007061157011255 00000000000000############################################################################### ## Monit control file ############################################################################### ## ## Comments begin with a '#' and extend through the end of the line. Keywords ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. ## ## Below you will find examples of some frequently used statements. For ## information about the control file and a complete list of statements and ## options, please have a look in the Monit manual. ## ## ############################################################################### ## Global section ############################################################################### ## ## Start Monit in the background (run as a daemon): # set daemon 30 # check services at 30 seconds intervals # with start delay 240 # optional: delay the first check by 4-minutes (by # # default Monit check immediately after Monit start) # # ## Set syslog logging. If you want to log to a standalone log file instead, ## specify the full path to the log file # set log syslog # # ## Set the location of the Monit lock file which stores the process id of the ## running Monit instance. By default this file is stored in $HOME/.monit.pid # # set pidfile /var/run/monit.pid # ## Set the location of the Monit id file which stores the unique id for the ## Monit instance. The id is generated and stored on first Monit start. By ## default the file is placed in $HOME/.monit.id. # # set idfile /var/.monit.id # ## Set the location of the Monit state file which saves monitoring states ## on each cycle. By default the file is placed in $HOME/.monit.state. If ## the state file is stored on a persistent filesystem, Monit will recover ## the monitoring state across reboots. If it is on temporary filesystem, the ## state will be lost on reboot which may be convenient in some situations. # # set statefile /var/.monit.state # # ## Set limits for various tests. The following example shows the default values: ## # set limits { # programOutput: 512 B, # check program's output truncate limit # sendExpectBuffer: 256 B, # limit for send/expect protocol test # fileContentBuffer: 512 B, # limit for file content test # httpContentBuffer: 1 MB, # limit for HTTP content test # networkTimeout: 5 seconds # timeout for network I/O # programTimeout: 300 seconds # timeout for check program # stopTimeout: 30 seconds # timeout for service stop # startTimeout: 30 seconds # timeout for service start # restartTimeout: 30 seconds # timeout for service restart # execTimeout: 0 seconds # timeout for test action exec # } ## Set global SSL options (just most common options showed, see manual for ## full list). # # set ssl { # verify : enable, # verify SSL certificates (disabled by default but STRONGLY RECOMMENDED) # selfsigned : allow # allow self signed SSL certificates (reject by default) # } # # ## Set the list of mail servers for alert delivery. Multiple servers may be ## specified using a comma separator. If the first mail server fails, Monit ## will use the second mail server in the list and so on. By default Monit uses ## port 25 - it is possible to override this with the PORT option. # # set mailserver mail.bar.baz, # primary mailserver # backup.bar.baz port 10025, # backup mailserver on port 10025 # localhost # fallback relay # # ## By default Monit will drop alert events if no mail servers are available. ## If you want to keep the alerts for later delivery retry, you can use the ## EVENTQUEUE statement. The base directory where undelivered alerts will be ## stored is specified by the BASEDIR option. You can limit the queue size ## by using the SLOTS option (if omitted, the queue is limited by space ## available in the back end filesystem). # # set eventqueue # basedir /var/monit # set the base directory where events will be stored # slots 100 # optionally limit the queue size # # ## Send status and events to M/Monit (for more information about M/Monit ## see https://mmonit.com/). By default Monit registers credentials with ## M/Monit so M/Monit can smoothly communicate back to Monit and you don't ## have to register Monit credentials manually in M/Monit. It is possible to ## disable credential registration using the commented out option below. ## Though, if safety is a concern we recommend instead using https when ## communicating with M/Monit and send credentials encrypted. The password ## should be URL encoded if it contains URL-significant characters like ## ":", "?", "@". Default timeout is 5 seconds, you can customize it by ## adding the timeout option. # # set mmonit # http://monit:monit@192.168.1.10:8080/collector # # with timeout 30 seconds # Default timeout is 5 seconds # # and register without credentials # Don't register credentials # # with hostgroups [ "Virtual machines", Web ] # Member of M/Monit hostgroup # # ## Monit by default uses the following format for alerts if the mail-format ## statement is missing:: ## --8<-- ## set mail-format { ## from: Monit ## subject: monit alert -- $EVENT $SERVICE ## message: $EVENT Service $SERVICE ## Date: $DATE ## Action: $ACTION ## Host: $HOST ## Description: $DESCRIPTION ## ## Your faithful employee, ## Monit ## } ## --8<-- ## ## You can override this message format or parts of it, such as subject ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc. ## are expanded at runtime. For example, to override the sender, use: # # set mail-format { from: monit@foo.bar } # # ## You can set alert recipients whom will receive alerts if/when a ## service defined in this file has errors. Alerts may be restricted on ## events by using a filter as in the second example below. # # set alert sysadm@foo.bar # receive all alerts # ## Do not alert when Monit starts, stops or performs a user initiated action. ## This filter is recommended to avoid getting alerts for trivial cases. # # set alert your-name@your.domain not on { instance, action } # # ## Monit has an embedded HTTP interface which can be used to view status of ## services monitored and manage services from a web interface. The HTTP ## interface is also required if you want to issue Monit commands from the ## command line, such as 'monit status' or 'monit restart service' The reason ## for this is that the Monit client uses the HTTP interface to send these ## commands to a running Monit daemon. See the Monit Wiki if you want to ## enable SSL for the HTTP interface. # set httpd port 2812 and use address localhost # only accept connection from localhost (drop if you use M/Monit) allow localhost # allow localhost to connect to the server and allow admin:monit # require user 'admin' with password 'monit' #with ssl { # enable SSL/TLS and set path to server certificate # pemfile: /etc/ssl/certs/monit.pem #} # ## Monit can perform act differently regarding services previous state when ## going back in duty. By default, Monit will 'start' all services. Monit can ## also takes no action to start services in 'nostart' mode. Monit can try to ## restore the 'laststate' of the service when Monit was shutdown. # set onreboot start # start, nostart, laststart ############################################################################### ## Services ############################################################################### ## ## Check general system resources such as load average, cpu and memory ## usage. Each test specifies a resource, conditions and the action to be ## performed should a test fail. # # check system $HOST # if loadavg (1min) per core > 2 for 5 cycles then alert # if loadavg (5min) per core > 1.5 for 10 cycles then alert # if cpu usage > 95% for 10 cycles then alert # if memory usage > 75% then alert # if swap usage > 25% then alert # # ## Check if a file exists, checksum, permissions, uid and gid. In addition ## to alert recipients in the global section, customized alert can be sent to ## additional recipients by specifying a local alert handler. The service may ## be grouped using the GROUP option. More than one group can be specified by ## repeating the 'group name' statement. # # check file apache_bin with path /usr/local/apache/bin/httpd # if failed checksum and # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor # if failed permission 755 then unmonitor # if failed uid "root" then unmonitor # if failed gid "root" then unmonitor # alert security@foo.bar on { # checksum, permission, uid, gid # } with the mail-format { subject: Alarm! } # group server # # ## Check that a process is running, in this case Apache, and that it respond ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory, ## and number of children. If the process is not running, Monit will restart ## it by default. In case the service is restarted very often and the ## problem remains, it is possible to disable monitoring using the TIMEOUT ## statement. This service depends on another service (apache_bin) which ## is defined above. # # check process apache with pidfile /usr/local/apache/logs/httpd.pid # start program = "/etc/init.d/httpd start" with timeout 60 seconds # stop program = "/etc/init.d/httpd stop" # if cpu > 60% for 2 cycles then alert # if cpu > 80% for 5 cycles then restart # if totalmem > 200.0 MB for 5 cycles then restart # if children > 250 then restart # if disk read > 500 kb/s for 10 cycles then alert # if disk write > 500 kb/s for 10 cycles then alert # if failed host www.tildeslash.com port 80 protocol http and request "/somefile.html" then restart # if failed port 443 protocol https with timeout 15 seconds then restart # if 3 restarts within 5 cycles then unmonitor # depends on apache_bin # group server # # ## Check filesystem permissions, uid, gid, space usage, inode usage and disk I/O. ## Other services, such as databases, may depend on this resource and an automatically ## graceful stop may be cascaded to them before the filesystem will become full and data ## lost. # # check filesystem datafs with path /dev/sdb1 # start program = "/bin/mount /data" # stop program = "/bin/umount /data" # if failed permission 660 then unmonitor # if failed uid "root" then unmonitor # if failed gid "disk" then unmonitor # if space usage > 80% for 5 times within 15 cycles then alert # if space usage > 99% then stop # if inode usage > 30000 then alert # if inode usage > 99% then stop # if read rate > 1 MB/s for 5 cycles then alert # if read rate > 500 operations/s for 5 cycles then alert # if write rate > 1 MB/s for 5 cycles then alert # if write rate > 500 operations/s for 5 cycles then alert # if service time > 10 milliseconds for 3 times within 5 cycles then alert # group server # # ## Check a file's timestamp. In this example, we test if a file is older ## than 15 minutes and assume something is wrong if its not updated. Also, ## if the file size exceed a given limit, execute a script # # check file database with path /data/mydatabase.db # if failed permission 700 then alert # if failed uid "data" then alert # if failed gid "data" then alert # if timestamp > 15 minutes then alert # if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba # # ## Check directory permission, uid and gid. An event is triggered if the ## directory does not belong to the user with uid 0 and gid 0. In addition, ## the permissions have to match the octal description of 755 (see chmod(1)). # # check directory bin with path /bin # if failed permission 755 then unmonitor # if failed uid 0 then unmonitor # if failed gid 0 then unmonitor # # ## Check a remote host availability by issuing a ping test and check the ## content of a response from a web server. Up to three pings are sent and ## connection to a port and an application level network check is performed. # # check host myserver with address 192.168.1.1 # if failed ping then alert # if failed port 3306 protocol mysql with timeout 15 seconds then alert # if failed port 80 protocol http # and request /some/path with content = "a string" # then alert # # ## Check a network link status (up/down), link capacity changes, saturation ## and bandwidth usage. # # check network public with interface eth0 # if link down then alert # if changed link then alert # if saturation > 90% then alert # if download > 10 MB/s then alert # if total uploaded > 1 GB in last hour then alert # # ## Check custom program status output. # # check program myscript with path /usr/local/bin/myscript.sh # if status != 0 then alert # if content changed then alert # # ############################################################################### ## Includes ############################################################################### ## ## It is possible to include additional configuration parts from other files or ## directories. # # include /etc/monit.d/* # monit-5.35.2/monit.10000644000016400001720000053754115007061176011102 00000000000000.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "MONIT 1" .TH MONIT 1 "www.mmonit.com" "5.35.2" "User Commands" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Monit \- utility for monitoring services on a Unix system .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBmonit\fR [options] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBMonit\fR is a utility for managing and monitoring processes, programs, files, directories and filesystems on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You can use Monit to monitor files, directories and filesystems for changes, such as timestamps changes, checksum changes or size changes. .PP Monit is controlled via an easy to configure control file based on a free-format, token-oriented syntax. Monit logs to syslog or to its own log file and notifies you about error conditions via customisable alert messages. Monit can perform various \s-1TCP/IP\s0 network checks, protocol checks and can utilise \s-1SSL\s0 for such checks. Monit provides a \s-1HTTP\s0(S) interface and you may use a browser to access the Monit program. .SH "WHAT TO MONITOR?" .IX Header "WHAT TO MONITOR?" You can use Monit to monitor daemon \fBprocesses\fR or similar programs running on localhost. Monit is particularly useful for monitoring daemon processes, such as those started at system boot time. For instance sendmail, sshd, apache and mysql. In contrast to many other monitoring systems, Monit can act if an error situation should occur, e.g.; if sendmail is not running, monit can start sendmail again automatically or if apache is using too many resources (e.g. if a DoS attack is in progress) Monit can stop or restart apache and send you an alert message. Monit can also monitor process characteristics, such as how much memory or cpu cycles a process is using. .PP You can also use Monit to monitor \fBfiles\fR, \fBdirectories\fR and \&\fBfilesystems\fR on localhost. Monit can monitor these items for changes, such as timestamps changes, checksum changes or size changes. This is also useful for security reasons \- you can monitor the md5 or sha1 checksum of files that should not change and get an alert or perform an action if they should change. .PP Monit can monitor \fBnetwork connections\fR to various servers, either on localhost or on remote hosts. \s-1TCP, UDP\s0 and Unix Domain Sockets are supported. Network test can be performed on a protocol level; Monit has built-in tests for the main Internet protocols, such as \s-1HTTP, SMTP\s0 etc. Even if a protocol is not supported you can still test the server because you can configure Monit to send any data and test the response from the server. .PP Monit can be used to test \fBprograms\fR or scripts at certain times, much like cron, but in addition, you can test the exit value of a program and perform an action or send an alert if the exit value indicates an error. This means that you can use Monit to perform any type of check you can write a script for. .PP Finally, Monit can be used to monitor general \fBsystem\fR resources on localhost such as overall \s-1CPU\s0 usage, Memory and System Load. .SH "GENERAL OPERATION" .IX Header "GENERAL OPERATION" The behaviour of Monit is controlled by command-line options \&\fIand\fR a run control file, monitrc, the syntax of which we describe in a later section. Command-line options override \fI.monitrc\fR declarations. .PP The default location for \fImonitrc\fR is \fI~/.monitrc\fR. If this file does not exist, Monit will try \fI/etc/monitrc\fR and a few other places. See \s-1FILES\s0 for details. You can also specify the control file directly by using the \fI\-c\fR command-line switch to monit. For instance, .PP .Vb 1 \& $ monit \-c /var/monit/monitrc .Ve .PP Before Monit is started the first time, you can test the control file for syntax errors: .PP .Vb 2 \& $ monit \-t \& $ Control file syntax OK .Ve .PP If there was an error, Monit will print an error message to the console, including the line number in the control file from where the error was found. .PP Once you have a working Monit control file, simply start Monit from the console, like so: .PP .Vb 1 \& $ monit .Ve .PP You can change some configuration directives via command-line switches, but for simplicity it is recommended that you put these in the control file. .PP Monit will detach from the terminal and run as a background process, i.e. as a daemon process. As a daemon, Monit runs in cycles; It monitor services, then goes to sleep for a configured period, then wakes up and start monitoring again in an endless loop. .SS "Options" .IX Subsection "Options" The following options are recognized by Monit. However, it is recommended that you set options (when applicable) directly in the \fI.monitrc\fR control file. .PP \&\fB\-c\fR \fIfile\fR Use this control file .PP \&\fB\-d\fR \fIn\fR Run Monit as a daemon once per \fIn\fR seconds. Or use \fI\*(L"set daemon\*(R"\fR in monitrc. .PP \&\fB\-g\fR \fIname\fR Set group name for start, stop, restart, monitor, unmonitor, status and summary action. .PP \&\fB\-l\fR \fIfile\fR Print log information to this file. Or use \fI\*(L"set log\*(R"\fR in monitrc. .PP \&\fB\-p\fR \fIpidfile\fR Use this lock file in daemon mode. Or use \fI\*(L"set pidfile\*(R"\fR in monitrc. .PP \&\fB\-s\fR \fIstatefile\fR Write state information to this file. Or use \fI\*(L"set statefile\*(R"\fR in monitrc. .PP \&\fB\-B\fR Batch command line mode (no tabular output and no colors). Or use \fI\*(L"set terminal batch\*(R"\fR in monitrc. .PP \&\fB\-I\fR Do not run in background mode (needed to run from init). Or use \fI\*(L"set init\*(R"\fR in monitrc. .PP \&\fB\-i\fR Print Monit's unique \s-1ID\s0 .PP \&\fB\-r\fR Reset Monit's unique \s-1ID.\s0 Use with caution .PP \&\fB\-t\fR Run syntax check for the control file .PP \&\fB\-v\fR Verbose mode, work noisy (diagnostic output) .PP \&\fB\-vv\fR Very verbose mode, same as \-v plus log stack-trace on error .PP \&\fB\-H\fR \fI[filename]\fR Print \s-1MD5\s0 and \s-1SHA1\s0 hashes of the file or of stdin if the filename is omitted; Monit will exit afterwards .PP \&\fB\-V\fR Print version number and patch level .PP \&\fB\-h\fR Print a help text .SS "Arguments" .IX Subsection "Arguments" Once you have Monit running as a daemon process, you can call Monit with one of the following arguments. Monit will then connect to the Monit daemon (on \s-1TCP\s0 port 127.0.0.1:2812 by default) and ask the Monit daemon to perform the requested action. In other words; calling monit without arguments starts the Monit daemon, and calling monit \fIwith\fR arguments enables you to communicate with the Monit daemon process. .IP "start all" 4 .IX Item "start all" Start all services listed in the control file and enable monitoring for them. If the group option is set (\fI\-g\fR), only start and enable monitoring of services in the named group (\*(L"all\*(R" is not required in this case). .IP "start " 4 .IX Item "start " Start the named service and enable monitoring for it. The name is a service entry name from the monitrc file. You can use a regex pattern too (note that it is case insensitive). .IP "stop all" 4 .IX Item "stop all" Stop all services listed in the control file and disable their monitoring. If the group option is set, only stop and disable monitoring of the services in the named group (\*(L"all\*(R" is not required in this case). .IP "stop " 4 .IX Item "stop " Stop the named service and disable its monitoring. The name is a service entry name from the monitrc file. You can use a regex pattern too (note that it is case insensitive). .IP "restart all" 4 .IX Item "restart all" Stop and start \fIall\fR services. If the group option is set, only restart the services in the named group (\*(L"all\*(R" is not required in this case). .IP "restart " 4 .IX Item "restart " Restart the named service. The name is a service entry name from the monitrc file. You can use a regex pattern too (note that it is case insensitive). .IP "monitor all" 4 .IX Item "monitor all" Enable monitoring of all services listed in the control file. If the group option is set, only start monitoring of services in the named group (\*(L"all\*(R" is not required in this case). .IP "monitor " 4 .IX Item "monitor " Enable monitoring of the named service. The name is a service entry name from the monitrc file. Monit will also enable monitoring of all services this service depends on. You can use a regex pattern too (note that it is case insensitive). .IP "unmonitor all" 4 .IX Item "unmonitor all" Disable monitoring of all services listed in the control file. If the group option is set, only disable monitoring of services in the named group (\*(L"all\*(R" is not required in this case). .IP "unmonitor " 4 .IX Item "unmonitor " Disable monitoring of the named service. The name is a service entry name from the monitrc file. Monit will also disable monitoring of all services that depends on this service. You can use a regex pattern too (note that it is case insensitive). .IP "status [name|pattern]" 4 .IX Item "status [name|pattern]" Print service status information. .IP "summary [name|pattern]" 4 .IX Item "summary [name|pattern]" Print a short status summary. .IP "report [up | down | initialising | unmonitored | total]" 4 .IX Item "report [up | down | initialising | unmonitored | total]" Report services state. The output can easily be parsed by scripts. Without options, prints a short overview of the state of all services managed by Monit. The option, \fIup\fR prints the number of all services in this state, \fIdown\fR likewise and so on. .IP "reload" 4 .IX Item "reload" Reinitialise a running Monit daemon, the daemon will reread its configuration, close and reopen log files. .IP "quit" 4 .IX Item "quit" Kill the Monit daemon process .IP "validate" 4 .IX Item "validate" Check all services listed in the control file. This action is also the default behaviour when Monit runs in daemon mode. .IP "procmatch " 4 .IX Item "procmatch " Allows for easy testing of pattern for process match check. The command takes regular expression as an argument and displays all running processes matching the pattern. .SH "THE MONIT CONTROL FILE" .IX Header "THE MONIT CONTROL FILE" Monit is configured and controlled via a control file called \&\fImonitrc\fR. The default location for this file is ~/.monitrc. If this file does not exist, Monit will try /etc/monitrc, then \&\f(CW@sysconfdir\fR@/monitrc and finally ./monitrc. If you build Monit from source, the value of \f(CW@sysconfdir\fR@ can be given at configure time as \&./configure \-\-sysconfdir. For instance, using \fI./configure \&\-\-sysconfdir /var/monit/etc\fR will make Monit search for \fImonitrc\fR in \&\fI/var/monit/etc\fR .PP To protect the security of your control file and passwords the control file must have read-write permissions \fIno more than 0700\fR (u=xrw,g=,o=); Monit will complain and exit otherwise. .PP When there is a conflict between the command-line arguments and the arguments in this file, the command-line arguments takes precedence. .PP Monit uses its own Domain Specific Language (\s-1DSL\s0); The control file consists of a series of service entries and global option statements. .PP Comments begin with a \f(CW\*(Aq#\*(Aq\fR and extend through the end of the line. Otherwise the file consists of a series of service entries or global option statements in a free-format, token-oriented syntax. .PP You can use noise keywords like \f(CW\*(Aqif\*(Aq\fR, \f(CW\*(Aqand\*(Aq\fR, \f(CW\*(Aqwith(in)\*(Aq\fR, \&\f(CW\*(Aqhas\*(Aq\fR, \f(CW\*(Aqus(ing|e)\*(Aq\fR, \f(CW\*(Aqon(ly)\*(Aq\fR, \f(CW\*(Aqthen\*(Aq\fR, \f(CW\*(Aqfor\*(Aq\fR, \f(CW\*(Aqof\*(Aq\fR anywhere in an entry to make it resemble English. They're ignored, but can make entries much easier to read at a glance. Keywords are case insensitive. .PP There are three kinds of tokens: \fIgrammar\fR, \fInumbers\fR (i.e. decimal digit sequences) and \fIstrings\fR. Strings can be either quoted or unquoted. A quoted string is bounded by double quotes and may contain whitespace (and quoted digits are treated as a string). An unquoted string is any whitespace-delimited token, containing characters and/or numbers. .PP On a semantic level, the control file consists of three types of entries: .IP "1. Global set-statements" 4 .IX Item "1. Global set-statements" A global set-statement starts with the keyword \f(CW\*(C`set\*(C'\fR and the item to configure. .IP "2. Global include-statement" 4 .IX Item "2. Global include-statement" The include statement consists of the keyword \f(CW\*(C`include\*(C'\fR and a glob string. This statement is used to include configure directives from separate files. .IP "3. One or more service entry statements." 4 .IX Item "3. One or more service entry statements." .SS "Service checks" .IX Subsection "Service checks" Each service entry consists of the keywords \f(CW\*(C`check\*(C'\fR, followed by the service type. Each entry requires a \fBunique\fR descriptive name, which may be freely chosen. This name is used by Monit to refer to the service internally and in all interactions with the user. The name is case insensitive. .PP Currently, nine types of check statements are supported: .PP \fIProcess\fR .IX Subsection "Process" .PP .Vb 1 \& CHECK PROCESS | MATCHING > .Ve .PP is the absolute path to the program's pid-file. A pid-file is a file, containing a Process's unique \s-1ID.\s0 If the pid-file does not exist or does not contain the \s-1PID\s0 number of a running process, Monit will call the entry's start method if defined. .PP is an alternative to using \s-1PID\s0 files and uses process name pattern matching to find the process to monitor. The top-most matching parent with highest uptime is selected, so this form of check is most useful if the process name is unique. Pid-file should be used where possible as it defines expected \s-1PID\s0 exactly. You can test if a process match a pattern from the command-line using \f(CW\*(C`monit procmatch "regex\-pattern"\*(C'\fR. This will lists all processes matching or not, the regex-pattern. .PP \fIFile\fR .IX Subsection "File" .PP .Vb 1 \& CHECK FILE PATH .Ve .PP is the absolute path to the file. If the file does not exist, Monit will call the entry's start method if defined, if does not point to a regular file type (for instance a directory), Monit will disable monitoring of this entry. If Monit runs in passive mode or the start method is not defined, Monit will just send an alert on error. .PP \fIFifo\fR .IX Subsection "Fifo" .PP .Vb 1 \& CHECK FIFO PATH .Ve .PP is the absolute path to the fifo. If the fifo does not exist, Monit will call the entry's start method if defined, if does not point to a fifo type (for instance a directory), Monit will disable monitoring of this entry. If Monit runs in passive mode or the start method is not defined, Monit will just send an alert on error. .PP \fIFilesystem\fR .IX Subsection "Filesystem" .PP .Vb 1 \& CHECK FILESYSTEM PATH .Ve .PP is the path to the device/disk, mount point or \s-1NFS/CIFS/FUSE\s0 connection string. If the filesystem becomes unavailable, Monit will call the service's start method if defined. If Monit runs in passive mode or the start method is not defined, Monit will just send an alert on error. .PP \fIDirectory\fR .IX Subsection "Directory" .PP .Vb 1 \& CHECK DIRECTORY PATH .Ve .PP is the absolute path to the directory. If the directory does not exist, Monit will call the entry's start method if defined. If does not point to a directory, monit will disable monitoring of this entry. If Monit runs in passive mode or the start methods is not defined, Monit will just send an alert on error. .PP \fIRemote host\fR .IX Subsection "Remote host" .PP .Vb 1 \& CHECK HOST ADDRESS .Ve .PP The host address can be specified as a hostname string or as an IP-address string on a dotted decimal format. Such as, \&\*(L"tildeslash.com\*(R" or \*(L"64.87.72.95\*(R". .PP \fISystem\fR .IX Subsection "System" .PP .Vb 1 \& CHECK SYSTEM .Ve .PP The \fIunique name\fR is usually the local host name, but any descriptive name can be used. If you use the variable \f(CW$HOST\fR as the name, it will expand to the hostname. This check allows one to monitor general system resources such as \s-1CPU\s0 usage, total memory usage or load average. The \&\fIunique name\fR is used as the system hostname in mail alerts and as the initial name of the host entry in M/Monit. .PP \fIProgram\fR .IX Subsection "Program" .PP .Vb 1 \& CHECK PROGRAM PATH [TIMEOUT SECONDS] .Ve .PP is the absolute path to the executable program or script. The status test allows one to check the program's exit status. If the program does not finish executing within seconds, Monit will terminate it. The default program timeout is 300 seconds (5 minutes). The output of the program is recorded and made available in the User Interface and in alerts, by default up to 512 bytes. You can change the output limit using the set limits statement). .PP \fINetwork\fR .IX Subsection "Network" .PP .Vb 1 \& CHECK NETWORK
| INTERFACE > .Ve .PP is the IPv4 or IPv6 address of the monitored network interface. It is also possible to use interface name, such as \*(L"eth0\*(R" on Linux. .SH "LOGGING" .IX Header "LOGGING" Monit will log status and error messages to a file or via syslog. Use the \fIset log\fR statement in the monitrc control file. .PP To setup Monit to log to its own file, use e.g. \fIset log /var/log/monit.log\fR. Note, the previous \fIset logfile\fR statement is deprecated, but can alternatively be used. .PP If \fBsyslog\fR is given as a value for the \f(CW\*(C`\-l\*(C'\fR command-line switch or the keyword \fIset log syslog\fR is found in the control file, Monit will use the \fBsyslog\fR system daemon to log messages with a priority assigned to each message based on the context. .PP To turn off logging, simply do not set the log in the control file (and of course, do not use the \-l switch) .PP The format for an entry in the log file is: .PP .Vb 1 \& [date] priority : message .Ve .PP for example: .PP .Vb 1 \& [2020\-08\-12T16:35:00+0200] info : \*(Aqlocalhost\*(Aq Monit started .Ve .SH "TERMINAL OUTPUT" .IX Header "TERMINAL OUTPUT" Monit uses \s-1ANSI\s0 escape sequences to colorise important parts of the command-line output, if the terminal supports colors, and \s-1UTF\-8\s0 box characters for tabular output. .PP If you want to process the monit \s-1CLI\s0 output in a script, you can use either the \-B option or use the following statement in the monit configuration file to disable tabular output and colors completely: .PP .Vb 1 \& SET TERMINAL BATCH .Ve .SH "DAEMON MODE" .IX Header "DAEMON MODE" Use .PP .Vb 2 \& SET DAEMON \& [[WITH] START DELAY ] .Ve .PP to specify Monit's poll cycle length and run Monit in daemon mode. You must specify a numeric argument which is a polling interval in seconds. .PP In daemon mode, Monit detaches from the console, puts itself in the background and runs continuously, monitoring each specified service and then goes to sleep for the given poll interval, wakes up and start monitoring again in an endless cycle. .PP Alternatively, you can use the \f(CW\*(C`\-d\*(C'\fR command line switch to set the poll interval, but it is strongly recommended to set the poll interval in your \fI~/.monitrc\fR file, by using \fIset daemon\fR. .PP Monit will then always start in daemon mode. If you do not use this statement and do not start monit with the \-d option, Monit will just run through the service checks once and then exit. This might be useful in some situations, but Monit is primarily designed to run as a daemon process. .PP Calling \f(CW\*(C`monit\*(C'\fR with a Monit daemon running in the background sends a wake-up signal to the daemon, forcing it to check services immediately. Calling \f(CW\*(C`monit\*(C'\fR with the quit argument will kill a running Monit daemon process instead of waking it up. .PP The start delay option can be used to wait (once) before Monit starts checking services after system reboot. Monit will by default start checking services immediately at startup. .SH "INIT SUPPORT" .IX Header "INIT SUPPORT" The \f(CW\*(C`set init\*(C'\fR statement prevents Monit from transforming itself into a daemon process. Instead Monit will run as a foreground process. (You should still use \f(CW\*(C`set daemon\*(C'\fR to specify the poll cycle). .PP This is required to run Monit from init. Using init to start Monit is probably the best way to run Monit if you want to be certain that you always have a running Monit daemon on your system. Another option is to run Monit from crontab. In any case, you should make sure that the control file does not have any syntax errors before you start Monit from init or crontab (use \f(CW\*(C`monit \-t\*(C'\fR to check). .PP To setup Monit to run from init, you can either use the \f(CW\*(C`set init\*(C'\fR statement in Monit's control file or use the \f(CW\*(C`\-I\*(C'\fR option from the command line. Here is what you must add to \f(CW\*(C`/etc/inittab\*(C'\fR: .PP .Vb 2 \& # Run Monit in standard run\-levels \& mo:2345:respawn:/usr/local/bin/monit \-Ic /etc/monitrc .Ve .PP After you have modified init's configuration file, you can run the following command to re-examine /etc/inittab and start Monit: .PP .Vb 1 \& telinit q .Ve .PP For systems without telinit: .PP .Vb 1 \& kill \-1 1 .Ve .PP If Monit is used to monitor services that are also started at boot time (e.g. services started via \s-1SYSV\s0 init rc scripts or via inittab) then, in some cases, a race condition could occur. That is; if a service is slow to start, Monit can assume that the service is not running and possibly try to start it and raise an alert, while, in fact the service is already about to start or already in its startup sequence. Please see the \s-1FAQ\s0 for a solution to this problem. The short version is to start Monit on a higher run-level after system processes. .SH "INCLUDE FILES" .IX Header "INCLUDE FILES" The Monit control file, \f(CW\*(C`monitrc\*(C'\fR, can include additional configuration files. This feature helps one to organise configuration into separate files instead of having everything in one file, if you like this kind of thing. Include statements can be placed at virtually any place in \f(CW\*(C`monitrc\*(C'\fR though the convention is at the bottom. The syntax is the following: .PP .Vb 1 \& INCLUDE .Ve .PP The globstring is any kind of string as defined in \f(CWglob(7)\fR. Thus, you can refer to a single file or you can load several files at once. If you want to use whitespace in your string the globstring needs to be embedded into quotes (') or double quotes ("). If the globstring matches a directory instead of a file, it is silently ignored. .PP Any \fIinclude\fR statements in an included file are parsed as in the main control file. .PP If the globstring matches several results, the files are included in a non sorted manner. If you need to rely on a certain order, you should avoid wild-card globbing and instead specify the full path of files included. .PP An example, .PP .Vb 1 \& include /etc/monit.d/*.cfg .Ve .PP This will load any file matching the globstring. That is, all files in \fI/etc/monit.d\fR that ends with the prefix \fI.cfg\fR. .PP Up to 1024 include files are supported. If this limit is exceeded, Monit will report an error. .SH "SSL OPTIONS" .IX Header "SSL OPTIONS" Common \s-1SSL/TLS\s0 options can be set using the following statement and will apply to all \s-1SSL\s0 connections made through Monit: .PP .Vb 12 \& SET [OPTIONS] { \& VERSION: , ... \& VERIFY: \& SELFSIGNED: \& CIPHERS: \& PEMFILE: \& PEMCHAIN: \& PEMKEY: \& CLIENTPEMFILE: \& CACERTIFICATEFILE: \& CACERTIFICATEPATH: \& } .Ve .PP \&\fI\s-1VERSION\s0\fR set the specific \s-1SSL/TLS\s0 version to use. By default Monit uses \s-1AUTO.\s0 In \s-1AUTO\s0 mode, only \s-1TLS 1.2\s0 and 1.3 are allowed, all other protocols are considered obsolete. If you want to use the obsolete protocol you must explicitly set the version. You can exclude the protocol using the \*(L"\-\*(R" prefix. Exclude list example: set ssl { version: auto \-sslv2 \-sslv3 \-tlsv1 \-tlsv11 } Example of allowed protocols list: set ssl { version: tlsv12 tlsv13 } .PP \&\fI\s-1VERIFY\s0\fR enable \s-1SSL\s0 server certificate verification. This will verify and report an error if the server certificate is not trusted, not valid or has expired. By default certificate verification is disabled, though we recommend enabling it, otherwise there is no guarantee that Monit speaks with the server you think it speaks with. .PP \&\fI\s-1SELFSIGNED\s0\fR self-signed certificates are rejected by default. Use this option to allow self-signed certificates. Warning: not recommended in production for security reasons, as in such case the client cannot verify it talks to the correct server and attack types like man-in-the-middle or \s-1DNS\s0 hijacking are possible). .PP \&\fI\s-1CIPHERS\s0\fR override default \s-1SSL/TLS\s0 ciphers. .PP \&\fI\s-1PEMFILE\s0\fR set the path to the \s-1SSL\s0 server certificate \&\*(L"database-file\*(R" in \s-1PEM\s0 format. This options has effect only for the monit \s-1HTTP\s0 interface. .PP As an alternative to setting \fI\s-1PEMFILE\s0\fR with a combined chain-key file, \&\fI\s-1PEMCHAIN\s0\fR and \fI\s-1PEMKEY\s0\fR set the path to the \s-1SSL\s0 certificate chain respectively the server private key file in \s-1PEM\s0 format. This options has effect only for the monit \s-1HTTP\s0 interface. .PP \&\fI\s-1CLIENTPEMFILE\s0\fR set the path to the \s-1PEM\s0 encoded \s-1SSL\s0 client certificates database file. If set, a client certificate authentication is enabled. .PP \&\fI\s-1CACERTIFICATEFILE\s0\fR set the path to the \s-1PEM\s0 encoded file containing Certificate Authority (\s-1CA\s0) certificates. Monit uses OpenSSL's default \&\s-1CA\s0 certificates if this options is not used (\fIopenssl version \-d\fR can be used to get the default \s-1CA\s0 certificates). Many distributions comes with \s-1SSL\s0 and \s-1CA\s0 certificates already setup and using this option is normally not necessary. .PP \&\fI\s-1CACERTIFICATEPATH\s0\fR set the path to the directory containing Certificate Authority (\s-1CA\s0) certificates. Monit uses OpenSSL's default \&\s-1CA\s0 certificates if this options is not used. Many distributions comes with \s-1SSL\s0 and \s-1CA\s0 certificates already setup and using this option is normally not necessary. .PP The \s-1SSL\s0 options statement will globally apply to all \s-1SSL/TLS\s0 connection made through Monit. \s-1SSL\s0 options can also be set in a local check, in \&\fImailserver\fR settings or in the \fImmonit\fR statement, and will then override or extend the global settings. .PP To set global \s-1SSL\s0 options, put this statement near the top of your \&\fI.monitrc\fR file: .PP .Vb 1 \& set ssl options {...} .Ve .PP Here is an example of setting both global and local \s-1SSL\s0 options: .PP .Vb 5 \& # Enable certificate verification for all SSL connections \& # Self\-signed certificates are not allowed by default \& set ssl options { \& verify: enable \& } \& \& # Verify certificate (via global setting) \& # Allow self\-signed certificate for this check \& check host example with address example.com \& if failed \& port 443 \& protocol https \& with ssl options {selfsigned: allow} \& then alert \& \& # Do not verify example2.com\*(Aqs certificate (override global setting) \& check host example2 with address example2.com \& if failed \& port 443 \& protocol https \& with ssl options {verify: disable} \& then alert .Ve .SH "FIPS MODE" .IX Header "FIPS MODE" To enable \s-1FIPS\s0 mode (provided your OpenSSL library supports it), add this statement to Monit control file: .PP .Vb 1 \& SET FIPS .Ve .SH "MONIT HTTPD" .IX Header "MONIT HTTPD" If specified in the control file, Monit will start with \s-1HTTP\s0 support. You can then use Monit \s-1CLI\s0 to start and stop services, disable or enable service monitoring as well as view the status of each service. .PP If \s-1HTTP\s0 support is enabled over \s-1TCP\s0 rather than over a Unix Socket, you can also view Monit's informative dashboard in your web browser. .PP Note that if \s-1HTTP\s0 support is disabled, the Monit \s-1CLI\s0 interface will have reduced functionality, as most \s-1CLI\s0 commands (such as \*(L"monit status\*(R") needs to communicate with the Monit background process via the \s-1HTTP\s0 interface. We strongly recommend having \s-1HTTP\s0 support enabled. If security is a concern, bind the \s-1HTTP\s0 interface to local host only or use Unix Socket so Monit is not accessible from the outside. .SS "\s-1UNIX SOCKET\s0" .IX Subsection "UNIX SOCKET" Syntax for Unix Socket: .PP .Vb 5 \& SET HTTPD UNIXSOCKET \& [UID ] \& [GID ] \& [PERMISSION ] \& ALLOW + .Ve .PP Example: .PP .Vb 2 \& set httpd unixsocket /var/run/monit.sock \& allow username:password .Ve .PP \&\fB\s-1UNIXSOCKET\s0\fR set the path to the Unix Socket Monit should bind to and listen on. .PP \&\fB\s-1UID\s0\fR Socket owner (optional, defaults to the user who executes Monit) .PP \&\fB\s-1GID\s0\fR Socket group (optional, defaults to primary group of the user who executes Monit) .PP \&\fB\s-1PERMISSION\s0\fR Socket permissions \- absolute octal mode (optional, process \s-1UMASK\s0 is applied by default) .SS "\s-1TCP PORT\s0" .IX Subsection "TCP PORT" Syntax for \s-1TCP\s0 port: .PP .Vb 4 \& SET HTTPD PORT \& [ADDRESS ] \& [[with] SSL {pemfile: }] \& ALLOW + .Ve .PP \&\fB\s-1PORT\s0\fR set the port Monit should bind to and listen on. Monit is usually setup on port 2812. Example: .PP .Vb 2 \& set httpd port 2812 \& allow username:password .Ve .PP You can now use to access Monit's web interface from a browser, after you have entered username and password as credentials. You might need to use double quotes around the password if it contains special chars such as \&\*(L"p@ssw:r#\*(R". .PP \&\fB\s-1ADDRESS\s0\fR make Monit listen on a specific interface only. For example if you \fIdon't\fR want to expose Monit's web interface to the network, bind it to localhost only. Monit will accept connections on any addresses if the \s-1ADDRESS\s0 option is not used: .PP .Vb 4 \& set httpd \& port 2812 \& use address 127.0.0.1 \& allow username:password .Ve .PP Monit \s-1HTTP\s0 over \s-1TCP\s0 supports both \s-1IP\s0 version 4 and 6. Support is transparent and does not require any special configuration. If the bind \&\fIaddress\fR is \fBnot\fR specified as in this example: .PP .Vb 3 \& set httpd \& port 2812 \& allow ... .Ve .PP Monit will bind to and listen on port 2812 on all interfaces, both IPv4 and IPv6 if available. To force Monit \s-1HTTP\s0 to only listen on and accept connections over \s-1IP\s0 version 6, specify an IPv6 address: .PP .Vb 4 \& set httpd \& port 2812 \& use address "fe80::222:19ff:fe53:6c59" \& allow ... .Ve .PP Likewise, to force Monit \s-1HTTP\s0 to only listen on and accept connections over \s-1IP\s0 version 4, specify an IPv4 address: .PP .Vb 4 \& set httpd \& port 2812 \& use address 62.109.39.247 \& allow ... .Ve .PP \fI\s-1SSL\s0 settings\fR .IX Subsection "SSL settings" .PP \&\fB\s-1SSL\s0\fR enable \s-1SSL/TLS\s0 for Monit's web interface. See options for full list of \s-1SSL\s0 options. .PP \&\fI\s-1PEMFILE\s0\fR sets the path to the \s-1PEM\s0 encoded file, which contains the server's private key and certificate. This file should be stored in a safe place on the filesystem and should have strict permissions, no more than 0700. .PP As an alternative \fI\s-1PEMCHAIN\s0\fR and \fI\s-1PEMKEY\s0\fR sets the path to separate \s-1PEM\s0 encoded certificate chain and private key file. The key file should be stored in a safe place on the filesystem and should have strict permissions, no more than 0700. .PP Example for using pemfile: .PP .Vb 6 \& set httpd \& port 2812 \& with ssl { \& pemfile: /etc/ssl/certs/monit.pem \& } \& allow myuser:mypassword .Ve .PP Example for using separate certificate chain and key: .PP .Vb 7 \& set httpd \& port 2812 \& with ssl { \& pemchain: /etc/ssl/certs/monit.chain.pem \& pemkey: /etc/ssl/certs/monit.key.pem \& } \& allow myuser:mypassword .Ve .PP You can now use to access the Monit web server over a \s-1TLS\s0 encrypted connection. .PP Self-signed server certificates note: The Monit \s-1CLI\s0 works on a client-server basis and uses the Monit \s-1HTTP GUI\s0 to collect status from the Monit daemon and pass commands like start/stop to it. As self-signed certificates are rejected by default for security reasons, the \s-1CLI\s0 won't work unless you explicitly allow it by using the \fI\s-1SELFSIGNED: ALLOW\s0\fR option: .PP .Vb 7 \& set httpd \& port 2812 \& with ssl { \& pemfile: /etc/ssl/certs/monit.pem \& selfsigned: allow \& } \& allow myuser:mypassword .Ve .PP \&\fB\s-1CLIENTPEMFILE\s0\fR enables a client certificate based authentication and sets the path to a \s-1PEM\s0 encoded database file, that contains a list of allowed client certificates. A connecting client has to provide a certificate known to Monit (listed in \fIclientpemfile\fR), otherwise it is rejected. This file must also include all necessary \s-1CA\s0 certificates. By default self-signed client certificates are \fBrejected\fR for security reasons, if you want to allow self-signed client certificates (recommended only for testing), you have to allow it explicitly using the \fB\s-1SELFSIGNED: ALLOW\s0\fR option (see the example above). See your browser's documentation for how to import client certificate to it. .PP Example: .PP .Vb 6 \& set httpd \& port 2812 \& with SSL { \& pemfile: /etc/ssl/certs/monit.pem \& clientpemfile: /etc/ssl/certs/monit\-client.pem \& } .Ve .SS "Monit version signature" .IX Subsection "Monit version signature" \&\fB\s-1SIGNATURE\s0\fR can be used to hide Monit version from the \&\s-1HTTP\s0 response header and error pages. For example: .PP .Vb 4 \& set httpd \& port 2812 \& signature disable \& allow myuser:mypassword .Ve .SS "Authentication" .IX Subsection "Authentication" Access to the Monit web interface is controlled primarily via the \&\fB\s-1ALLOW\s0\fR option which is used to specify authentication and authorise only specific clients to connect. .PP If the Monit command line interface is being used, at least one cleartext password is necessary (see below), otherwise the Monit command line interface will not be able to connect to the Monit web interface. .PP Clients that try to connect to Monit, but submit a wrong username and/or password are logged with their IP-address. .PP \fIClient certificates\fR .IX Subsection "Client certificates" .PP This authentication method is a strong authentication mechanism and employ \s-1HTTPS\s0 client certificates to verify the authenticity of a connecting client. Clients must posses a Public Key Certificate known by Monit. The client must connect to Monit over \s-1SSL\s0 and Monit will ask the client to send its certificate. Upon receiving the certificate Monit compares the certificate to certificates located in the \&\fI\s-1CLIENTPEMFILE\s0\fR file. Access is granted if the client certificate is in this file. See \s-1SSL\s0 settings for details. .PP \fIBasic Authentication\fR .IX Subsection "Basic Authentication" .PP Monit supports Basic Authentication as described in \s-1RFC 2617.\s0 .PP In short; a server challenge a client (e.g. a Browser) to send authentication information (username and password) and if accepted, the server will allow the client access to the requested document. .PP The biggest weakness with Basic Authentication is that username and password is sent in clear-text over the network (i.e. base64 encoded). It is therefore recommended that you do not use this authentication method unless you run Monit with \fIssl\fR support. With ssl, it is safe to use Basic Authentication since \fIall\fR \s-1HTTP\s0 data, including Basic Authentication headers will be encrypted. .PP Cleartext user and password .IX Subsection "Cleartext user and password" .PP Monit will use Basic Authentication if an allow statement contains a username and a password separated with a single ':' character. .PP Note: Special characters can be used, but for non-alphanumerics the password has to be quoted. .PP Syntax: .PP .Vb 1 \& ALLOW : .Ve .PP \fIHost and network allow list\fR .IX Subsection "Host and network allow list" .PP Monit maintains an access-control list of hosts and networks allowed to connect. You can add as many hosts as you want to, but only hosts with a valid domain name or its \s-1IP\s0 address are allowed. .PP Monit will query a name server to check any hosts trying to connect. If a host (client) is trying to connect, but cannot be found in the access list or cannot be resolved, Monit will shutdown the connection to the client promptly. .PP Control file example: .PP .Vb 6 \& set httpd port 2812 \& allow localhost \& allow my.other.work.machine.com \& allow 10.1.1.1 \& allow 192.168.1.0/255.255.255.0 \& allow 10.0.0.0/8 .Ve .PP Clients, not mentioned in the allow list and trying to connect to Monit will be denied access and are logged with their IP-address. .PP \s-1PAM\s0 .IX Subsection "PAM" .PP \&\s-1PAM\s0 is supported on platforms which provide \s-1PAM\s0 (such as Linux, macOS, FreeBSD, NetBSD). .PP Syntax: .PP .Vb 1 \& ALLOW @ .Ve .PP where \f(CW\*(C`group\*(C'\fR is the group name allowed to access Monit's web interface. Monit uses a \s-1PAM\s0 service called \fImonit\fR for \s-1PAM\s0 authentication, see the \s-1PAM\s0 manual page for detailed instructions on how to set the \s-1PAM\s0 service and \s-1PAM\s0 authentication plugins. .PP Sample \s-1PAM\s0 service for Monit on macOS (store as \&\*(L"/etc/pam.d/monit\*(R" file): .PP .Vb 8 \& # monit: auth account password session \& #auth sufficient pam_securityserver.so \& #auth sufficient pam_unix.so \& auth sufficient pam_opendirectory.so \& auth required pam_deny.so \& account required pam_permit.so \& password required pam_deny.so \& session required pam_permit.so .Ve .PP And a similar \s-1PAM\s0 service for Monit on Linux (store as \&\*(L"/etc/pam.d/monit\*(R" file): .PP .Vb 6 \& # monit: auth account password session \& auth sufficient pam_unix2.so \& auth required pam_deny.so \& account required pam_permit.so \& password required pam_deny.so \& session required pam_permit.so .Ve .PP A \f(CW\*(C`monitrc\*(C'\fR config which only allows group \f(CW\*(C`admin\*(C'\fR and \f(CW\*(C`staff\*(C'\fR authenticated via \&\s-1PAM\s0 to access the web interface: .PP .Vb 4 \& set httpd \& port 2812 \& allow @admin \& allow @staff readonly .Ve .PP htpasswd file .IX Subsection "htpasswd file" .PP Alternatively you store credentials in a \f(CW\*(C`htpasswd\*(C'\fR formatted file (one \&\fIuser:passwd\fR entry per line), like so: \fIallow [cleartext|crypt|md5] /path [users]\fR. The default is cleartext passwords. In case passwords are digested it is necessary to specify the cryptographic method. If you do not want all users in the password file to have access to Monit, you can specify only those users that should have access in the allow statement. Otherwise all users are added. .PP Example1: .PP .Vb 2 \& set httpd port 2812 \& allow md5 /etc/httpd/htpasswd john paul ringo george .Ve .PP If you use this method together with a host list, then only clients from the listed hosts will be allowed to connect to the Monit \s-1HTTP\s0 server and each client will be asked to provide a username and a password. .PP Example2: .PP .Vb 4 \& set httpd port 2812 \& allow localhost \& allow 10.1.1.1 \& allow hauk:"passw@rd" .Ve .PP If you only want to use Basic Authentication, then just provide allow entries with username and password or password files as in example 1 above. .PP Read-only users .IX Subsection "Read-only users" .PP Further it is possible to define some users as read-only. A read-only user can read the Monit web pages but will \fInot\fR get access to push-buttons and cannot change a service from the web interface. .PP .Vb 5 \& set httpd port 2812 \& allow admin:password \& allow hauk:password read\-only \& allow @admins \& allow @users read\-only .Ve .PP A user is set to read-only by using the \fIread-only\fR keyword \&\fBafter\fR username:password. In the above example the user \fIhauk\fR is defined as a read-only user, while the \fIadmin\fR user has all access rights. .PP Read-only http server .IX Subsection "Read-only http server" .PP Finally is is possible to restrict the entire web interface as read-only. All users, regardless if defined with or without the \fIread-only\fR keyword, have only the permissions described above. When using this setting it is recommend to set up a \fB\s-1UNIXSOCKET\s0\fR as well, otherwise the monit \s-1CLI\s0 will \fBnot\fR work. .PP .Vb 5 \& set httpd \& port 2812 \& read\-only \& unixsocket /run/monit.socket \& allow @users .Ve .SH "ALERT MESSAGES" .IX Header "ALERT MESSAGES" Monit will raise an alert in the following situations: .PP .Vb 10 \& o A service does not exist (e.g. process is not running) \& o Cannot read service data (e.g. cannot get filesystem usage) \& o Execution of a service related script failed (e.g. start failed) \& o Invalid service type (e.g. if path points to directory instead of file) \& o Custom test script returned error \& o Ping test failed \& o TCP/UDP connection and/or port test failed \& o Resource usage test failed (e.g. cpu usage too high) \& o Checksum mismatch or change (e.g. file changed) \& o File size test failed (e.g. file too large) \& o Timestamp test failed (e.g. file is older then expected) \& o Permission test failed (e.g. file mode doesn\*(Aqt match) \& o An UID test failed (e.g. file owned by different user) \& o A GID test failed (e.g. file owned by different group) \& o A process\*(Aqs PID changed out of Monit\*(Aqs control \& o A process\*(Aqs PPID changed out of Monit control \& o Too many service recovery attempts failed \& o A file content test found a match \& o Filesystem flags changed \& o A service action was performed by administrator \& o A network link down or up \& o A network link capacity changed \& o A network link saturation failed \& o A network link upload/download rate failed \& o Monit was started, stopped or reloaded .Ve .PP To get an alert via e\-mail, set the alert target using the global \f(CW\*(C`set alert\*(C'\fR statement (for all services) or the \f(CW\*(C`alert\*(C'\fR statement in the context of a service entry (for a single service). .SS "Setting an alert recipient" .IX Subsection "Setting an alert recipient" If an event occurs, Monit will send an alert. There are two kinds of alert statement: global and local. .PP Global syntax: .PP .Vb 1 \& SET ALERT mail\-address [[NOT] {event, ...}] [REMINDER cycles] .Ve .PP Example: .PP .Vb 1 \& set alert foo@bar .Ve .PP will send a default email to the address foo@bar whenever any event occurs on any service. .PP If you want to send alert messages to more email addresses, add a \&\f(CW\*(C`set alert \*(Aqemail\*(Aq\*(C'\fR statement for each address. .PP It is also possible to use the local alert statement in the context of a service check to enable alert for the given service only: .PP .Vb 1 \& ALERT mail\-address [[NOT] {event, ...}] [REMINDER cycles] .Ve .PP Local alert example: .PP .Vb 4 \& check host myhost with address 1.2.3.4 \& if failed port 3306 protocol mysql then alert \& if failed port 80 protocol http then alert \& alert foo@baz # Local service alert .Ve .PP You can combine global and local alert statements. If there is a conflict, the local alert has precedence and overrides the global statement. .PP \fISetting an event filter\fR .IX Subsection "Setting an event filter" .PP If you only want an alert message sent for certain events, list them in an \f(CW\*(C`{event, ...}\*(C'\fR block, e.g.: .PP .Vb 1 \& set alert foo@bar only on { timeout, nonexist } .Ve .PP The event list can also be negated to send alerts for all events \&\fIexcept\fR those which are listed, by prepending the list with the word \&\f(CW\*(C`not\*(C'\fR. For example, to receive all alerts except notification about Monit program start and stop: .PP .Vb 1 \& set alert foo@bar but not on { instance } .Ve .PP Here is a list of all possible event types emitted by Monit. Values from the first column can be used in the event filter list mentioned above: .PP .Vb 10 \& Event: | Failure state: | Success state: \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& action | "Action failed" | "Action done" \& checksum | "Checksum failed" | "Checksum succeeded" \& bytein | "Download bytes exceeded" | "Download bytes ok" \& byteout | "Upload bytes exceeded" | "Upload bytes ok" \& connection | "Connection failed" | "Connection succeeded" \& content | "Content failed", | "Content succeeded" \& data | "Data access error" | "Data access succeeded" \& exec | "Execution failed" | "Execution succeeded" \& fsflags | "Filesystem flags failed" | "Filesystem flags succeeded" \& gid | "GID failed" | "GID succeeded" \& icmp | "Ping failed" | "Ping succeeded" \& instance | "Monit instance changed" | "Monit instance changed not" \& invalid | "Invalid type" | "Type succeeded" \& link | "Link down" | "Link up" \& nonexist | "Does not exist" | "Exists" \& packetin | "Download packets exceeded" | "Download packets ok" \& packetout | "Upload packets exceeded" | "Upload packets ok" \& permission | "Permission failed" | "Permission succeeded" \& pid | "PID failed" | "PID succeeded" \& ppid | "PPID failed" | "PPID succeeded" \& resource | "Resource limit matched" | "Resource limit succeeded" \& saturation | "Saturation exceeded" | "Saturation ok" \& size | "Size failed" | "Size succeeded" \& speed | "Speed failed" | "Speed ok" \& status | "Status failed" | "Status succeeded" \& timeout | "Timeout" | "Timeout recovery" \& timestamp | "Timestamp failed" | "Timestamp succeeded" \& uid | "UID failed" | "UID succeeded" \& uptime | "Uptime failed" | "Uptime succeeded" .Ve .PP Each alert recipient can have it's own filter, for example: .PP .Vb 3 \& set alert foo@bar { nonexist, timeout, resource, icmp, connection } \& set alert security@bar on { checksum, permission, uid, gid } \& set alert admin@bar .Ve .PP \fISetting an error reminder\fR .IX Subsection "Setting an error reminder" .PP Monit by default sends just \fIone\fR notification if a service failed and another when/if it recovers. If you want to be notified that the service is still in a failed state, you can use the reminder option in the alert statement: .PP .Vb 1 \& SET ALERT mail\-address [WITH] REMINDER [ON] number [CYCLES] .Ve .PP For example if you want to be notified each tenth cycle if a service remains in a failed state, you can use: .PP .Vb 1 \& alert foo@bar with reminder on 10 cycles .Ve .PP Likewise if you want to be notified on each failed cycle, you can use: .PP .Vb 1 \& alert foo@bar with reminder on 1 cycle .Ve .SS "Disabling alerts for some service" .IX Subsection "Disabling alerts for some service" To suppress alerts for some user and service, add the \f(CW\*(C`noalert\*(C'\fR statement in the context of a service check. .PP .Vb 1 \& NOALERT mail\-address .Ve .PP Example (send all alerts to foo@bar except for service p3): .PP .Vb 1 \& set alert foo@bar \& \& check process p1 with pidfile /var/run/p1.pid \& \& check process p2 with pidfile /var/run/p2.pid \& \& check process p3 with pidfile /var/run/p3.pid \& noalert foo@bar .Ve .SS "Message format" .IX Subsection "Message format" The alert message format can be modified by using the \f(CW\*(C`set mail\-format\*(C'\fR statement: .PP .Vb 1 \& SET MAIL\-FORMAT {mail\-format} .Ve .PP Example: .PP .Vb 8 \& set mail\-format { \& from: Monit Support \& reply\-to: support@domain.com \& subject: $SERVICE $EVENT at $DATE \& message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. \& Yours sincerely, \& monit \& } .Ve .PP The \fIfrom:\fR option is the sender's email address for Monit alerts. A sender's name is optional, but if used, requires that the subsequent email-address is enclosed in angle brackets as in the example above. .PP The \fIreply-to:\fR option can be used to set the reply-to mail header, optionally with a name. .PP The \fIsubject:\fR option sets the message subject and must be on only \&\fIone\fR line. .PP The \fImessage:\fR option sets the mail body. This option should always be the last in a mail-format statement. The mail body can be as long as needed, but must \fInot\fR contain the block-closing '}' character. .PP You need not use all options, only the option which you want to override. For example to globally change the sender address only: .PP .Vb 1 \& set mail\-format { from: bofh@foo.bar } .Ve .PP The subject and body may contain \f(CW$NAME\fR variables, which are expanded by Monit. Here is a list of variables that can be used when composing an alert message. .IP "\(bu" 4 \&\fI\f(CI$EVENT\fI\fR .Sp A string describing the event that occurred. .IP "\(bu" 4 \&\fI\f(CI$SERVICE\fI\fR .Sp The service name .IP "\(bu" 4 \&\fI\f(CI$DATE\fI\fR .Sp The current time and date (\s-1RFC 822\s0 date style). .IP "\(bu" 4 \&\fI\f(CI$HOST\fI\fR .Sp The name of the host Monit is running on .IP "\(bu" 4 \&\fI\f(CI$ACTION\fI\fR .Sp The name of the action which was done by Monit. .IP "\(bu" 4 \&\fI\f(CI$DESCRIPTION\fI\fR .Sp The description of the error condition .SS "Setting a mail server for alert delivery" .IX Subsection "Setting a mail server for alert delivery" The mail server Monit should use to send alert messages is defined with a \f(CW\*(C`set mailserver\*(C'\fR statement: .PP .Vb 9 \& SET MAILSERVER \& \& [PORT number] \& [USERNAME string] [PASSWORD string] \& [using SSL [with options {...}] \& [CERTIFICATE CHECKSUM [MD5|SHA1] ], \& ... \& [with TIMEOUT X SECONDS] \& [using HOSTNAME hostname] .Ve .PP Multiple mail servers can be set by using a comma separated list. If Monit cannot connect to the first server, it will try the next in the list and so on. .PP The port statement allows one to override the default \s-1SMTP\s0 port (465 for \s-1SSL,\s0 or 25 for \s-1TLS\s0 and non secure connection). .PP Monit supports \s-1AUTH PLAIN\s0 and \s-1AUTH LOGIN\s0 for \s-1SMTP\s0 authentication. You can set a username and a password using the \s-1USERNAME\s0 and \&\s-1PASSWORD\s0 options. .PP You can set \s-1SSL/TLS\s0 options for the connection and also check a \s-1SSL\s0 certificate checksum. .PP The default connection timeout is 30 seconds. You can change this limit using the \s-1TIMEOUT\s0 option. .PP Example (setting two mail servers for failover): .PP .Vb 1 \& set mailserver smtp.gmail.com, smtp.other.host .Ve .PP By default, Monit uses the local host name in \s-1SMTP HELO/EHLO\s0 and in the Message-ID header. You can override this using the \s-1HOSTNAME\s0 option. .SS "Event queue" .IX Subsection "Event queue" If no mail server is available, Monit \fIcan\fR queue events in the local file-system for retry until the mail server recovers. .PP If Monit is used with M/Monit, the event queue provides a safe event store for M/Monit in the case of temporary problems. .PP The event queue is persistent across Monit restarts and provided that the back-end filesystem is persistent, across system restart as well. .PP By default, the queue is disabled and if the alert handler fails, Monit will simply drop the alert message. .PP To enable the event queue, add the following statement: .PP .Vb 1 \& SET EVENTQUEUE BASEDIR [SLOTS ] .Ve .PP The is the path to the directory where events will be stored. .PP Optionally if you want to limit the queue size, use the slots option to only store up to \fInumber\fR event messages. .PP Example: .PP .Vb 1 \& set eventqueue basedir /var/monit slots 5000 .Ve .PP If you are running more then one Monit instance on the same machine, you \fBmust\fR use separated event queue directories. .SH "SERVICE METHODS" .IX Header "SERVICE METHODS" Each service can have associated \fIstart\fR, \fIstop\fR and \fIrestart\fR methods which Monit can use to execute action on the service. .PP Syntax: .PP .Vb 4 \& [PROGRAM] = "program" \& [[AS] UID ] \& [[AS] GID ] \& [[WITH] TIMEOUT SECOND(S)] .Ve .PP If the \f(CW\*(C`program\*(C'\fR is a shell script it must begin with \f(CW\*(C`#!\*(C'\fR and the remainder of the first line must specify an interpreter for the program. e.g. \f(CW\*(C`#!/bin/sh\*(C'\fR .PP The \f(CW\*(C`program\*(C'\fR must also be executable (for example mode 0755). .PP It's possible to write scripts directly into the \fIprogram\fR this way: .PP .Vb 1 \& stop = "/bin/sh \-c \*(Aqkill \-s SIGTERM \`cat /var/run/process.pid\`\*(Aq" .Ve .PP By default the program is executed as the user under which Monit is running. If Monit is running as root, you may optionally specify the \fI\s-1UID\s0\fR and \fI\s-1GID\s0\fR the executed program should switch to. .PP Example: .PP .Vb 3 \& check process mmonit with pidfile /usr/local/mmonit/mmonit/logs/mmonit.pid \& start program = "/usr/local/mmonit/bin/mmonit" as uid "mmonit" and gid "mmonit" \& stop program = "/usr/local/mmonit/bin/mmonit stop" as uid "mmonit" and gid "mmonit" .Ve .PP In the case of a process check, Monit will wait up to 30 seconds for the start/stop action to finish before giving up and report an error. You can override this timeout using the \fI\s-1TIMEOUT\s0\fR option or globally using the set limits. .PP Example: .PP .Vb 3 \& check process foobar with pidfile /var/run/foobar.pid \& start program = "/etc/init.d/foobar start" with timeout 60 seconds \& stop program = "/etc/init.d/foobar stop" .Ve .SH "SERVICE POLL TIME" .IX Header "SERVICE POLL TIME" Services are checked regularly in an interval defined by the \f(CW\*(C`set daemon n\*(C'\fR statement. Checks are performed in the same order as they are written in the \f(CW\*(C`.monitrc\*(C'\fR file, except if dependencies are setup between services, where pre-requisite services are tested first. .PP It is possible to modify a service check schedule by using the \f(CW\*(C`every\*(C'\fR statement. .PP There are three variants: .IP "1. A poll cycle multiple" 4 .IX Item "1. A poll cycle multiple" .Vb 1 \& EVERY [number] CYCLES .Ve .IP "2. Cron-style" 4 .IX Item "2. Cron-style" .Vb 1 \& EVERY [cron] .Ve .IP "3. Negative Cron-style (do-not-check)" 4 .IX Item "3. Negative Cron-style (do-not-check)" .Vb 1 \& NOT EVERY [cron] .Ve .PP A cron-style string consist of 5 fields separated with white-space. All fields are required: .PP .Vb 7 \& Name: | Allowed values: | Special characters: \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& Minutes | 0\-59 | * \- , \& Hours | 0\-23 | * \- , \& Day of month | 1\-31 | * \- , \& Month | 1\-12 (1=jan, 12=dec) | * \- , \& Day of week | 0\-6 (0=sunday, 6=saturday) | * \- , .Ve .PP The special characters: .PP .Vb 10 \& Character: | Description: \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& * (asterisk) | The asterisk indicates that the expression will \& | match for all values of the field; e.g., using \& | an asterisk in the 4th field (month) would \& | indicate every month. \& \- (hyphen) | Hyphens are used to define ranges. For example, \& | 8\-9 in the hour field indicate between 8AM and \& | 9AM. Note that range is from start time until and \& | including end time. That is, from 8AM and until \& | 10AM unless minutes are set. Another example, \& | 1\-5 in the weekday field, specify from monday to \& | friday (including friday). \& , (comma) | Comma are used to specify a sequence. For example \& | 17,18 in the day field indicate the 17th and 18th \& | day of the month. A sequence can also include \& | ranges. For example, using 1\-5,0 in the weekday \& | field indicate monday to friday and sunday. .Ve .PP Example 1: Check once per two cycles .PP .Vb 2 \& check process nginx with pidfile /var/run/nginx.pid \& every 2 cycles .Ve .PP Example 2: Check every workday between 8AM to 7PM .PP .Vb 3 \& check program checkOracleDatabase \& with path /var/monit/programs/checkoracle.pl \& every "* 8\-19 * * 1\-5" .Ve .PP Example 3: Do not run the check in the backup window on Sunday between 0AM to 3AM, otherwise run the check with the regular poll cycle frequency. .PP .Vb 2 \& check process mysqld with pidfile /var/run/mysqld.pid \& not every "* 0\-3 * * 0" .Ve .PP Limitations: .PP The current scheduler is poll cycle based. If a service check is scheduled with the \fIevery cron\fR statement, Monit will check if the current time match the cron-string pattern. If it does, then the check is performed otherwise it is skipped. The cron specification does not guarantee when exactly the test will run, this depends on the default poll time and the length of the check cycle. In other words, we cannot guarantee that Monit will run on a specific time. Therefore we \&\fBstrongly\fR recommend to use an asterix in the minute field or at minimum a range, e..g. 0\-15. \fBNever\fR use a specific minute as Monit may not run on that minute. .PP We will address this limitation in a future release and convert the scheduler from serial polling into a parallel non-blocking scheduler where checks are guaranteed to run on time and with seconds resolution. .SH "SERVICE GROUPS" .IX Header "SERVICE GROUPS" Service entries in the control file, \fImonitrc\fR, can be grouped together by the \fIgroup\fR statement. The syntax is simply (keyword in capital): .PP .Vb 1 \& GROUP groupname .Ve .PP With this statement it is possible to group similar service entries together and manage them as a whole. Monit provides functions to start, stop, restart, monitor and unmonitor a group of services, like so: .PP To start a group of services from the console: .PP .Vb 1 \& monit \-g start .Ve .PP To stop a group of services: .PP .Vb 1 \& monit \-g stop .Ve .PP To restart a group of services: .PP .Vb 1 \& monit \-g restart .Ve .PP A service can be added to multiple groups by using more than one group statement: .PP .Vb 2 \& group www \& group filesystem .Ve .SH "SERVICE MONITORING MODE" .IX Header "SERVICE MONITORING MODE" Monit supports two monitoring modes: \fIactive\fR and \fIpassive\fR. .PP Syntax: .PP .Vb 1 \& MODE .Ve .PP In \fIactive\fR mode, Monit will pro-actively monitor a service and in case of problems raise alerts and restart the service. Active is the default mode. .PP The \fIpassive\fR mode is similar to the \fIactive\fR mode, except if the service fails, monit will \fBnot\fR try to fix a problem by restarting the service and will raise alerts only. .SH "SYSTEM REBOOT AND SERVICE STARTUP" .IX Header "SYSTEM REBOOT AND SERVICE STARTUP" Monit supports three reboot modes: \fIstart\fR, \fInostart\fR and \fIlaststate\fR. .PP Syntax: .PP .Vb 1 \& ONREBOOT .Ve .PP In \fIstart\fR mode, Monit will always start the service automatically on reboot, even if it was stopped before restart. This is the default mode and used if \fIonreboot\fR is not specified. .PP In \fInostart\fR mode, the service is \fInever\fR started automatically after reboot. This mode is intended for a high-availability solutions with active/passive clusters. For example, a service group \s-1HA,\s0 consisting of e.g. a mobile \s-1IP\s0 alias and an application server, is started on host H1, host H2 is backup and heartbeat is in place between both hosts. The service group \fI\s-1HA\s0\fR must be started on one node only. If H1 dies, H2 takes over the \s-1HA\s0 group. If H1 reboots, it is important that it won't try to start the \s-1HA\s0 group also. Even though the group was active on H1 before it crashed, as \s-1HA\s0 is running on H2 now. .PP In \fIlaststate\fR mode, a service's monitoring state is persistent across reboot. For instance, if a service was started before reboot, it will be started after reboot. If it was stopped before reboot, it will not be started after and so on. .PP The default \s-1ONREBOOT START\s0 mode can be overridden globally: .PP .Vb 1 \& SET ONREBOOT .Ve .SH "SERVICE RESTART LIMIT" .IX Header "SERVICE RESTART LIMIT" \&\fBMonit\fR provides a restart limit mechanism for situations where a service simply refuses to start or respond over a longer period. .PP The restart limit mechanism is based on number of service restarts and number of poll-cycles. For example, if a service had \fIx\fR restarts within \fIy\fR poll-cycles (where \fIx\fR <= \fIy\fR) then Monit will perform an action (for example unmonitor the service). If a timeout occurs, Monit will send an alert message if you have register interest for this event. .PP The syntax for the timeout statement is as follows (keywords are in capital): .PP .Vb 1 \& IF RESTART CYCLE(S) THEN .Ve .PP The \fIaction\fR value is either one of common actions or \&\s-1TIMEOUT\s0 (for backward compatibility, equals to \s-1UNMONITOR\s0 action). .PP Here is an example where Monit will unmonitor the service if it was restarted 2 times within 3 cycles: .PP .Vb 1 \& if 2 restarts within 3 cycles then unmonitor .Ve .PP To have Monit check the service again after monitoring was disabled, run \f(CW\*(C`monit monitor servicename\*(C'\fR from the command line. .PP Example for setting custom exec on timeout: .PP .Vb 1 \& if 5 restarts within 5 cycles then exec "/foo/bar" .Ve .PP Example for stopping the service: .PP .Vb 1 \& if 7 restarts within 10 cycles then stop .Ve .SH "SERVICE DEPENDENCIES" .IX Header "SERVICE DEPENDENCIES" If specified in the control file, Monit can do dependency checking before start, stop, monitoring or unmonitoring of services. The dependency statement may be used within any service entries in the Monit control file. .PP The syntax for the depend statement is simply: .PP .Vb 1 \& DEPENDS on service[, service [,...]] .Ve .PP Where \fBservice\fR is a check service entry name used in your \f(CW\*(C`.monitrc\*(C'\fR file, for instance \fBapache\fR or \fBdatafs\fR. .PP You may add more than one service name of any type or use more than one depend statement in an entry. .PP Services specified in a \fIdepend\fR statement will be checked during stop/start/monitor/unmonitor operations. .PP If a service is stopped or unmonitored it will stop/unmonitor any services that depends on itself. .PP If the service is started, all services which this service depends on will be started before starting this service. if start of some service failed, the service with prerequisites will \s-1NOT\s0 be started and the, but will remember that it should start and will retry next cycle. .PP If a service is restarted, it will first stop any active services that depend on it and after it is started, start all depending services that were active before the restart again. .PP Here is an example where we set up an apache service entry to depend on the underlying apache binary. If the binary should change an alert is sent and apache is not monitored anymore. The rationale is security and that Monit should not execute a possibly cracked apache binary. .PP .Vb 6 \& (1) check process apache with pidfile "/var/run/httpd.pid" \& (2) depends on httpd \& (3) ... \& (4) \& (5) check file httpd with path /usr/bin/httpd \& (6) if failed checksum then stop .Ve .PP The first entry is the process entry for apache. The second line sets up a dependency between this entry and the service entry named httpd in line 5. A dependency tree works as follows, if an action is conducted in a lower branch it will propagate upward in the tree and for every dependent entry execute the same action. In this case, if the checksum should fail in line 6 then an stop action is executed and apache binary is not checked anymore. But since the apache process entry depends on the httpd entry this entry will also execute the stop action. In short, if the checksum test for the httpd binary file should fail, both the check file httpd and the check process apache entry are stopped. .PP A dependency tree is a general construct and can be used between all types of service entries and span many levels and propagate any supported action (except the exec action which will not propagate upward in a dependency tree for obvious reasons). .PP Here is another different example. Consider the following common server setup: .PP .Vb 2 \& WEB\-SERVER \-> APPLICATION\-SERVER \-> DATABASE \-> FILESYSTEM \& (a) (b) (c) (d) .Ve .PP You can set dependencies so that the web-server depends on the application server to run before the web-server starts and the application server depends on the database server and the database depends on the filesystem to be mounted before it starts. See also the example section below for examples using the depend statement. .PP Here we describe how Monit will function with the above dependencies: .IP "If no services are running" 4 .IX Item "If no services are running" Monit will start the servers in the following order: \fId\fR, \fIc\fR, \&\fIb\fR, \fIa\fR .IP "If all servers are running" 4 .IX Item "If all servers are running" When you run 'monit stop all' this is the stop order: \fIa\fR, \fIb\fR, \&\fIc\fR, \fId\fR. If you run 'Monit stop d' then \fIa\fR, \fIb\fR and \fIc\fR are also stopped because they depend on \fId\fR and finally \fId\fR is stopped. .IP "If \fIa\fR does not run" 4 .IX Item "If a does not run" Monit will start \fIa\fR .IP "If \fIb\fR does not run" 4 .IX Item "If b does not run" Monit will first stop \fIa\fR then start \fIb\fR and finally start \fIa\fR if \&\fIb\fR is up again. .IP "If \fIc\fR does not run" 4 .IX Item "If c does not run" Monit will first stop \fIa\fR and \fIb\fR then start \fIc\fR and finally start \&\fIb\fR then \fIa\fR. .IP "If \fId\fR does not run" 4 .IX Item "If d does not run" Monit will first stop \fIa\fR, \fIb\fR and \fIc\fR then start \fId\fR and finally start \fIc\fR, \fIb\fR then \fIa\fR. .IP "If the control file contains a depend loop." 4 .IX Item "If the control file contains a depend loop." A depend loop is for example; a\->b and b\->a or a\->b\->c\->a. .Sp When Monit starts it will check for such loops and complain and exit if a loop was found. It will also exit with a complaint if a depend statement was used that does not point to a service in the control file. .SH "SERVICE TESTS" .IX Header "SERVICE TESTS" .SS "\s-1LIMITS\s0" .IX Subsection "LIMITS" You can configure and set various limits to tweak buffer sizes and timeouts used by Monit. In most situations the default values are fine. If needed, below are the limits you can currently modify in Monit. .PP Syntax: .PP .Vb 12 \& SET LIMITS { \& PROGRAMOUTPUT: , \& SENDEXPECTBUFFER: , \& FILECONTENTBUFFER: , \& HTTPCONTENTBUFFER: , \& NETWORKTIMEOUT: \& PROGRAMTIMEOUT: \& STOPTIMEOUT: \& STARTTIMEOUT: \& RESTARTTIMEOUT: \& EXECTIMEOUT: \& } .Ve .PP Where: \fIunit\fR is \*(L"B\*(R" (byte), \*(L"kB\*(R" (kilobyte) or \*(L"\s-1MB\*(R"\s0 (megabyte) \fItimeunit\fR is \*(L"\s-1MS\*(R"\s0 (millisecond) or \*(L"S\*(R" (second) .PP Options legend: .PP .Vb 10 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | Option | Description | Default | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | programOutput | limit for check program output (truncated after) | 512 B | \& | sendExpectBuffer | limit for send/expect protocol test | 256 B | \& | fileContentBuffer | limit for file content test (line) | 512 B | \& | httpContentBuffer | limit for HTTP content test (response body) | 1 MB | \& | networkTimeout | timeout for network I/O | 5 s | \& | programTimeout | timeout for check program | 300 s | \& | stopTimeout | timeout for service stop | 30 s | \& | startTimeout | timeout for service start | 30 s | \& | restartTimeout | timeout for service restart | 30 s | \& | execTimeout | timeout for test action exec | nolimit | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .Ve .SS "\s-1GENERAL SYNTAX\s0" .IX Subsection "GENERAL SYNTAX" Monit offers several if-tests you can use in a 'check' statement to test various aspects of a service. .PP You can test both for a predefined value or for a range and take actions if the value changes. .PP General syntax for testing a specific value or range: .PP .Vb 1 \& IF THEN [ELSE ] .Ve .PP The action is evaluated each time the <\s-1TEST\s0> condition is true. Success action is optional and executed only when the state changes from failure to success. If success action is not set, Monit will send a recovery alert by default. .PP General syntax for a value change test: .PP .Vb 1 \& IF CHANGED THEN .Ve .PP The action is executed each time the value changes. Monit will remember the new value and will trigger event if the value change again. .SS "\s-1ACTION\s0" .IX Subsection "ACTION" Each test can have associated \fIalert\fR, \fIstart\fR, \fIstop\fR, \fIrestart\fR, \&\fIunmonitor\fR or \fIexec\fR methods which Monit can use to execute actions or programs on the service. The success action also supports the \fIignore\fR method. .PP Syntax: .PP .Vb 1 \& ALERT | IGNORE | START | STOP | RESTART | UNMONITOR .Ve .PP or: .PP .Vb 5 \& EXEC "program" \& [[AS] UID ] \& [[AS] GID ] \& [[WITH] TIMEOUT SECOND(S)] \& [REPEAT EVERY [] CYCLE(S)] .Ve .PP In each test you must select the action to be executed from this list: .IP "\(bu" 4 \&\fB\s-1ALERT\s0\fR sends the user an alert event on each state change. .IP "\(bu" 4 \&\fB\s-1RESTART\s0\fR restarts the service \fBand\fR send an alert. Restart is performed by calling the service's registered restart method or by first calling the stop method followed by the start method if restart is not set. .IP "\(bu" 4 \&\fB\s-1START\s0\fR starts the service by calling the service's registered start method \fBand\fR send an alert. .IP "\(bu" 4 \&\fB\s-1STOP\s0\fR stops the service by calling the service's registered stop method \fBand\fR send an alert. If Monit stops a service it will not be checked by Monit anymore nor restarted again later. To reactivate monitoring of the service again you must explicitly enable monitoring from the web interface or from the console. .IP "\(bu" 4 \&\fB\s-1EXEC\s0\fR can be used to execute an arbitrary program \fBand\fR send an alert. If you choose this action you must state the program to be executed and if the program requires arguments you must enclose the program and its arguments in a quoted string. You may optionally specify the uid and gid the executed program should switch to upon start. The program is executed only \fIonce\fR if the test fails. You can enable execute repetition if the error persists for a given number of cycles. For instance: .Sp .Vb 3 \& if failed then exec "/usr/local/bin/sms.sh" \& as uid "nobody" and gid "nobody" \& repeat every 5 cycles .Ve .Sp Remember, if Monit is run by root, then all programs executed by Monit will be started with superuser privileges unless the uid and gid extension is used. .IP "\(bu" 4 \&\fB\s-1UNMONITOR\s0\fR will disable monitoring of the service \fBand\fR send an alert. The service will not be checked by Monit anymore nor restarted again later. To reactivate monitoring of the service you must explicitly enable monitoring from the web interface or from the console. .IP "\(bu" 4 \&\fB\s-1IGNORE\s0\fR can be used in the action to not generate an alert once the check reenters the state. .SS "\s-1FAULT TOLERANCE\s0" .IX Subsection "FAULT TOLERANCE" By default an action is executed if it matches and the corresponding service is set in an error state. However, you can require a test to fail more than once before the error event is triggered and the service state is changed to failed. This is useful to avoid getting alerts on spurious errors, which can happen, especially with network tests. .PP Syntax: .PP .Vb 1 \& FOR CYCLES ... .Ve .PP or: .PP .Vb 1 \& [TIMES WITHIN] CYCLES ... .Ve .PP The condition can be used both for failure and success action. .PP The first, simpler and recommended format requires \f(CW\*(C`X\*(C'\fR consecutive events before switching the state: .PP .Vb 4 \& if failed \& port 80 \& for 3 cycles \& then alert .Ve .PP The second format is more advanced and allows one to tolerate intermittent issues, but still catch excessive problems, where the service is flapping between error and success states frequently. .PP For example if every second cycle fails (1\-0\-1\-0\-1\-0\-...), then \*(L"for 2 cycles\*(R" condition will never match, despite the service having problems. The following statement will catch such a state: .PP .Vb 4 \& if failed \& port 80 \& for 3 times within 5 cycles \& then alert .Ve .PP Example which sets multiple error levels and actions: .PP .Vb 3 \& check filesystem rootfs with path /dev/hda1 \& if space usage > 80% for 5 times within 15 cycles then alert \& if space usage > 90% for 5 cycles then exec \*(Aq/try/to/free/the/space\*(Aq .Ve .PP Note: the maximum value for cycles is 64. .SS "\s-1EXISTENCE TESTS\s0" .IX Subsection "EXISTENCE TESTS" This test allows one to trigger an action based on the monitored object existence. It is supported for \fIprocess\fR, \fIfile\fR, \fIdirectory\fR, \&\fIfilesystem\fR and \fIfifo\fR services. .PP If no existence test is defined, the implicit non-existence test with restart action is activated, so for example if the process stops, Monit will restart it. .PP There are two types of existence tests: .PP \fINON-EXIST\fR .IX Subsection "NON-EXIST" .PP This test will trigger an action if the object does not exist. It can be used for example to make sure apache is running, data filesystem is mounted, etc. .PP .Vb 1 \& IF [DOES] NOT EXIST THEN .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \*(L"EXEC\*(R"\s0 or \&\*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: Exec a script if a filesystem does \s-1NOT\s0 exist: .PP .Vb 2 \& check filesystem disk1 with path /dev/sda1 \& if does not exist then exec "/sbin/mount..." .Ve .PP \fI\s-1EXIST\s0\fR .IX Subsection "EXIST" .PP This test is the inverse of the non-existence test: it will trigger an action if the object \s-1DOES\s0 exist. It can be used for example to kill a process which shouldn't be running. .PP .Vb 1 \& IF [DOES] EXIST THEN .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \*(L"EXEC\*(R"\s0 or \&\*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: kill a process that should not run: .PP .Vb 2 \& check process vmware matching "vmware" \& if exist then exec "/usr/bin/pkill \-9 vmware" .Ve .PP Example: Alert if a file exist which shouldn't .PP .Vb 2 \& check file x with path /some/path/x \& if exist then alert .Ve .SS "\s-1RESOURCE TESTS\s0" .IX Subsection "RESOURCE TESTS" Monit can examine how much resources a service is using. This test can only be used within a system or process service entry in the Monit control file. .PP Depending on system or process characteristics, services can be stopped or restarted and alerts can be generated. Thus it is possible to utilise systems which are idle and to spare system under high load. .PP Syntax: .PP .Vb 1 \& IF THEN .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R", \*(L">\*(R", \*(L"!=\*(R", \*(L"==\*(R" in C notation, \&\*(L"gt\*(R", \*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \&\*(L"less\*(R", \*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIvalue\fR is either an integer or a real number. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP \&\fIresource\fR set depends on the service type: .PP \fISystem resource tests\fR .IX Subsection "System resource tests" .PP \&\fI\s-1LOADAVG\s0([1min|5min|15min]) [\s-1PER CORE\s0]\fR refers to the system's load average. The load average is the number of processes in the system run queue per \s-1CPU\s0 core, averaged over the specified time period. Example: .PP .Vb 3 \& if loadavg (1min) per core > 2 for 15 cycles then alert \& if loadavg (5min) per core > 1.5 for 10 cycles then alert \& if loadavg (15min) per core > 1 for 8 cycles then alert .Ve .PP If you'll omit the \fIper core\fR option, the test will check the total load average regardless of \s-1CPU\s0 cores count. .PP \&\fI\s-1CPU\s0([user|system|wait|nice|hardirq|softirq|steal|guest|guestnice])\fR is the percent of time the system spend in given type of task: .IP "user" 4 .IX Item "user" The \s-1CPU\s0 is running code in user space mode, which includes any process that doesn't belong to the kernel, such as webservers, databases, shells and desktop related programs. .IP "system" 4 .IX Item "system" The \s-1CPU\s0 is running the kernel, which includes drivers and other kernel modules. The kernel also handles requests from user space processes like memory allocation, disk and network I/O and creating child processes. .IP "wait" 4 .IX Item "wait" I/O wait is when the \s-1CPU\s0 was idle while waiting for an I/O operation from disk or network to complete. .IP "nice" 4 .IX Item "nice" The nice statistics accounts for user space processes that are running with altered priority (higher or lower then normal). .IP "hardirq" 4 .IX Item "hardirq" The kernel is servicing hardware interrupt requests. Hardware interrupts come from peripherals like keyboard, network interfaces, disks, system clock, etc. .IP "softirq" 4 .IX Item "softirq" The kernel is servicing software interrupt requests. Software interrupts come from processes running in the system. .IP "steal" 4 .IX Item "steal" This applies only to virtual machines on a hypervisor. The steal time shows the percentage of time a virtual machine had to wait the real \s-1CPU\s0 while the hypervisor was servicing another virtual machine. If this number remains high, the host system is too busy and may need more physical CPUs or offload some virtual machines to another host. .IP "guest" 4 .IX Item "guest" This applies only to host machines running a hypervisor. It shows time spent running a virtual \s-1CPU\s0 for guest operating systems under the control of the Linux kernel. This value is already included in \&\*(L"user\*(R" statistics. .IP "guestnice" 4 .IX Item "guestnice" This applies only to host machines running a hypervisor. It shows time spent running a virtual \s-1CPU\s0 for guest operating systems under the control of the Linux kernel, with altered priority. This value is already included in \*(L"nice\*(R" statistics. .PP The user/system/wait/nice/hardirq/softirq/steal/guest/guestnice modifier is optional and the support depends on platform (Linux support depends on kernel version, all statistics are available since kernel 2.6.33): .PP .Vb 12 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | Platform | user | nice | system | wait | hardirq | softirq | steal | guest | guest nice | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | AIX | X | | X | X | | | | | | \& | DragonFlyBSD | X | X | X | | X | | | | | \& | FreeBSD | X | X | X | | X | | | | | \& | Linux | X | X | X | X | X | X | X | X | X | \& | MacOS | X | X | X | | | | | | | \& | NetBSD | X | X | X | | X | | | | | \& | OpenBSD | X | X | X | | X | | | | | \& | Solaris | X | | X | X | | | | | | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .Ve .PP Example: .PP .Vb 1 \& if cpu usage > 95% for 10 cycles then alert .Ve .PP \&\fI\s-1MEMORY\s0\fR is the system memory usage [%] or absolute value [B, kB, \&\s-1MB, GB\s0]. Example: .PP .Vb 1 \& if memory usage > 75% for 5 cycles then alert .Ve .PP \&\fI\s-1SWAP\s0\fR is the swap usage of the system [%] or absolute [B, kB, \s-1MB, GB\s0]. Example: .PP .Vb 1 \& if swap usage > 20% for 10 cycles then alert .Ve .PP \fIProcess resource tests\fR .IX Subsection "Process resource tests" .PP \&\fI\s-1CPU\s0\fR is the \s-1CPU\s0 usage of the process itself [%]. Monit calculates the \s-1CPU\s0 usage based on number of threads vs. available \s-1CPU\s0 cores. If the process has one thread, the 100% \s-1CPU\s0 usage equals to 100% utilization of one \s-1CPU\s0 core. If it has 2 threads, 100% \s-1CPU\s0 usage is reported when it uses 2 \s-1CPU\s0 cores on 100%, etc. If the process has more threads then the machine's available \s-1CPU\s0 cores, then the 100% \s-1CPU\s0 usage corresponds to utilization of all available \s-1CPU\s0 cores. Example: .PP .Vb 1 \& if cpu > 10% for 5 cycles then restart .Ve .PP \&\fI\s-1TOTAL CPU\s0\fR is the total \s-1CPU\s0 usage of the process and its children in (percent). You will want to use \s-1TOTAL CPU\s0 typically for services like Apache web server where one master process forks child processes as workers. Example: .PP .Vb 1 \& if total cpu > 50% for 10 cycles then restart .Ve .PP \&\fI\s-1THREADS\s0\fR is the number of processes' threads. Example: .PP .Vb 1 \& if threads > 3 then alert .Ve .PP \&\fI\s-1CHILDREN\s0\fR is the number of child processes of the process. Example: .PP .Vb 1 \& if children > 10 then alert .Ve .PP \&\fI\s-1MEMORY\s0\fR is the memory usage of the process itself, [%] or absolute value [B, kB, \s-1MB, GB\s0]. Example: .PP .Vb 1 \& if memory usage > 8 MB then alert .Ve .PP \&\fI\s-1TOTAL MEMORY\s0\fR is the memory usage of the process and its child processes in either percent or as an amount [B, kB, \s-1MB, GB\s0]. Example: .PP .Vb 1 \& if total memory usage > 1% for 10 cycles then alert .Ve .SS "\s-1PROCESS I/O ACTIVITY TEST\s0" .IX Subsection "PROCESS I/O ACTIVITY TEST" Monit can test process's filesystem read and write activity. This test can only be used in the context of a process service type. Monit will normally need to run as the root user to access this metrics. .PP The \s-1OS\s0 usually supports the per-process I/O metrics by bytes or by operations. .PP Some platforms allows one to differentiate the I/O subset that required physical storage access from generic I/O which was handled by cache. Note that as the physical I/O is usually aligned to the filesystem page, there may be difference between the total and physical I/O even if the process tried to read just 1 byte. .PP Per-process I/O activity statistics by platform: .PP .Vb 12 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | Platform | Operation | Byte (physical) | Byte (generic) | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | AIX | X | | | \& | DragonFlyBSD | X | | | \& | FreeBSD | X | | | \& | Linux | X | X | X | \& | MacOS | | X | | \& | NetBSD | X | | | \& | OpenBSD | X | | | \& | Solaris | X | | | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .Ve .PP \fIRead: bytes per second (generic)\fR .IX Subsection "Read: bytes per second (generic)" .PP Syntax: .PP .Vb 1 \& IF READ [ACTIVITY] /S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process p... \& if read activity > 1 MB/s then alert .Ve .PP \fIRead: bytes per second (physical storage)\fR .IX Subsection "Read: bytes per second (physical storage)" .PP Syntax: .PP .Vb 1 \& IF DISK READ [ACTIVITY] /S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process p... \& if disk read activity > 1 MB/s then alert .Ve .PP \fIRead: operations per second\fR .IX Subsection "Read: operations per second" .PP Syntax: .PP .Vb 1 \& IF DISK READ [ACTIVITY] operations/S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process p... \& if disk read activity > 500 operations/s then alert .Ve .PP \fIWrite: bytes per second (generic)\fR .IX Subsection "Write: bytes per second (generic)" .PP Syntax: .PP .Vb 1 \& IF WRITE [ACTIVITY] /S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process p... \& if write activity > 1 MB/s then alert .Ve .PP \fIWrite: bytes per second (physical storage)\fR .IX Subsection "Write: bytes per second (physical storage)" .PP Syntax: .PP .Vb 1 \& IF DISK WRITE [ACTIVITY] /S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process p... \& if disk write activity > 1 MB/s then alert .Ve .PP \fIWrite: operations per second\fR .IX Subsection "Write: operations per second" .PP Syntax: .PP .Vb 1 \& IF DISK WRITE [ACTIVITY] operations/S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process p... \& if disk write activity > 500 operations/s then alert .Ve .SS "\s-1FILE CHECKSUM TEST\s0" .IX Subsection "FILE CHECKSUM TEST" The checksum statement may only be used in a file service entry and can be used to check the file's \s-1MD5\s0 or \s-1SHA1\s0 checksum. .PP Check specific checksum: .PP .Vb 1 \& IF FAILED [MD5|SHA1] CHECKSUM [EXPECT checksum] THEN action .Ve .PP Check any file changes: .PP .Vb 1 \& IF CHANGED [MD5|SHA1] CHECKSUM THEN action .Ve .PP The choice of \s-1MD5\s0 or \s-1SHA1\s0 is optional. \s-1MD5\s0 features a 128 bits checksum (32 bytes hex encoded string) and \s-1SHA1\s0 a 160 bits checksum (40 bytes hex encoded string). If this option is omitted, Monit will try to guess the method from the \s-1EXPECT\s0 string or use \s-1MD5\s0 as the default checksum. .PP \&\f(CW\*(C`expect\*(C'\fR is optional and if used, specifies the md5 or sha1 string Monit should expect when testing a file's checksum. Monit will then not compute an initial checksum for the file, but instead use the string you submit. For example: .PP .Vb 3 \& if failed \& checksum expect 8f7f419955cefa0b33a2ba316cba3659 \& then alert .Ve .PP You can, for example, use the \s-1GNU\s0 utility \fI\f(BImd5sum\fI\|(1)\fR or \&\fI\f(BIsha1sum\fI\|(1)\fR to create a checksum string for a file and use this string in the expect-statement. .PP Reloading a server if its configuration file was changed: .PP .Vb 2 \& check file apache_conf with path /etc/apache/httpd.conf \& if changed checksum then exec "/usr/bin/apachectl graceful" .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .SS "\s-1TIMESTAMP TEST\s0" .IX Subsection "TIMESTAMP TEST" The timestamp statement may only be used in a file, fifo or directory service entry. .PP Relative timestamp syntax: .PP .Vb 1 \& IF [unit] THEN .Ve .PP Timestamp change syntax: .PP .Vb 1 \& IF CHANGED THEN action .Ve .PP There are four timestamp test types: .IP "\s-1ACCESS\s0 (\s-1ATIME\s0)" 12 .IX Item "ACCESS (ATIME)" Test the timestamp which is updated whenever the object is accessed, for example the file is read. Filesystem usually allows one to disable \fIatime\fR updates using mount options, so this test will work only if the filesystem performs atime updates. .IP "\s-1CHANGE\s0 (\s-1CTIME\s0)" 12 .IX Item "CHANGE (CTIME)" Test the timestamp which is updated whenever the object metadata such as owner, group, permissions or hard link count are changed. .IP "\s-1MODIFICATION\s0 (\s-1MTIME\s0)" 12 .IX Item "MODIFICATION (MTIME)" Test the timestamp which is updated whenever the object content is modified. The file modification timestamp is updated whenever the file is truncated or written to. The directory modification timestamp is updated whenever some files/subdirectories were added to the directory or removed from that directory. .IP "\s-1DEFAULT\s0 (\s-1LATEST OF CHANGE AND MODIFICATION TIMES\s0)" 12 .IX Item "DEFAULT (LATEST OF CHANGE AND MODIFICATION TIMES)" If no specific timestamp type is set, the latest of change and modification timestamps is checked. This test allows for simple testing of any object modification (data and metadata). .PP \&\fIoperator\fR is a choice of \*(L"<\*(R", \*(L">\*(R", \*(L"!=\*(R", \*(L"==\*(R" in C notation, \&\*(L"\s-1GT\*(R", \*(L"LT\*(R", \*(L"EQ\*(R", \*(L"NE\*(R"\s0 in shell sh notation and \*(L"\s-1NEWER, \*(R"OLDER\*(L", \&\*(R"GREATER\*(L", \*(R"LESS\*(L", \*(R"EQUAL\*(L", \*(R"NOTEQUAL"\s0 in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIvalue\fR is a time watermark. .PP \&\fIunit\fR is either \*(L"\s-1SECOND\s0(S)\*(R", \*(L"\s-1MINUTE\s0(S)\*(R", \*(L"\s-1HOUR\s0(S)\*(R" or \*(L"\s-1DAY\s0(S)\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP For example to reload apache if the configuration file changed: .PP .Vb 2 \& check file apache_conf with path /etc/apache/httpd.conf \& if changed timestamp then exec "/usr/bin/apachectl graceful" .Ve .PP For example to test directory for file addition or removal: .PP .Vb 2 \& check directory bar path /foo/bar \& if changed timestamp then alert .Ve .PP Example for sending alert if a log file is not updated for more than 1 hour: .PP .Vb 1 \& if timestamp is older than 1 hour then alert .Ve .SS "\s-1FILE SIZE TEST\s0" .IX Subsection "FILE SIZE TEST" The size statement may only be used in a check file service entry. If specified in the control file, Monit will compute a size for a file. .PP Testing specific size or range: .PP .Vb 1 \& IF SIZE [[operator] value [unit]] THEN action .Ve .PP Testing size changes: .PP .Vb 1 \& IF CHANGED SIZE THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R", \*(L">\*(R", \*(L"!=\*(R", \*(L"==\*(R" in C notation, \&\*(L"\s-1GT\*(R", \*(L"LT\*(R", \*(L"EQ\*(R", \*(L"NE\*(R"\s0 in shell sh notation and \*(L"\s-1GREATER\*(R", \&\*(L"LESS\*(R", \*(L"EQUAL\*(R", \*(L"NOTEQUAL\*(R"\s0 in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIvalue\fR is a size watermark. .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \&\*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R". If it is not specified, \*(L"byte\*(R" unit is assumed by default. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP For example to send an alert if the file is too large: .PP .Vb 2 \& check file mydb with path /data/mydatabase.db \& if size > 1 GB then alert .Ve .SS "\s-1FILE CONTENT TEST\s0" .IX Subsection "FILE CONTENT TEST" The content statement can be used to incrementally test the content of a text file by using regular expressions. .PP Syntax: .PP .Vb 1 \& IF CONTENT THEN action .Ve .PP \&\fIoperator\fR is either a \*(L"=\*(R" for match or \*(L"!=\*(R" for no-match. .PP \&\fIregex\fR is a string containing the extended regular expression. See also \fBregex\fR\|(7). .PP \&\fIpath\fR is an absolute path to a file containing extended regular expression on every line. See also \fBregex\fR\|(7). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP On startup the read position is set to the end of the file and Monit continues to scan to the end of the file on each cycle. .PP If the file size should decrease or inode changed, the read position is set to the start of the file. .PP Only lines ending with a newline character are inspected. .PP By default only the first 511 characters of a line are inspected. You can increase the limit using the set limits statement. .PP .Vb 1 \& IGNORE CONTENT .Ve .PP Lines matching an \fI\s-1IGNORE\s0\fR are not inspected during later evaluations. \fI\s-1IGNORE CONTENT\s0\fR has always precedence over \&\fI\s-1IF CONTENT\s0\fR. .PP All \fI\s-1IGNORE CONTENT\s0\fR statements are evaluated first, in the order of their appearance. Thereafter, all the \fI\s-1IF CONTENT\s0\fR statements are evaluated. .PP For example: .PP .Vb 3 \& check file syslog with path /var/log/syslog \& ignore content = "monit" \& if content = "^mrcoffee" then alert .Ve .SS "\s-1FILESYSTEM MOUNT FLAGS TEST\s0" .IX Subsection "FILESYSTEM MOUNT FLAGS TEST" Monit can test the filesystem mount flags for changes. This test is implicit and Monit will send alert in case of failure by default. .PP This test is useful for detecting changes of filesystem flags such as if the filesystem become read-only (on disk error) or mount flags were changed (such as nosuid). .PP The syntax for the fsflags statement is: .PP .Vb 1 \& IF CHANGED FSFLAGS THEN action .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem rootfs with path / \& if changed fsflags then exec "/my/script" .Ve .SS "\s-1SPACE USAGE TEST\s0" .IX Subsection "SPACE USAGE TEST" Monit can test a filesystem or a disk for space usage. This test may only be used in the context of a filesystem service type. .PP Filesystems usually have some space reserved for the root user (ca. 1\-5%), so non-superusers cannot write to a nearly full filesystem. If you set a limit for the filesystem which is used by non-root users you might want to consider these reserved blocks when setting the limit. You can use Monit itself to view the reserved blocks percentage by using the \s-1CLI\s0 status command or the \s-1HTTP\s0 interface for the given filesystem. .PP Syntax: .PP .Vb 1 \& IF SPACE operator value unit THEN action .Ve .PP or: .PP .Vb 1 \& IF SPACE FREE operator value unit THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R",\s0 \*(L"%\*(R" or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem rootfs with path / \& if space usage > 90% then alert .Ve .SS "\s-1INODE USAGE TEST\s0" .IX Subsection "INODE USAGE TEST" Monit can test filesystem inode usage. This test may only be used in the context of a filesystem service type. .PP Syntax: .PP .Vb 1 \& IF INODE(S) operator value [unit] THEN action .Ve .PP or: .PP .Vb 1 \& IF INODE(S) FREE operator value [unit] THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is optional. If not specified, the value is an absolute count of inodes. You can use the \*(L"%\*(R" character or the longer alternative \*(L"percent\*(R" as a unit. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem rootfs with path / \& if inode usage > 90% then alert .Ve .SS "\s-1DISK I/O TEST\s0" .IX Subsection "DISK I/O TEST" Monit can test a filesystem read and write activity. This test may only be used in the context of a filesystem service type. .PP The available I/O metrics depends on the platform and filesystem. Some platforms allows us to get I/O activity for specific partition, others just for the whole disk. Some allows us to get metrics for network filesystems, others just for block devices. .PP Platforms I/O metrics granularity and filesystem support in Monit: .PP .Vb 12 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | Platform | Granularity | Supported filesystems | TBD | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | AIX | per\-disk | Disk io monitoring currently not supported | JFSx | \& | DragonFlyBSD | per\-disk | UFS | HAMMER | \& | FreeBSD | per\-disk | UFS, ZFS | | \& | Linux | per\-filesystem | EXTx, XFS, BTRFS, ZFS, NFS, CIFS | | \& | MacOS | per\-disk | HFS | | \& | NetBSD | per\-disk | FFS | NFS | \& | OpenBSD | per\-disk | FFS | | \& | Solaris | per\-filesystem | ZFS, UFS, NFS | | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .Ve .PP \fIRead: bytes per second\fR .IX Subsection "Read: bytes per second" .PP Syntax: .PP .Vb 1 \& IF READ [RATE] /S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem disk1... \& if read rate > 1 MB/s then alert .Ve .PP \fIRead: operations per second\fR .IX Subsection "Read: operations per second" .PP Syntax: .PP .Vb 1 \& IF READ [RATE] operations/S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem disk1... \& if read rate > 500 operations/s then alert .Ve .PP \fIWrite: bytes per second\fR .IX Subsection "Write: bytes per second" .PP Syntax: .PP .Vb 1 \& IF WRITE [RATE] /S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R", \&\*(L"percent\*(R". .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem disk1... \& if write rate > 1 MB/s then alert .Ve .PP \fIWrite: operations per second\fR .IX Subsection "Write: operations per second" .PP Syntax: .PP .Vb 1 \& IF WRITE [RATE] operations/S THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check filesystem disk1... \& if write rate > 500 operations/s then alert .Ve .PP \fIService time per operation\fR .IX Subsection "Service time per operation" .PP Service Time is the time taken to complete a read or a write operation. This is a fairly important metric. If it grows, it means that the disk is not able to handle the operations fast enough. Growth charts are available in M/Monit. .PP Syntax: .PP .Vb 1 \& IF SERVICE TIME THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is \*(L"\s-1MS\*(R"\s0 (millisecond) or \*(L"S\*(R" (second) .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 3 \& if service time > 10 milliseconds \& for 3 times within 5 cycles \& then alert .Ve .SS "\s-1PERMISSION TEST\s0" .IX Subsection "PERMISSION TEST" Monit can test the permissions of file objects. This test may only be used in the context of a file, fifo, directory or filesystem service types. .PP Syntax for testing specific permissions: .PP .Vb 1 \& IF FAILED PERM(ISSION) octalnumber THEN action .Ve .PP Syntax for testing any permission change: .PP .Vb 1 \& IF CHANGED PERM(ISSION) THEN action .Ve .PP \&\fIoctalnumber\fR defines permissions for a file, a directory or a filesystem as four octal digits (0\-7). Valid range is 0000 \- 7777 (you can omit the leading zeros, Monit will add the zeros to the left. For example, \*(L"640\*(R" is a valid value and matches \*(L"0640\*(R"). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check file shadow with path /etc/shadow \& if failed permission 0640 then alert .Ve .SS "\s-1UID TEST\s0" .IX Subsection "UID TEST" Monit can monitor the owner user id (uid) of a file, fifo, directory or owner and effective user of a process. .PP Syntax: .PP .Vb 1 \& IF FAILED [E]UID THEN action .Ve .PP \&\fIvalue\fR defines a user id either in numeric or in string form. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check file shadow with path /etc/shadow \& if failed uid "root" then alert .Ve .SS "\s-1GID TEST\s0" .IX Subsection "GID TEST" Monit can monitor the owner group id (gid) of a file, fifo, directory or process. .PP Syntax: .PP .Vb 1 \& IF FAILED GID THEN action .Ve .PP \&\fIvalue\fR defines a group id either in numeric or in string form. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check file shadow with path /etc/shadow \& if failed gid "shadow" then alert .Ve .SS "\s-1HARDLINK TEST\s0" .IX Subsection "HARDLINK TEST" The hardlink statement may be used in a check file, fifo or directory service entry. If specified in the control file, Monit will compute the number of hard links for a file, fifo or directory. .PP Testing a specific value: .PP .Vb 1 \& IF HARDLINK [[operator] value] THEN action .Ve .PP Testing hardlink changes: .PP .Vb 1 \& IF CHANGED HARDLINK THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R", \*(L">\*(R", \*(L"!=\*(R", \*(L"==\*(R" in C notation, \&\*(L"\s-1GT\*(R", \*(L"LT\*(R", \*(L"EQ\*(R", \*(L"NE\*(R"\s0 in shell sh notation and \*(L"\s-1GREATER\*(R", \&\*(L"LESS\*(R", \*(L"EQUAL\*(R", \*(L"NOTEQUAL\*(R"\s0 in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIvalue\fR is a watermark. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP For example to send an alert if the number of used hard links of a directory is too large: .PP .Vb 2 \& check directory upload with path /data/upload \& if hardlink > 32000 then alert .Ve .SS "\s-1PID TEST\s0" .IX Subsection "PID TEST" Monit can test the process's \s-1PID.\s0 Monit will send an alert in case the \s-1PID\s0 changed outside of Monit's control. .PP Syntax: .PP .Vb 1 \& IF CHANGED PID THEN action .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP This test is useful to detect possible process restarts which has occurred in the timeframe between two Monit testing cycles. .PP For example if someone changes sshd configuration and did sshd restart outside of Monit's control you will be notified that the process was replaced by a new instance: .PP .Vb 2 \& check process sshd with pidfile /var/run/sshd.pid \& if changed pid then alert .Ve .SS "\s-1PPID TEST\s0" .IX Subsection "PPID TEST" Monit can test the process's parent \s-1PID\s0 (\s-1PPID\s0) for changes. Monit will send alert in the case that the \s-1PPID\s0 changed outside of Monit control. .PP The syntax for the ppid statement is: .PP .Vb 1 \& IF CHANGED PPID THEN action .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check process myproc with pidfile /var/run/myproc.pid \& if changed ppid then exec "/my/script" .Ve .SS "\s-1UPTIME TEST\s0" .IX Subsection "UPTIME TEST" The uptime statement may only be used in a process and system service type context. .PP Syntax: .PP .Vb 1 \& IF UPTIME [[operator] value [unit]] THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R", \*(L">\*(R", \*(L"!=\*(R", \*(L"==\*(R" in C notation, \&\*(L"\s-1GT\*(R", \*(L"LT\*(R", \*(L"EQ\*(R", \*(L"NE\*(R"\s0 in shell sh notation and \*(L"\s-1GREATER\*(R", \&\*(L"LESS\*(R", \*(L"EQUAL\*(R", \*(L"NOTEQUAL\*(R"\s0 in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIvalue\fR is a uptime watermark. .PP \&\fIunit\fR is either \*(L"\s-1SECOND\*(R", \*(L"MINUTE\*(R", \*(L"HOUR\*(R"\s0 or \*(L"\s-1DAY\*(R"\s0 (it is also possible to use \*(L"\s-1SECONDS\*(R", \*(L"MINUTES\*(R", \*(L"HOURS\*(R",\s0 or \*(L"\s-1DAYS\*(R"\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example of restarting the process every three days: .PP .Vb 4 \& check process myapp with pidfile /var/run/myapp.pid \& start program = "/etc/init.d/myapp start" \& stop program = "/etc/init.d/myapp stop" \& if uptime > 3 days then restart .Ve .SS "\s-1SECURITY ATTRIBUTE TEST\s0" .IX Subsection "SECURITY ATTRIBUTE TEST" The security attribute statement may only be used in a process context. .PP Syntax: .PP .Vb 1 \& IF FAILED SECURITY ATTRIBUTE THEN .Ve .PP \&\fIstring\fR expected security attribute value .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example for SELinux: .PP .Vb 2 \& check process ntpd matching "ntpd" \& if failed security attribute "system_u:system_r:ntpd_t:s0" then alert .Ve .PP Example for AppArmor: .PP .Vb 2 \& check process ntpd matching "ntpd" \& if failed security attribute "/usr/sbin/ntpd (enforce)" then alert .Ve .SS "\s-1SYSTEM AND\s0 PER-PROCESS \s-1FILEDESCRIPTORS TEST\s0" .IX Subsection "SYSTEM AND PER-PROCESS FILEDESCRIPTORS TEST" Monit can test the filedescriptors usage on the system and process level. You can check either an absolute value or percentual usage of the current maximum. The per-process percentual usage can be used only if the system exposes per-process maximum. .PP Syntax: .PP .Vb 1 \& IF FILEDESCRIPTORS [%] THEN action .Ve .PP For process only, you can also check accumulated number for the process and all its children. .PP Syntax: .PP .Vb 1 \& IF TOTAL FILEDESCRIPTORS THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fInumber\fR limit. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Examples: .PP .Vb 2 \& check system $HOST \& if filedescriptors >= 90% then alert \& \& check process myproc with pidfile /var/run/myproc.pid \& if filedescriptors >= 90% then alert \& if filedescriptors >= 99% then restart \& if total filedescriptors > 5000 then alert .Ve .SS "\s-1PROGRAM STATUS TEST\s0" .IX Subsection "PROGRAM STATUS TEST" You can check the exit status of a program or a script. This test may only be used within a check program service entry in the Monit control file. .PP Syntax for testing specific exit value: .PP .Vb 1 \& IF STATUS operator value THEN action .Ve .PP Syntax for testing any exit value change: .PP .Vb 1 \& IF CHANGED STATUS THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Example: .PP .Vb 2 \& check program myscript with path /usr/local/bin/myscript.sh \& if status != 0 then alert .Ve .PP Sample script for the above example (/usr/local/bin/myscript.sh): .PP .Vb 3 \& #!/bin/sh \& echo test \& exit $? .Ve .PP You can also send parameters with the program: .PP .Vb 2 \& check program list\-files with path "/bin/ls \-lrt /tmp/" \& if status != 0 then alert .Ve .PP Arguments to the program or script is a sequence of whitespace separated strings. In the above example the strings '\-lrt' and '/tmp/' are arguments to the program '/bin/ls'. If arguments are used, it is recommended to use quotes \fB"\fR to enclose the string, otherwise, if no arguments are used, quotes are not needed. .PP Notes: If the program is a script, the interpreter is required in the first line. The program or script must also be executable. .PP If Monit is run as the super user, you can optionally run the program as a different user and/or group. In this example we run the \fIls\fR program as user www and as group staff: .PP .Vb 4 \& check program ls with path "/bin/ls /tmp" \& as uid "www" \& and gid "staff" \& if status != 0 then alert .Ve .PP Monit will execute the program periodically and if the exit status of the program does not match the expected result, Monit can perform an action. In the example above, Monit will raise an alert if the exit value is different from 0. By convention, 0 means the program exited normally. .PP Program checks are asynchronous. Meaning that Monit will not wait for the program to exit, but instead, Monit will start the program in the background and immediately continue checking the next service entry in \&\fImonitrc\fR. At the next cycle, Monit will check if the program has finished and if so, collect the program's exit status. If the status indicate a failure, Monit will raise an alert message containing the program's error (stderr) output, if any. If the program has not exited after the first cycle, Monit will wait another cycle and so on. If the program is still running after 5 minutes, Monit will kill it and generate a program timeout event. It is possible to override the default timeout (see the syntax below). .PP Multiple status tests can be used, for example: .PP .Vb 4 \& check program hwtest with path /usr/local/bin/hwtest.sh \& with timeout 500 seconds \& if status = 1 then alert \& if status = 3 for 5 cycles then exec "/usr/local/bin/emergency.sh" .Ve .SS "\s-1PROGRAM OUTPUT CONTENT TEST\s0" .IX Subsection "PROGRAM OUTPUT CONTENT TEST" The content statement can be used to either test the content of a program by using regular expressions or check for changes in the output. .PP Syntax: .PP .Vb 2 \& IF CONTENT THEN action \& IF CONTENT [NOT] CHANGED THEN action .Ve .PP \&\fIoperator\fR is either a \*(L"=\*(R" for match or \*(L"!=\*(R" for no-match. .PP \&\fIregex\fR is a string containing the extended regular expression. See also \fBregex\fR\|(7). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP By default the output check is limited to 511 characters only. You can increase the limit using the set limits statement. .PP Examples: .PP .Vb 2 \& check program disk0_smart with path "/usr/sbin/nvme smart\-log /dev/nvme0" \& if content != "critical_warning[ ]+: 0" then alert \& \& check program ip_route with path "/usr/bin/ip route" \& if content changed then alert .Ve .SS "\s-1NETWORK INTERFACE TESTS\s0" .IX Subsection "NETWORK INTERFACE TESTS" Monit can check network interfaces for: .IP "Status" 3 .IX Item "Status" .PD 0 .IP "Capacity" 3 .IX Item "Capacity" .IP "Saturation" 3 .IX Item "Saturation" .IP "Upload and download [bytes]" 3 .IX Item "Upload and download [bytes]" .IP "Upload and download [packets]" 3 .IX Item "Upload and download [packets]" .PD .PP \fILink status\fR .IX Subsection "Link status" .PP You can check the network link state. This test may only be used within a check network service entry in the Monit control file. .PP Syntax: .PP .Vb 1 \& IF LINK THEN action .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP The \fI\s-1DOWN\s0\fR test will fail if the link/interface is down or link errors were detected. .PP Mixing \*(L"link up\*(R" and \*(L"link down\*(R" in the same \*(L"check network\*(R" is not supported. .PP Examples: .PP .Vb 2 \& check network eth0 with interface eth0 \& if link down then alert \& \& check network eth5 with interface eth5 \& if link up then exec "/usr/bin/monit start backup" .Ve .PP In case a link failed you can add a start and stop program to automatically restart the interface which might help. (Substitute with the relevant network commands for your system) .PP .Vb 4 \& check network eth0 with interface eth0 \& start program = \*(Aq/sbin/ipup eth0\*(Aq \& stop program = \*(Aq/sbin/ipdown eth0\*(Aq \& if link down then restart .Ve .PP \fILink capacity\fR .IX Subsection "Link capacity" .PP You can check the network link mode capacity for changes. This test may only be used within a check network service entry in the Monit control file. .PP Syntax: .PP .Vb 1 \& IF CHANGED LINK [CAPACITY] THEN action .Ve .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP The test will match if the link mode has changed (e.g. maximum speed dropped) or if the duplex mode has changed. .PP \&\s-1NOTE:\s0 not all interface types allow for capacity monitoring. Pseudo interfaces such as loopback device or VMWare interfaces does not have a speed attribute. .PP Example: .PP .Vb 2 \& check network eth0 with interface eth0 \& if changed link capacity then alert .Ve .PP \fILink saturation\fR .IX Subsection "Link saturation" .PP You can check the network link saturation. Monit then computes the link utilisation based on the current transfer rate vs. link capacity. This test may only be used within a check network service entry in the Monit control file. .PP Syntax: .PP .Vb 1 \& IF SATURATION operator value% THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP \&\s-1NOTE:\s0 this test depends on the availability of the speed attribute and not all interface types have this attribute. See the \s-1LINK SPEED\s0 test description. .PP Example: .PP .Vb 2 \& check network eth0 with interface eth0 \& if saturation > 90% then alert .Ve .PP \fILink upload and download [bytes]\fR .IX Subsection "Link upload and download [bytes]" .PP You can check a network link upload and download bandwidth usage, current transfer speed and total data transferred in the last 24 hours. This test may only be used within a \fIcheck network\fR service entry in the Monit control file. .PP Upload speed test syntax (per second): .PP .Vb 1 \& IF UPLOAD operator value unit/S THEN action .Ve .PP Download speed test syntax (per second): .PP .Vb 1 \& IF DOWNLOAD operator value unit/S THEN action .Ve .PP Total upload data test syntax: .PP .Vb 1 \& IF TOTAL UPLOADED operator value unit IN LAST number time\-unit THEN action .Ve .PP Total download data test syntax: .PP .Vb 1 \& IF TOTAL DOWNLOADED operator value unit IN LAST number time\-unit THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fIunit\fR is a choice of \*(L"B\*(R",\*(L"\s-1KB\*(R",\*(L"MB\*(R",\*(L"GB\*(R"\s0 or long alternatives \&\*(L"byte\*(R", \*(L"kilobyte\*(R", \*(L"megabyte\*(R", \*(L"gigabyte\*(R". .PP \&\fItime-unit\fR is a choice of \*(L"\s-1MINUTE\s0(S)\*(R", \*(L"\s-1HOUR\s0(S)\*(R", \*(L"\s-1DAY\*(R". NOTE:\s0 Monit maintains a rolling count of total uploaded and downloaded bytes for the last 24 hours only. The value of time-unit can therefore not specify a range wider than one day. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Examples: .PP .Vb 4 \& check network eth0 with interface eth0 \& if upload > 500 kB/s then alert \& if total downloaded > 1 GB in last 2 hours then alert \& if total downloaded > 10 GB in last day then alert .Ve .PP \fILink upload and download [packets]\fR .IX Subsection "Link upload and download [packets]" .PP You can check the network link upload and download packets count, current transfer rate and total data transferred in last 24 hours. This test may only be used within a check network service entry in the Monit control file. .PP Current upload bandwidth rate test syntax: .PP .Vb 1 \& IF UPLOAD operator value PACKETS/S THEN action .Ve .PP Current download bandwidth rate test syntax: .PP .Vb 1 \& IF DOWNLOAD operator value PACKETS/S THEN action .Ve .PP Total upload test syntax: .PP .Vb 1 \& IF TOTAL UPLOADED operator value PACKETS IN LAST number time\-unit THEN action .Ve .PP Total download test syntax: .PP .Vb 1 \& IF TOTAL DOWNLOADED operator value PACKETS IN LAST number time\-unit THEN action .Ve .PP \&\fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fItime-unit\fR is a choice of \*(L"\s-1MINUTE\s0(S)\*(R", \*(L"\s-1HOUR\s0(S)\*(R", \*(L"\s-1DAY\*(R". NOTE:\s0 Monit keeps total upload/download statistics only for the last 24 hours. The time-unit value cannot therefore span more than one day. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP Examples: .PP .Vb 3 \& check network eth0 with interface eth0 \& if upload > 1000 packets/s then alert \& if total uploaded > 900000 packets in last hour then alert .Ve .SS "\s-1NETWORK PING TEST\s0" .IX Subsection "NETWORK PING TEST" Monit can perform a network ping test by sending \s-1ICMP\s0 echo request datagram packets to a host and wait for the reply. This test can only be used within a check host statement. Monit must also run as the root user in order to be able to perform the ping test (because the ping test must use raw sockets which usually only the super user is allowed to). .PP Syntax: .PP .Vb 7 \& IF PING[4|6] \& [COUNT number] \& [SIZE number] \& [RESPONSETIME operator number ] \& [TIMEOUT number SECONDS] \& [ADDRESS string] \& THEN action .Ve .PP If a \s-1DNS\s0 host name was used in the \fIcheck host\fR statement and the host name resolve to several addresses (either IPv4 or IPv6), Monit will ping the first available address and continue with the next address until one connection succeed or until there are no more addresses left to try. You can force Monit to only ping IPv4 or IPv6 addresses by using the \s-1PING4\s0 or the \s-1PING6\s0 keyword instead of \s-1PING.\s0 .PP The \fB\s-1COUNT\s0\fR parameter specifies how many consecutive ping requests will be sent to the host in one cycle at maximum. The default value is 3. .PP The \fB\s-1SIZE\s0\fR parameter specifies the ping request payload size. Default is 64 bytes, minimum is 8 bytes, maximum 1492 bytes. .PP The \fB\s-1RESPONSETIME\s0\fR parameter sets the response time limit. \fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP If no reply arrive within \fB\s-1TIMEOUT\s0\fR seconds, Monit reports an error. If at least one reply was received, the ping test is considered a success. .PP The \fB\s-1ADDRESS\s0\fR parameter specifies source \s-1IP\s0 address. .PP Monit will, by default, send up to \fIthree\fR ping request packets in one cycle to prevent false alarm (i.e. up to 66% packet loss is tolerated). You can set the \fB\s-1COUNT\s0\fR option to a value between 1 and 20 to send more or fewer packets. If you require 100% ping success, set the count to 1 (i.e. just one request will be sent, and if the packet was lost an error will be reported). .PP Note that many ISPs have started to filter out ping or \s-1ICMP\s0 packets now, in which case there will be no reply from the host. .PP If a ping test is used in a check host entry, this test is run first and if the test should fail, we assume that the connection to the host is down and Monit will \fInot\fR continue with any subsequent port tests. .PP Example: .PP .Vb 2 \& check host mmonit.com with address mmonit.com \& if failed ping then alert # IPv4 or IPv6 \& \& check host mmonit.com with address 62.109.39.247 \& if failed ping then alert # Address is IPv4 so IPv4 is preferred .Ve .PP or test that the system is explicit accessible via IPv4 and IPv6: .PP .Vb 3 \& check host mmonit.com with address mmonit.com \& if failed ping4 then alert # IPv4 only \& if failed ping6 then alert # IPv6 only .Ve .PP or with all parameters; Send five 128 byte pings to mmonit.com and wait for up to 10 seconds for a reply .PP .Vb 2 \& check host mmonit.com with address mmonit.com \& if failed ping count 5 size 128 with timeout 10 seconds then alert .Ve .PP You can also watch host, that is supposed to be offline: .PP .Vb 2 \& check host offlinehost with address 192.168.100.50 \& if succeeded ping then alert .Ve .SS "\s-1CONNECTION TESTS\s0" .IX Subsection "CONNECTION TESTS" Monit can perform connection testing via network ports or via Unix sockets. A connection test may only be used within a process or host service type context. .PP If a service listens on one or more sockets, Monit can connect to the port (using \s-1TCP\s0 or \s-1UDP\s0) and verify that the service will accept a connection and that it is possible to write and read from the socket. If a connection is not accepted or if there is a problem with socket I/O, Monit will execute a specified action. .PP For \s-1TCP/UDP\s0 ports monit can alert on successful connection, e.g. when a service like mysql should not be publicly available. .PP \&\s-1TCP/UDP\s0 port test syntax: .PP .Vb 10 \& IF \& [HOST string] \& \& [ADDRESS string] \& [IPV4 | IPV6] \& [TYPE ] \& [ [with options {...}] \& [CERTIFICATE CHECKSUM [MD5|SHA1] string] \& [CERTIFICATE VALID for number DAYS] \& [PROTOCOL protocol | "string",...] \& [RESPONSETIME operator number ] \& [TIMEOUT number SECONDS] \& [RETRY number] \& THEN action .Ve .PP Unix socket test syntax: .PP .Vb 8 \& IF \& \& [TYPE ] \& [PROTOCOL protocol | "string",...] \& [RESPONSETIME operator number ] \& [TIMEOUT number SECONDS] \& [RETRY number] \& THEN action .Ve .PP Examples: .PP .Vb 1 \& if failed port 80 then alert \& \& if failed port 53 type udp protocol dns then alert \& \& if succeeded host example.org port 3306 type tcp protocol mysql then alert \& \& if failed unixsocket /var/run/sophie then alert .Ve .PP Options: .PP \&\fI\s-1HOST\s0 hostname\fR. Optionally specify the host to connect to. If the host is not given then localhost is assumed if this test is used inside a process entry. If this test is used inside a remote host entry then the entry's remote host is assumed. .PP \&\fI\s-1PORT\s0 number\fR. The port number to connect to .PP \&\fI\s-1UNIXSOCKET\s0 path\fR. Specifies the path to a Unix socket (local machine only). .PP \&\fI\s-1ADDRESS\s0 string\fR. The source \s-1IP\s0 address to use. .PP \&\fI\s-1IPV4\s0 | \s-1IPV6\s0 \fR. Optionally specify the \s-1IP\s0 version Monit should use when trying to connect to the port. If not used, Monit will try to connect to the first available address (IPv4 or IPv6). If multiple addresses are available and connection to one address failed, Monit will try the next address and so on until a connection succeed or until there are no more addresses left to try. .PP \&\fI\s-1TYPE\s0 [\s-1TCP\s0 | \s-1UDP\s0]\fR. Optionally specify the socket type Monit should use when trying to connect to the port. The different socket types are: \s-1TCP\s0 or \s-1UDP,\s0 where \s-1TCP\s0 is a regular stream based socket, \s-1UDP,\s0 a datagram socket. The default socket type is \s-1TCP.\s0 .PP \&\fI[\s-1SSL\s0 | \s-1TLS\s0] [with options {...}]\fR. Set \s-1SSL/TLS\s0 options and override global/default \s-1SSL\s0 options. You can set the \&\s-1SSL/TLS\s0 version to use, whether to verify certificates, trust self-signed certificates or set the \s-1SSL\s0 client certificates database-file for client certificate authentication. .PP \&\fI\s-1CERTIFICATE CHECKSUM\s0 [MD5|SHA1] hash\fR. Verify the \s-1SSL\s0 server certificate by checking its checksum. You can use either \&\s-1MD5\s0 or \s-1SHA1\s0 checksum (if you don't specify the type, Monit will determine the digest based on the hash length). You can use the \&\fIopenssl\fR command line tool to get the checksum value for your certificate, which you can then use in Monit's control file: .PP .Vb 1 \& openssl x509 \-fingerprint \-sha1 \-in server.crt | head \-1 | cut \-f2 \-d\*(Aq=\*(Aq .Ve .PP Example: .PP .Vb 5 \& if failed \& port 443 \& protocol https \& and certificate checksum = "1ED948A6F4258ACAB964227EF4EB19FCC453B0F8" \& then alert .Ve .PP \&\fI\s-1CERTIFICATE VALID\s0 for number \s-1DAYS\s0\fR. Send an alert if the certificate will expire in the given number of days. This test is pretty useful to get a notification when it is time to renew your \s-1SSL\s0 certificate. .PP Example: .PP .Vb 5 \& if failed \& port 443 \& protocol https \& and certificate valid > 30 days \& then alert .Ve .PP \&\fI\s-1PROTOCOL\s0 protocol\fR. Optionally specify the protocol Monit should speak when a connection is established. At the moment Monit knows how to speak: \fIAPACHE-STATUS\fR \fI\s-1DNS\s0\fR \fI\s-1DWP\s0\fR \fI\s-1FAIL2BAN\s0\fR \fI\s-1FTP\s0\fR \fI\s-1GPS\s0\fR \fI\s-1HTTP\s0\fR \fI\s-1HTTPS\s0\fR \fI\s-1IMAP\s0\fR \fI\s-1IMAPS\s0\fR \fI\s-1CLAMAV\s0\fR \fI\s-1LDAP2\s0\fR \fI\s-1LDAP3\s0\fR \fI\s-1LMTP\s0\fR \fI\s-1MEMCACHE\s0\fR \fI\s-1MONGODB\s0\fR \fI\s-1MQTT\s0\fR \fI\s-1MYSQL\s0\fR \fI\s-1MYSQLS\s0\fR \fI\s-1NNTP\s0\fR \fI\s-1NTP3\s0\fR \fI\s-1PGSQL\s0\fR \fI\s-1POP\s0\fR \fI\s-1POPS\s0\fR \fIPOSTFIX-POLICY\fR \fI\s-1RADIUS\s0\fR \fI\s-1RDATE\s0\fR \fI\s-1REDIS\s0\fR \fI\s-1RSYNC\s0\fR \fI\s-1SIEVE\s0\fR \fI\s-1SIP\s0\fR \fI\s-1SMTP\s0\fR \fI\s-1SMTPS\s0\fR \fI\s-1SPAMASSASSIN\s0\fR \fI\s-1SSH\s0\fR \fI\s-1TNS\s0\fR \fI\s-1WEBSOCKET\s0\fR .PP If the target server's protocol is not found in this list, simply do not specify the protocol and Monit will use a default connection test. .PP \&\fI\s-1RESPONSETIME\s0\fR parameter sets the response time limit. \fIoperator\fR is a choice of \*(L"<\*(R",\*(L">\*(R",\*(L"!=\*(R",\*(L"==\*(R" in c notation, \*(L"gt\*(R", \&\*(L"lt\*(R", \*(L"eq\*(R", \*(L"ne\*(R" in shell sh notation and \*(L"greater\*(R", \*(L"less\*(R", \&\*(L"equal\*(R", \*(L"notequal\*(R" in human readable form (if not specified, default is \s-1EQUAL\s0). .PP \&\fI\s-1TIMEOUT\s0 number \s-1SECONDS\s0\fR. Optionally specifies the connect and read timeout for the connection. If Monit cannot connect to the server within this time it will assume that the connection failed and execute the specified action. The default connect timeout is 5 seconds. .PP \&\fI\s-1RETRY\s0 number\fR. Optionally specifies the number of consecutive retries within the same testing cycle in the case that the connection failed. The default is fail on first error. .PP \&\fIaction\fR is a choice of \*(L"\s-1ALERT\*(R", \*(L"RESTART\*(R", \*(L"START\*(R", \*(L"STOP\*(R", \&\*(L"EXEC\*(R"\s0 or \*(L"\s-1UNMONITOR\*(R".\s0 .PP \fISpecific protocol test options\fR .IX Subsection "Specific protocol test options" .PP \s-1GENERIC\s0 (\s-1SEND/EXPECT\s0) .IX Subsection "GENERIC (SEND/EXPECT)" .PP If Monit does not support the protocol spoken by the server, you can write your own protocol-test using \fIsend\fR and \fIexpect\fR strings. The \fI\s-1SEND\s0\fR statement sends a string to the server port and the \fI\s-1EXPECT\s0\fR statement compares a string read from the server with the string given in the expect statement. .PP Syntax: .PP .Vb 1 \& [ "string"]+ .Ve .PP Monit will send a string as it is, and you \fBmust\fR remember to include \s-1CR\s0 and \s-1LF\s0 in the string sent to the server if the protocol expects such characters to terminate a string (most text based protocols used over Internet do). .PP Monit will by default read up to 255 bytes from the server and use this string when comparing the \s-1EXPECT\s0 string. You can override the default value using the set limits statement. .PP You can use non-printable characters in a \s-1SEND\s0 string if needed. Use the hex notation, \e0xHEXHEX to send any char in the range \&\e0x00\-\e0xFF, that is, 0\-255 in decimal. For example, to test a Quake 3 server: .PP .Vb 2 \& send "\e0xFF\e0xFF\e0xFF\e0xFFgetstatus" \& expect "sv_floodProtect|sv_maxPing" .Ve .PP If your system supports \s-1POSIX\s0 regular expressions, you can use regular expressions in the \s-1EXPECT\s0 string, see \fBregex\fR\|(7) to learn more about the types of regular expressions you can use in an expect string. .PP Since both regex and string compare operates on a zero terminated string, you cannot test for '\e0' in an \s-1EXPECT\s0 buffer since this character marks the end of the buffer. However, we escape '\e0' in the expect buffer as \*(L"\e0\*(R" which you can test for. That is, '\e' followed by the ascii value for 0. For instance, here is how to test for an expect string that starts with zero followed by any number of characters. .PP .Vb 1 \& expect "^[\e\e]0.*" .Ve .PP Here is a simple \s-1SMTP\s0 protocol example: .PP .Vb 7 \& if failed \& port 25 and \& expect "^220.*" \& send "HELO localhost.localdomain\er\en" \& expect "^250.*" \& send "QUIT\er\en" \& then alert .Ve .PP \&\s-1SEND/EXPECT\s0 can be used with any socket type, such as \s-1TCP\s0 sockets, \&\s-1UNIX\s0 sockets and \s-1UDP\s0 sockets. .PP \s-1HTTP\s0 .IX Subsection "HTTP" .PP Syntax: .PP .Vb 9 \& PROTO(COL) HTTP \& [USERNAME "string"] \& [PASSWORD "string"] \& [REQUEST "string"] \& [METHOD ] \& [STATUS operator number] \& [CHECKSUM checksum] \& [HTTP HEADERS list of headers] \& [CONTENT < "=" | "!=" > STRING] .Ve .PP \&\fI\s-1USERNAME\s0\fR is an optional username for Basic authentication .PP \&\fI\s-1PASSWORD\s0\fR is an optional password for Basic authentication .PP \&\fI\s-1REQUEST\s0\fR option can set an \s-1URL\s0 string specifying a document on the \&\s-1HTTP\s0 server. If the request statement isn't specified, the default \*(L"/\*(R" page will be requested. .PP For example: .PP .Vb 5 \& if failed \& port 80 \& protocol http \& request "/data/show?a=b&c=d" \& then restart .Ve .PP \&\fI\s-1METHOD\s0\fR set the \s-1HTTP\s0 request method. If not specified, Monit prefers the \s-1HTTP GET\s0 request method, which is more common then the \s-1HEAD\s0 method. One may want to set the method explicitly to \s-1HEAD\s0 to save the network bandwidth. .PP \&\fI\s-1STATUS\s0\fR option can be used to explicitly test the \s-1HTTP\s0 status code returned by the \s-1HTTP\s0 server. If not used, the \s-1HTTP\s0 protocol test will fail if the status code returned is greater than or equal to 400. You can override this behaviour by using the \fIstatus\fR qualifier. .PP For example to test that a page does \fBnot\fR exist (the \s-1HTTP\s0 server should return 404 in this case): .PP .Vb 6 \& if failed \& port 80 \& protocol http \& request "/non/existent.php" \& status = 404 \& then alert .Ve .PP \&\fI\s-1CHECKSUM\s0\fR You can test the checksum of documents returned by a \s-1HTTP\s0 server. Either \s-1MD5\s0 or \s-1SHA1\s0 hash can be used. Monit will \fBnot\fR test the checksum for a document if the server does not set the \s-1HTTP\s0 \&\fIContent-Length\fR header. A \s-1HTTP\s0 server should set this header when it server a static document (i.e. a file). There are no limitation on the document size, but keep in mind that Monit will use time to download the document over the network to compute the checksum. .PP Example: .PP .Vb 6 \& if failed \& port 80 \& protocol http \& request "/page.html" \& checksum 8f7f419955cefa0b33a2ba316cba3659 \& then alert .Ve .PP \&\fI\s-1HTTP HEADERS\s0\fR can be used to send a list of \s-1HTTP\s0 headers when using the \s-1HTTP\s0 protocol test. For instance, the host header. If the host header is not set, Monit will use the hostname or IP-address of the host as specified in the check host statement. Specifying a host header is useful if you want to connect to and test a name-based virtual host. The syntax for setting \s-1HTTP\s0 headers is .PP .Vb 1 \& http headers [name:value, name:value,..] .Ve .PP where each name:value pair is separated with ','. If you need to use ':' in the value string, for instance to set port number for a host header, you must enclose the value in quotes. For example, .PP .Vb 1 \& http headers [Host: "mmonit.com:443"] .Ve .PP In a check host context, using this statement might look like .PP .Vb 7 \& check host mmonit.com with address mmonit.com \& if failed \& port 80 protocol http \& with http headers [Host: mmonit.com, Cache\-Control: no\-cache, \& Cookie: csrftoken=nj1bI3CnMCaiNv4beqo8ZaCfAQQvpgLH] \& and request /monit/ with content = "Monit [0\-9.]+" \& then alert .Ve .PP Setting \s-1HTTP\s0 headers is associated with the \s-1HTTP\s0 protocol test and must come before \fIrequest\fR as in the example above. .PP The \fI\s-1CONTENT\s0\fR option sets the pattern which is expected in the data returned by the server. If the pattern doesn't match, the test fails. In the example above, if the server does not return a page with the name Monit followed by a version number the test will fail. .PP By default, at maximum 1MB of content is inspected. You can increase this limit using the set limits statement. .PP For example: .PP .Vb 5 \& if failed \& port 80 \& protocol http \& content = "foobar [0\-9.]+" \& then alert .Ve .PP APACHE-STATUS .IX Subsection "APACHE-STATUS" .PP The \fIAPACHE-STATUS\fR test allows one to check server performance by examination of the status page generated by Apache's mod_status, which is expected to be at its default address of http://www.example.com/server\-status. .PP Syntax: .PP .Vb 1 \& PROTOCOL APACHE\-STATUS [PATH ] [USERNAME ] [PASSWORD ] [ ]+ .Ve .PP \&\fI\s-1PATH\s0\fR is an optional path to apache status (\*(L"/server\-status\*(R" by default) .PP \&\fI\s-1USERNAME\s0\fR is an optional username for Basic authentication .PP \&\fI\s-1PASSWORD\s0\fR is an optional password for Basic authentication .PP \&\fIproperty\fR is acronym for child status: .PP .Vb 10 \& (1) logging (loglimit) \& (2) closing connections (closelimit) \& (3) performing DNS lookups (dnslimit) \& (4) in keepalive with a client (keepalivelimit) \& (5) replying to a client (replylimit) \& (6) receiving a request (requestlimit) \& (7) initialising (startlimit) \& (8) waiting for incoming connections (waitlimit) \& (9) gracefully closing down (gracefullimit) \& (10) performing cleanup procedures (cleanuplimit) .Ve .PP \&\fIoperator\fR is one of \*(L"<\*(R", \*(L"=\*(R", \*(L">\*(R". .PP \&\fInumber\fR is percentile numeric limit. .PP Each of these limits can be compared against a value relative to the total number of active Apache child processes. .PP You can combine all of these tests into one expression or you can choose to test a certain limit only. If you combine the limits you must connect them together using the \s-1OR\s0 keyword. .PP Example: .PP .Vb 5 \& if failed port 80 protocol apache\-status \& loglimit > 10% or \& dnslimit > 50% or \& waitlimit < 20% \& then alert .Ve .PP \s-1MQTT\s0 .IX Subsection "MQTT" .PP Syntax: .PP .Vb 1 \& PROTOCOL MQTT [USERNAME string PASSWORD string] .Ve .PP \&\fI\s-1USERNAME\s0\fR \s-1MQTT\s0 username .PP \&\fI\s-1PASSWORD\s0\fR \s-1MQTT\s0 password .PP Username and password (credentials) are \fBoptional\fR. If not used, Monit will try anonymous connect, which may trigger authorization error => credentials are recommended unless your server allows anonymous connect. .PP Example: .PP .Vb 4 \& check process mosquitto with pidfile /var/run/mosquitto.pid \& start program = "/sbin/start mosquitto" \& stop program = "/sbin/stop mosquitto" \& if failed port 1883 protocol mqtt then alert .Ve .PP \s-1MYSQL\s0 .IX Subsection "MYSQL" .PP Syntax: .PP .Vb 1 \& PROTOCOL MYSQL[S] [USERNAME string PASSWORD string [RSAKEY CHECKSUM string]] .Ve .PP \&\fI\s-1USERNAME\s0\fR MySQL username. .PP \&\fI\s-1PASSWORD\s0\fR MySQL password (special characters can be used, but for non-alphanumerics the password has to be quoted). .PP \&\fI\s-1RSKEY CHECKSUM\s0\fR If you use unsecured connection (plain \s-1MYSQL\s0 without \s-1TLS\s0), you can set the expected \s-1MD5\s0 or \s-1SHA1\s0 checksum of the server's \s-1RSA\s0 key to protect afainst man-in-the-middle attacks. Monit will check the key fingerprint before sending the password to the server. .PP Username and password (credentials) are \fBoptional\fR and if not set, Monit will perform the test using anonymous login. This can cause an authentication error to be logged in your MySQL log, depending on your MySQL configuration. .PP If credentials are set, Monit will try to login. Monit does not require any database privileges, it just needs the database user. You might want to create standalone user for Monit to use when testing, for example: .PP .Vb 2 \& CREATE USER \*(Aqmonit\*(Aq@\*(Aqhost_from_which_monit_performs_testing\*(Aq IDENTIFIED BY \*(Aqmysecretpassword\*(Aq; \& FLUSH PRIVILEGES; .Ve .PP Example: .PP .Vb 7 \& check process mysql with pidfile /var/run/mysqld/mysqld.pid \& start program = "/sbin/start mysql" \& stop program = "/sbin/stop mysql" \& if failed \& port 3306 \& protocol mysql username "foo" password "bar" \& then alert .Ve .PP or with unix-socket start/stop commands .PP .Vb 7 \& check process mysql with pidfile /var/run/mysqld/mysqld.pid \& start program = "/usr/local/mysql/support\-files/mysql.server start" \& stop program = "/usr/local/mysql/support\-files/mysql.server stop" \& if failed \& unixsocket /tmp/mysql.sock \& protocol mysql username "foo" password "bar" \& then alert .Ve .PP You can enable the \s-1TLS\s0 encryption for the test by using \s-1MYSQLS\s0 as protocol name: .PP .Vb 4 \& if failed \& port 3306 \& protocol mysqls username "foo" password "bar" \& then alert .Ve .PP \s-1PGSQL\s0 .IX Subsection "PGSQL" .PP Syntax: .PP .Vb 1 \& PROTOCOL PGSQL [USERNAME string] [PASSWORD string] [DATABASE string]] .Ve .PP \&\fI\s-1USERNAME\s0\fR PostgreSQL username. .PP \&\fI\s-1PASSWORD\s0\fR PostgreSQL password (special characters can be used, but for non-alphanumerics the password has to be quoted). .PP \&\fI\s-1DATABASE\s0\fR PostgreSQL database (defaults to the database that matches the username if not set). .PP Username and password (credentials) are \fBoptional\fR and if not set, Monit will perform the test with hardcoded user=root and database=root, which may trigger errors in PostgreSQL logs. .PP If credentials are set, Monit will try to login. You might want to create standalone user for Monit to use when testing. .PP Monit currently supports only 'password' and 'md5' PostgreSQL authentication methods. If the server asks for authentication method that Monit doesn't support (such as 'scram\-sha\-256'), Monit terminates the connection and the test succeeds (although monit cannot authenticate, the server is communicating). .PP To allow access to Monit for testing purposes, one can create an account and allow access for example like this: .PP PostgreSQL pg_hba.conf entry example: .PP .Vb 2 \& # TYPE DATABASE USER ADDRESS METHOD \& host test monit 127.0.0.1/32 md5 .Ve .PP Monit configurations example: .PP .Vb 7 \& check process postgresql with pidfile /var/run/postgresql/12\-main.pid \& start program = "/bin/systemctl postgresql start" \& stop program = "/bin/systemctl postgresql stop" \& if failed \& port 5432 \& protocol pgsql username "monit" password "123456" database "test" \& then alert .Ve .PP \s-1RADIUS\s0 .IX Subsection "RADIUS" .PP Syntax: .PP .Vb 1 \& PROTOCOL RADIUS [SECRET string] .Ve .PP \&\fI\s-1SECRET\s0\fR you may specify an alternative secret, default is \*(L"testing123\*(R". .PP For example: .PP .Vb 7 \& check process radiusd with pidfile /var/run/radiusd.pid \& start program = "/etc/init.d/freeradius start" \& stop program = "/etc/init.d/freeradius stop" \& if failed \& host 127.0.0.1 port 1812 type udp protocol radius \& secret pingpong \& then alert .Ve .PP \s-1SIP\s0 .IX Subsection "SIP" .PP The \s-1SIP\s0 protocol is used by communication platform servers such as Asterisk and FreeSWITCH. .PP Syntax: .PP .Vb 1 \& PROTOCOL SIP [TARGET valid@uri] [MAXFORWARD n] .Ve .PP \&\fI\s-1TARGET\s0\fR you may specify an alternative recipient for the message, by adding a valid sip uri after this keyword. .PP \&\fI\s-1MAXFORWARD\s0\fR Limit the number of proxies or gateways that can forward the request to the next server. It's value is an integer in the range 0\-255, set by default to 70. If max-forward = 0, the next server may respond 200 \s-1OK\s0 (test succeeded) or send a 483 Too Many Hops (test failed) .PP For example: .PP .Vb 5 \& check host openser_all with address 127.0.0.1 \& if failed \& port 5060 type udp protocol sip \& with target "localhost:5060" and maxforward 6 \& then alert .Ve .PP \s-1SMTP\s0 .IX Subsection "SMTP" .PP Syntax: .PP .Vb 1 \& PROTOCOL SMTP[S] [USERNAME string PASSWORD string] .Ve .PP \&\fI\s-1USERNAME\s0\fR \s-1SMTP\s0 username. .PP \&\fI\s-1PASSWORD\s0\fR \s-1SMTP\s0 password (special characters can be used, but for non-alphanumerics the password has to be quoted). .PP Credentials are \fIoptional\fR and when used will perform authentication during testing so you can test that authentication also works. We recommend using \fIsmtps\fR if authentication is to be used to encrypt the communication. If no credentials are set, Monit will just perform a basic protocol test. .PP Example: .PP .Vb 7 \& check process postfix with pidfile /var/spool/postfix/pid/master.pid \& start program = "/etc/init.d/postfix start" \& stop program = "/etc/init.d/postfix stop" \& if failed \& port 25 \& protocol smtp \& then alert .Ve .PP Example using authentication and \s-1STARTTLS/SMTPS:\s0 .PP .Vb 9 \& check process postfix with pidfile /var/spool/postfix/pid/master.pid \& start program = "/etc/init.d/postfix start" \& stop program = "/etc/init.d/postfix stop" \& if failed \& port 25 \& protocol smtps \& username "foo" \& password "bar" \& then alert .Ve .PP \s-1WEBSOCKET\s0 .IX Subsection "WEBSOCKET" .PP Syntax: .PP .Vb 5 \& PROTOCOL WEBSOCKET \& [REQUEST string] \& [HOST string] \& [ORIGIN string] \& [VERSION number] .Ve .PP \&\fI\s-1HOST\s0\fR you may specify an alternative Host header .PP \&\fI\s-1REQUEST\s0\fR you may specify an alternative request, default is \*(L"/\*(R" .PP \&\fI\s-1ORIGIN\s0\fR you may specify an alternative origin, default is \*(L"https://mmonit.com\*(R" .PP \&\fI\s-1VERSION\s0\fR you may specify an alternative version, default is \*(L"0\*(R" .PP For example: .PP .Vb 8 \& check host websocket.org with address "echo.websocket.org" \& if failed \& port 80 protocol websocket \& host "echo.websocket.org" \& request "/" \& origin \*(Aqhttp://websocket.com\*(Aq \& version 13 \& then alert .Ve .SH "MANAGE YOUR MONIT INSTANCES" .IX Header "MANAGE YOUR MONIT INSTANCES" M/Monit expands on Monit's capabilities and provides monitoring and management of all your Monit enabled hosts. .PP M/Monit uses Monit as an agent. With regular intervals, Monit sends a status message to M/Monit with a snapshot of the host it is running on. .PP M/Monit presents the collected data in charts and event logs and give you the option to view key performance data of all your hosts in a modern, clean and well designed user interface which also works on mobile devices. .PP From M/Monit, you can also start, stop and restart services on your hosts running Monit. .PP To send data to M/Monit, add the following statement to your Monit control file: .PP .Vb 4 \& SET MMONIT \& [TIMEOUT SECONDS] \& [REGISTER WITHOUT CREDENTIALS] \& [[WITH] HOSTGROUPS \*(Aq[\*(Aq "name", ... \*(Aq]\*(Aq ] .Ve .PP Example: .PP .Vb 1 \& set mmonit https://monit:monit@192.168.1.10:8443/collector .Ve .PP Monit will register itself in M/Monit and will start sending status and event messages to M/Monit. We recommend using \fIhttps\fR as in the example above to ensure that the communication between Monit and M/Monit is secure. .PP The password should be \s-1URL\s0 encoded if it contains URL-significant characters like \*(L":\*(R", \*(L"?\*(R", \*(L"@\*(R". .PP The default timeout is 5 seconds, you can customise the timeout using the \fI\s-1TIMEOUT\s0\fR option. .PP When Monit registers itself in M/Monit it sends credentials that can be used to perform service actions from M/Monit. You can disable sending credentials by using \fI\s-1REGISTER WITHOUT CREDENTIALS\s0\fR and instead manually add credentials in M/Monit. .PP You can optionally add Monit to one or more M/Monit hostgroups. If the hostgroup doesn't exist, it'll be created automatically. Example: .PP .Vb 3 \& set mmonit \& https://monit:monit@192.168.1.10:8443/collector \& with hostgroups [ Oslo, "Mail servers" ] .Ve .SH "CONFIGURATION EXAMPLES" .IX Header "CONFIGURATION EXAMPLES" The simplest form is just the check statement. In this example we check to see if our web server is running and raise an alert if not: .PP .Vb 1 \& check process nginx with pidfile /var/run/nginx.pid .Ve .PP To have Monit start the server if it's not running, add a start statement: .PP .Vb 2 \& check process nginx with pidfile /var/run/nginx.pid \& start program = "/etc/init.d/nginx start" .Ve .PP Here's a more advanced example for monitoring an apache web-server listening on the default port number for \s-1HTTP\s0 and \s-1HTTPS.\s0 In this example Monit will restart apache if it's not accepting connections at the port numbers. The method Monit use for restart is to first execute the stop-program, then wait (up to 30s) for the process to stop and then execute the start-program and wait (30s) for it to start. The length of start or stop wait can be overridden using the 'timeout' option. If Monit was unable to stop or start the service a failed alert message will be sent if you have requested alert messages to be sent. .PP .Vb 5 \& check process apache with pidfile /var/run/httpd.pid \& start program = "/etc/init.d/httpd start" with timeout 60 seconds \& stop program = "/etc/init.d/httpd stop" \& if failed port 80 for 2 cycles then restart \& if failed port 443 for 2 cycles then restart .Ve .PP This example demonstrate how you can run a program as a specified user (uid) and with a specified group (gid). Many daemon programs can do the uid and gid switch by themselves, but for those programs that does not (e.g. Java programs), monit's ability to start a program as a certain user can be very useful. In this example we start the Tomcat Java Servlet Engine as the standard \fInobody\fR user and group. Please note that Monit can only switch uid and gid for the program if the super-user is running Monit, otherwise Monit will simply ignore the request to change uid and gid. .PP .Vb 7 \& check process tomcat with pidfile /var/run/tomcat.pid \& start program = "/etc/init.d/tomcat start" \& as uid "nobody" and gid "nobody" \& stop program = "/etc/init.d/tomcat stop" \& # You can also use id numbers instead and write: \& as uid 99 and with gid 99 \& if failed port 8080 then alert .Ve .PP In this example we use udp for connection testing to check if the name-server is running: .PP .Vb 4 \& check process named with pidfile /var/run/named.pid \& start program = "/etc/init.d/named start" \& stop program = "/etc/init.d/named stop" \& if failed port 53 use type udp protocol dns then restart .Ve .PP The following example illustrates how to check if the service \&'sophie' is answering connections on its Unix domain socket: .PP .Vb 4 \& check process sophie with pidfile /var/run/sophie.pid \& start program = "/etc/init.d/sophie start" \& stop program = "/etc/init.d/sophie stop" \& if failed unix /var/run/sophie then restart .Ve .PP In this example we check an apache web-server running on localhost which answers for several IP-based virtual hosts or vhosts, hence the host statement before port: .PP .Vb 6 \& check process apache with pidfile /var/run/httpd.pid \& start "/etc/init.d/httpd start" \& stop "/etc/init.d/httpd stop" \& if failed host www.sol.no port 80 then alert \& if failed host shop.sol.no port 443 then alert \& if failed host chat.sol.no port 80 then alert .Ve .PP To make sure that Monit is communicating with a \s-1HTTP\s0 server a protocol test can be added: .PP .Vb 6 \& check process apache with pidfile /var/run/httpd.pid \& start "/etc/init.d/httpd start" \& stop "/etc/init.d/httpd stop" \& if failed \& host www.sol.no port 80 protocol http \& then alert .Ve .PP This example demonstrate a different way to check a web-server using the send/expect mechanism: .PP .Vb 8 \& check process apache with pidfile /var/run/httpd.pid \& start "/etc/init.d/httpd start" \& stop "/etc/init.d/httpd stop" \& if failed \& host www.sol.no port 80 and \& send "GET / HTTP/1.1\er\enHost: www.sol.no\er\en\er\en" \& expect "HTTP/[0\-9\e.]{3} 200.*" \& then alert .Ve .PP Here we ping a remote host to check if it is up and if not, send an alert: .PP .Vb 2 \& check host www.tildeslash.com with address www.tildeslash.com \& if failed ping then alert .Ve .PP In the following example we ask Monit to compute and verify the checksum for the underlying apache binary used by the start and stop programs. If the checksum test should fail, monitoring will be disabled to prevent possibly restarting a compromised binary: .PP .Vb 5 \& check process apache with pidfile /var/run/httpd.pid \& start program = "/etc/init.d/httpd start" \& stop program = "/etc/init.d/httpd stop" \& if failed host www.tildeslash.com port 80 then restart \& depends on apache_bin \& \& check file apache_bin with path /usr/local/apache/bin/httpd \& if failed checksum then unmonitor .Ve .PP In this example we ask Monit to test a document's checksum on a remote server. If the checksum was changed we send an alert: .PP .Vb 6 \& check host mmonit.com with address mmonit.com \& if failed \& port 80 protocol http and \& request "/monit/dist/monit\-5.7.tar.gz" \& with checksum f9d26b8393736b5dfad837bb13780786 \& then alert .Ve .PP Here are a couple of tests for some popular communication servers, using the \s-1SIP\s0 protocol. First we test a FreeSWITCH server and then an Asterisk server .PP .Vb 12 \& check process freeswitch \& with pidfile /usr/local/freeswitch/log/freeswitch.pid \& start program = "/usr/local/freeswitch/bin/freeswitch \-nc \-hp" \& stop program = "/usr/local/freeswitch/bin/freeswitch \-stop" \& if total memory > 1000.0 MB for 5 cycles then alert \& if total memory > 1500.0 MB for 5 cycles then alert \& if total memory > 2000.0 MB for 5 cycles then restart \& if cpu > 60% for 5 cycles then alert \& if failed \& port 5060 type udp protocol SIP \& target me@foo.bar and maxforward 10 \& then restart \& \& check process asterisk \& with pidfile /var/run/asterisk/asterisk.pid \& start program = "/usr/sbin/asterisk" \& stop program = "/usr/sbin/asterisk \-r \-x \*(Aqshutdown now\*(Aq" \& if total memory > 1000.0 MB for 5 cycles then alert \& if total memory > 1500.0 MB for 5 cycles then alert \& if total memory > 2000.0 MB for 5 cycles then restart \& if cpu > 60% for 5 cycles then alert \& if failed \& port 5060 type udp protocol SIP \& and target me@foo.bar maxforward 10 \& then restart .Ve .PP Some servers are slow starters, like for example Java based Application Servers. If we want to keep the poll-cycle low (i.e. < 60 seconds) but allow some services to take its time to start, the \fBevery\fR statement is handy: .PP .Vb 4 \& check process dynamo with pidfile /etc/dynamo.pid every 2 cycles \& start program = "/etc/init.d/dynamo start" \& stop program = "/etc/init.d/dynamo stop" \& if failed port 8840 then alert .Ve .PP Here is an example where we group together two database entries so you can manage them together, e.g.; 'Monit \-g database start all'. The mode statement is also illustrated in the first entry and have the effect that Monit will not try to (re)start this service if it is not running: .PP .Vb 5 \& check process sybase with pidfile /var/run/sybase.pid \& start = "/etc/init.d/sybase start" \& stop = "/etc/init.d/sybase stop" \& mode passive \& group database \& \& check process oracle with pidfile /var/run/oracle.pid \& start program = "/etc/init.d/oracle start" \& stop program = "/etc/init.d/oracle stop" \& if failed \& port 9001 protocol tns \& then restart \& group database .Ve .PP This resource checks example will send an alert if \s-1CPU\s0 usage of the Apache's \s-1HTTP\s0 daemon and its child processes goes beyond 60% for two cycles. Apache is restarted if the \s-1CPU\s0 usage is over 80% for five cycles or the memory usage is over 100Mb for five cycles: .PP .Vb 7 \& check process apache with pidfile /var/run/httpd.pid \& start program = "/etc/init.d/httpd start" \& stop program = "/etc/init.d/httpd stop" \& if cpu > 40% for 2 cycles then alert \& if total cpu > 60% for 2 cycles then alert \& if total cpu > 80% for 5 cycles then restart \& if mem > 100 MB for 5 cycles then stop .Ve .PP This examples demonstrate the timestamp statement with exec and how you may restart apache if its configuration file was changed. .PP .Vb 3 \& check file httpd.conf with path /etc/httpd/httpd.conf \& if changed timestamp \& then exec "/etc/init.d/httpd graceful" .Ve .PP In this example we demonstrate usage of the extended alert statement and a file check dependency: .PP .Vb 10 \& check process apache with pidfile /var/run/httpd.pid \& start = "/etc/init.d/httpd start" \& stop = "/etc/init.d/httpd stop" \& alert admin@bar on {nonexist, timeout} \& with mail\-format { \& from: bofh@$HOST \& subject: apache $EVENT \- $ACTION \& message: This event occurred on $HOST at $DATE. \& Your faithful employee, \& monit \& } \& if failed host www.tildeslash.com port 80 then restart \& depend httpd_bin \& group apache \& \& check file httpd_bin with path /usr/local/apache/bin/httpd \& alert security@bar on {checksum, timestamp, \& permission, uid, gid} \& with mail\-format {subject: Alaaarrm! on $HOST} \& if failed checksum \& and expect 8f7f419955cefa0b33a2ba316cba3659 \& then unmonitor \& if failed permission 755 then unmonitor \& if failed uid "root" then unmonitor \& if failed gid "root" then unmonitor \& if changed timestamp then alert \& group apache .Ve .PP In this example, we demonstrate usage of the depend statement. In this case, we want to start oracle and apache. However, we've set up apache to use oracle as a back end, and if oracle is restarted, apache must be restarted as well. .PP .Vb 4 \& check process apache with pidfile /var/run/httpd.pid \& start = "/etc/init.d/httpd start" \& stop = "/etc/init.d/httpd stop" \& depends on oracle \& \& check process oracle with pidfile /var/run/oracle.pid \& start = "/etc/init.d/oracle start" \& stop = "/etc/init.d/oracle stop" \& if failed port 9001 for 5 cycles then restart .Ve .PP Next, we have 2 services, oracle-import and oracle-export that need to be restarted if oracle is restarted, but are independent of each other. .PP .Vb 4 \& check process oracle with pidfile /var/run/oracle.pid \& start = "/etc/init.d/oracle start" \& stop = "/etc/init.d/oracle stop" \& if failed port 9001 for 3 cycles then restart \& \& check process oracle\-import \& with pidfile /var/run/oracle\-import.pid \& start = "/etc/init.d/oracle\-import start" \& stop = "/etc/init.d/oracle\-import stop" \& depends on oracle \& \& check process oracle\-export \& with pidfile /var/run/oracle\-export.pid \& start = "/etc/init.d/oracle\-export start" \& stop = "/etc/init.d/oracle\-export stop" \& depends on oracle .Ve .SH "FILES" .IX Header "FILES" \&\fI~/.monitrc\fR Default run control file .PP \&\fI/etc/monitrc\fR If the control file is not found in the default location and /etc contains a \fImonitrc\fR file, this file will be used instead. .PP \&\fI./monitrc\fR If the control file is not found in either of the previous two locations, and the current working directory contains a \fImonitrc\fR file, this file is used instead. .PP \&\fI~/.monit.pid\fR Lock file to help prevent concurrent runs (non-root mode). .PP \&\fI/run/monit.pid\fR Lock file to help prevent concurrent runs (root mode, Linux systems, if /run directory is available). .PP \&\fI/var/run/monit.pid\fR Lock file to help prevent concurrent runs (root mode, Linux systems). .PP \&\fI/etc/monit.pid\fR Lock file to help prevent concurrent runs (root mode, systems without /var/run). .PP \&\fI~/.monit.state\fR Monit saves its state to this file and utilises information found in this file to recover from a crash. This is a binary file and its content is only of interest to monit. You may set the location of this file in the Monit control file or by using the \-s switch when Monit is started. .PP \&\fI~/.monit.id\fR Monit save its unique id to this file. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" No environment variables are used by Monit. However, when Monit executes a start/stop/restart program or an exec action, it will set several environment variables which can be utilised by the executable to get information about the event, which triggered the action. .PP The following environment variable is set for every program executed by monit, including \fIcheck program\fR: .IP "\s-1MONIT_SERVICE\s0" 4 .IX Item "MONIT_SERVICE" The name of the service (from monitrc) for which the program is executed. .PP The following environment variables are only available in the service start/stop/restart program and exec action context: .IP "\s-1MONIT_EVENT\s0" 4 .IX Item "MONIT_EVENT" The event that occurred on the service .IP "\s-1MONIT_DESCRIPTION\s0" 4 .IX Item "MONIT_DESCRIPTION" A description of the error condition .IP "\s-1MONIT_DATE\s0" 4 .IX Item "MONIT_DATE" The time and date (\s-1RFC 822\s0 style) the event occurred .IP "\s-1MONIT_HOST\s0" 4 .IX Item "MONIT_HOST" The host the event occurred on .PP The following environment variables are only available in the \&\fIcheck process\fR start/stop/restart program and exec action context: .IP "\s-1MONIT_PROCESS_PID\s0" 4 .IX Item "MONIT_PROCESS_PID" The process pid. This may be 0 if the process was (re)started, .IP "\s-1MONIT_PROCESS_MEMORY\s0" 4 .IX Item "MONIT_PROCESS_MEMORY" Process memory. This may be 0 if the process was (re)started, .IP "\s-1MONIT_PROCESS_CHILDREN\s0" 4 .IX Item "MONIT_PROCESS_CHILDREN" Process children. This may be 0 if the process was (re)started, .IP "\s-1MONIT_PROCESS_CPU_PERCENT\s0" 4 .IX Item "MONIT_PROCESS_CPU_PERCENT" Process cpu%. This may be 0 if the process was (re)started, .PP The following environment variables are only available for \&\fIcheck program\fR start/stop/restart program and exec action context: .IP "\s-1MONIT_PROGRAM_STATUS\s0" 4 .IX Item "MONIT_PROGRAM_STATUS" The program status (exit value). .PP The following environment variables can be used for debugging: .IP "\s-1SSLKEYLOGFILE\s0" 4 .IX Item "SSLKEYLOGFILE" To debug the \s-1SSL/TLS\s0 connections, Monit supports the SSLKEYLOGFILE= environment variable in debug mode (with the \-v option). The log file can be used with Wireshark to decrypt the \s-1SSL/TLS\s0 communication (set the path to the logfile in Wireshark's \*(L"Settings \-> Protocols \-> \s-1TLS\s0 \-> (Pre)\-Master\-Secret log filename\*(R". .SH "SIGNALS" .IX Header "SIGNALS" If a Monit daemon is running, \s-1SIGUSR1\s0 wakes it up from its sleep phase and forces a poll of all services. \s-1SIGTERM\s0 and \s-1SIGINT\s0 will gracefully terminate a Monit daemon. The \s-1SIGTERM\s0 signal is sent to a Monit daemon if Monit is started with the \fIquit\fR action argument. .PP Sending a \s-1SIGHUP\s0 signal to a running Monit daemon will force the daemon to reinitialise itself, specifically it will reread configuration, close and reopen log files. .PP Running Monit in foreground while a background Monit daemon is running will wake up the daemon. .SH "NOTES" .IX Header "NOTES" This is a very silent program. Use the \-v switch if you want to see what Monit is doing, and tail \-f the log file. Optionally for testing purposes; you can start Monit with the \-Iv switch. Monit will then print debug information to the console, to stop monit in this mode, simply press CTRL^C (i.e. \s-1SIGINT\s0) in the same console. .PP The syntax (and parser) of the control file was inspired by Eric S. Raymond et al.'s excellent fetchmail program. Some portions of this man page also receive inspiration from the same authors. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2001\-2024 by Tildeslash Ltd. All Rights Reserved. This product is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 any warranty; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 for a particular purpose. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1GNU\s0 text utilities; \fBmd5sum\fR\|(1); \fBsha1sum\fR\|(1); \fBopenssl\fR\|(1); \fBglob\fR\|(7); \&\fBregex\fR\|(7); \fIhttps://mmonit.com\fR